I need to preset 4 longWords at a specific memory location in flash of the microcontroller that define the startup behaviour of the chip.
I came up with two solutions, but both more feel like a hack than a proper way to do things, any ideas how to do this better?
a) by hijacking the declaration of a typed array constant in the linker script:
program x;
const
devcfg : array[0..3] of longWord = (
$12345678,$87654321,$ffffffff,$00000000 );linker script:
.devcfg :
KEEP(*(.data.n_tc*_devcfg))
} > devcfg
or
b) by creating specialized units (very unflexible)
unit pic32mx8mhzpll;
interface
implementation
procedure dummy;assembler;nostackframe;
asm
.section ".devcfg,\"ax\",@progbits"
.long 0x12345678
.long 0x87654321
.long 0x12345678
.long 0x87654321
.text
end;end.
