This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to get the object file with secure interface

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.

arm-none-eabi-ld ./cm33_s.elf -T linker.ld --out-implib ./cmse_lib.o --cmse-implib

 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.

arm-none-eabi-ld: ./cm33_s.elf: `Secure_LED_Off_callback' and its special symbol are in different sections.
arm-none-eabi-ld: ./cm33_s.elf: `Secure_printf' and its special symbol are in different sections.
arm-none-eabi-ld: ./cm33_s.elf: `Secure_LED_On_callback' and its special symbol are in different sections.
arm-none-eabi-ld: ./cm33_s.elf: `Secure_LED_Off' and its special symbol are in different sections.
arm-none-eabi-ld: ./cm33_s.elf: `Secure_LED_On' and its special symbol are in different sections.
arm-none-eabi-ld: cannot size stub section: Invalid operation
arm-none-eabi-ld: a.out: warning: allocated section `.text' not in segment
arm-none-eabi-ld: a.out: warning: allocated section `.gnu.sgstubs' not in segment
arm-none-eabi-ld: a.out: warning: allocated section `.data' not in segment
arm-none-eabi-ld: a.out: warning: allocated section `STACK' not in segment
arm-none-eabi-ld: a.out: warning: allocated section `HEAP' not in segment

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? ^^

 

Parents
  • Hi Jinha,

    The model used by the GNU linker is to create the SG import library as part of the link process, not after from the secure executable. I would need to look into the cm33_s.elf secure executable to tell you for sure.

    Therefore I would recommend to either create the SG import library with keil or do the link with GNU ld.
Reply
  • Hi Jinha,

    The model used by the GNU linker is to create the SG import library as part of the link process, not after from the secure executable. I would need to look into the cm33_s.elf secure executable to tell you for sure.

    Therefore I would recommend to either create the SG import library with keil or do the link with GNU ld.
Children