ld - access a memory address from linker script

Martin Velek martin.velek@gmail.com
Fri Jun 26 12:16:00 GMT 2015


Hello,

is it possible to get a value stored at some VMA in the linker script?

I am writing a small bootloader (about 8 KB max) for the LPC1788
microcontroller (Cortex M3) however the LPC1788 has a functionality
that if there is a predefined value at the address 0x2FC, the cpu will
block access to the JTAG. I would like to check the address in the
linker script to avoid generating elf if there is such value.
Something like ASSERT(0xXXX != VMA[0x2fc], "Wrong code....").

I have tried to reserve a space in the .text output section
    /* Code Read Protect data */
    /*. = 0x000002FC ;*/
    KEEP(*(.crp))

but it means to calculate manually the function between 0 – 2FC. As
far as I know the linker cannot put a variable at a given address and
then place the code around automatically.


Regards
Martin Velek



More information about the Binutils mailing list