I'm trying to build some sample sources from Keil MDK with GNU embedded compiler.
I have built an secure elf file and tried to make the object file with secure interface like this.
I can get the library file but some warnings and an error occurred. And the object file size is the same as one from ARM compiler.
The linker script file is like this.
ENTRY(Reset_Handler)
MEMORY{ RAM (xrw) : ORIGIN = 0x10000000, LENGTH = 0x1000000 /* Secure SRAM */}
SECTIONS { .text : { . = ALIGN(4); *(.RESET*) *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ *(.glue_7) /* glue arm to thumb code */ *(.glue_7t) /* glue thumb to arm code */ . = ALIGN(4); _etext = .; /* define a global symbols at end of code */ } >RAM .gnu.sgstubs : { . = ALIGN(4); _start_sg = .; *(.gnu*) . = ALIGN(4); _end_sg = .; } >RAM
.data : { . = ALIGN(4); _sdata = .; /* create a global symbol at data start */ *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); _edata = .; /* define a global symbol at data end */ } >RAM
. = ALIGN(4); STACK : { KEEP(*(STACK*)); } > RAM
. = ALIGN(4); HEAP : { KEEP(*(HEAP*)); } > RAM
. = ALIGN(4);
.ARM.exidx 0 (NOLOAD) : { *(.ARM.exidx*) } .ARM.attributes 0 : { *(.ARM.attributes) }}
And if I change the above red line to ".ARM.attributes 0 (NOLOAD) : { *(.ARM.attributes)}",
there are no errors but the object file size is quite big.
Could you let me know how I can solve the warnings and error? ^^
The NOLOAD directive will mark a section to not be loaded at run time. The linker will process the section normally, but will mark it so that a program loader will not load it into memory. So if you added NOLOAD for red code line, those sections are ignored by program loader; while linker still keeps the sections contents igoring the warning/errors. Also did some goolge work, some suggestions for you are: 1) Upgrade your GNU linker to the latest if possible 2) Try to add PHDRS header in linker script PHDRS { text PT_LOAD; data PT_LOAD; bss PT_LOAD; STACK PT_NULL; HEAP PT_NULL; } Please refer to www.avrfreaks.net/.../allocated-section-xyz-not-segment-solved