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? ^^
Hi Deepika,The link should look like ld --start-section=.gnu.sgstubs=0x1000 --out-implib=implib.o --cmse-implib where 0x1000 should be replaced with the start address of your non-secure callable region and implib.o is your import library. If linking with GCC that translates into gcc secure1.c secure2.c -Wl,--start-section=.gnu.sgstubs=0x1000,--out-implib=implib.o,--cmse-implib.If you realize after distributing implib.o that you want to add some more entry points in your secure application, then you'll also add --in-implib=implib.o which instructs the linker to keep the addresses unchanged for all the symbol already present in implib.o.Best regards.