[arm-gnu] a function at a fixed offset

Martin Velek martin.velek at gmail.com
Sat Jun 9 09:38:46 UTC 2012


Hello,

I am sorry if this topic is more or less a general question to gnu.

I am using LPC2478 (512 KB internal flash, 64KB SRAM) and I would like
to place a flash update function at position _START_OF_ROM + 0x200 ->
sector 0 (0x0 - 0x1000) which should not be re-flashed and some app
would call this function if a flash update is required. I have defined
in a linker script a new section with offset

. = 0x200;
KEEP(*(.rom.bootloader))	// KEEP prevents from optimisation out

and the prototype is:
int IAP(...) __attribute__ ((used, section (".rom.bootloader")));

It works like a charm but sometimes I am compiling the bootloader with
-0s, sometimes some functions are added etc and I am unable to fill
the space with some useful functions. I mean that I do not know how to
made the linker to place other functions where possible but the IAP
must be at 0x200.

e.g. without optimisation
0x0 - 0x1A0 ... init code
0x200 - IAP
...... other functions

e.g. with -Os
0x0 - 0x100 ... init code
0x100 - 1A0 .. any possible small function that will fit here
0x200 - IAP
...... other functions


Thank you for your help

Martin Velek



More information about the arm-gnu mailing list