c - GCC ld Bootloader linking for Cortex M3/M4 -
i can't find info on trying achieve. using arm gcc toolchain develop firmware cortex m4 microcontroller. 1 of functions of firmware bootloader resides in first addresses of flash check if flashing needed/possible , flash rest of memory.
for work made sure bootloader functions contained in section there never phone call firmware side of flash. problem is, have functions in bootloader utilize firmware. works right in development compiling , linking each time, afraid in future gcc/ld alter layout of bootloader, making calls firmware go different addresses , breaking old ulpdated systems.
specifically, have:
.pretext : at(origin(flash_1_uncached)) { keep(*(.false.vector)); *(.xmc4200.falsepostreset); *aes*.o (.text .text.* .gnu.linkonce.t.* .rodata .rodata.* .gnu.linkonce.r.*); *crc32*.o (.text .text.* .gnu.linkonce.t.* .rodata .rodata.* .gnu.linkonce.r.*); *bootloader.o (.text .text.* .gnu.linkonce.t.* .rodata .rodata.* .gnu.linkonce.r.*); *bootclk*.o (.text .text.* .gnu.linkonce.t.* .rodata .rodata.* .gnu.linkonce.r.*); *bootio001*.o (.text .text.* .gnu.linkonce.t.* .rodata .rodata.* .gnu.linkonce.r.*); *bootio004*.o (.text .text.* .gnu.linkonce.t.* .rodata .rodata.* .gnu.linkonce.r.*); *bootreset001*.o (.text .text.* .gnu.linkonce.t.* .rodata .rodata.* .gnu.linkonce.r.*); *bootspi001*.o (.text .text.* .gnu.linkonce.t.* .rodata .rodata.* .gnu.linkonce.r.*); *bslld*.o (.text .text.* .gnu.linkonce.t.* .rodata .rodata.* .gnu.linkonce.r.*); __pretext_end = .; } > flash_1_cached .text absolute(0x08008000): at(0x0c008000) { stext = .; *(.xmc4200.reset); keep(*(.version)); *(.xmc4200.postreset); *(.xmcstartup); *(exclude_file (*boot_ram.o *flash002*.o *aes*.o *bootloader.o *bootclk*.o *bootio001*.o *bootio004*.o *bootreset001*.o *bootspi001*.o *bslld*.o *crc32*.o) .text); *(exclude_file (*boot_ram.o *flash002*.o *aes*.o *bootloader.o *bootclk*.o *bootio001*.o *bootio004*.o *bootreset001*.o *bootspi001*.o *bslld*.o *crc32*.o) .text.*); *(exclude_file (*boot_ram.o *flash002*.o *aes*.o *bootloader.o *bootclk*.o *bootio001*.o *bootio004*.o *bootreset001*.o *bootspi001*.o *bslld*.o *crc32*.o) .gnu.linkonce.t.*); ...
notice following:
there boot* object files mainkly replicas of firmware code need in bootloader different naming scheme there won't collisions. i have aes , crc there, constants utilize firmware side i haven't included other sections of linker script related bootloader part in ram works , think not relevant question.what accomplish is, basically, ensure bootloader remain same address-wise each symbol in future new firmwares utilize addresses.
i think using same .o files bootloader not ensure linker may optimize or different if in future gcc version used, right?
also, there no alternative set each symbol on linker script, or @ least, can't find it. functions relatively easy because compile -ffunction-sections, other symbols constants , variables? solution mask under functions , set them ordered in linker script? work? there other typical solution case missing?
thanks help
c gcc linker bootloader cortex-m3
No comments:
Post a Comment