I am trying to get the linker (ld from XC32) to place the same executable code in two different flash sections.
The application works so that the code can be run as a standalone application, and also so that the reset vector can be overridden by the loader, which can then go to the pseudo reset vector.
Relevant sections of my linker script
MEMORY
{
kseg1_boot_mem : ORIGIN = 0xBFC00000, LENGTH = 0x480
bootload_boot_mem : ORIGIN = 0x9D1F0000, LENGTH = 0x480
}
SECTIONS
{
.reset 0xBFC00000 :
{
KEEP(*(.reset))
} > kseg1_boot_mem
.bootloadreset 0x9D1F0000 :
{
KEEP(*(.reset))
} > bootload_boot_mem
}
Using this, the area at 0xBFC00000 is populated as expected, but nothing is placed at 0x9D1F0000. I tried passing the -no-gc section option to the linker, but that does not seem to make any difference.
My question is: is it possible to get the linker to put the same code in 2 different sections and how to do it?