[fpc-pascal] Variable alignment in arm-embedded
Ludo Brands
ludo.brands at free.fr
Fri Jun 8 06:45:47 CEST 2012
> Hi,
>
> I want to make an interrupt-vector-table for the cortex-M3 processor.
> When I read the docs of the processor good, the start of that table
> needs to be on a multiple of $100 bytes in memory. Since with
> FPC there
> seems no way of getting that table in flash I need to have it in RAM.
> But how can I have the table at those $100-bytes multiple ? I
> found an
> ALIGN directive, but that's limited to 32 bytes.
> Any suggestions ?
> I had hoped that the first variable would be at the first location in
> RAM and the first variable in the startup-code is that vector-table.
> Unfortunatly, my hope was in vain.
>
> Any help ?
>
Handcrafted alignment:
var
ReservedBlock:array[0..$1FF] of byte;
IntVectors:pointer;
begin
IntVectors:=pointer((ptruint(@ReservedBlock[0])+$100) and not $ff);
End;
Or dynamic:
Var
pReservedBlock,IntVectors:pointer;
begin
Getmem(pReservedBlock,$200);
IntVectors:=pointer((ptruint(pReservedBlock)+$100) and not $ff);
End;
Ludo
More information about the fpc-pascal
mailing list