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
  • 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

Reply
  • 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

Children