Reputation: 47
I have compiled the project with arm-none-eabi-gcc to object with command
arm-none-eabi-gcc --specs=nosys.specs -mcpu=cortex-m7 -mtune=cortex-m7 -Os -g -gdwarf-2 -c $< -o $(@)
currently I got the object file when I try to link it with command in object foler
arm-none-eabi-gcc --specs=nosys.specs -mcpu=cortex-m7 -mtune=cortex-m7 -g -gdwarf-2 -nostartfiles -T ..\project.ld -o target *
However I got some strange error
arm-none-eabi/bin/ld.exe: error: no memory region specified for loadable section `.text.memcmp'
I understand that when I use -T option the link script file will be used instead of default link script. it looks like the section definitions for some builtin function are missing. I tried to fix that put
.text.memcmp : {*(.text.memcmp)}
in my ld file, it looks like this section is fixed however I got another error:
arm-none-eabi/bin/ld.exe: error: no memory region specified for loadable section `.text.memset'
so I don't think put .text.memset in the LD file is correct fix, because after I put `.text.memset' in ld file , I got another error :
arm-none-eabi/bin/ld.exe: error: no memory region specified for loadable section `.text._snprintf_r'
I think I missed some options in GCC to create these default sections for builtin functions
What is the root cause of this issue and how to fix that? Thank you so much!
Update: Add the LD file below :
MEMORY {
INIT_SRAM : ORIGIN = 0x34400000, LENGTH = 0x1FB000
INIT_SRAM_NO_CACHEABLE : ORIGIN = 0x3460A000, LENGTH = 0x1DF00
INIT_SRAM_STACK : ORIGIN = 0x34628000, LENGTH = 0x15000
RAM_RSVD : ORIGIN = ., LENGTH = 0
BOOT_TEST : ORIGIN = 0x43840000 LENGTH = 0x50
}
SECTIONS
{
.boot_test : {*(.boot_test)}> BOOT_TEST
.exception_table ALIGN(4) : > {*(.exception_table)}>INIT_SRAM
.startup ALIGN(4) : {*(.startup)}
.ramcode ALIGN(4) : > {*(.ramcode)}
.text ALIGN(4) : { *(.text) }
.ramcode ALIGN(4) : { *(.ramcode) }
.rodata ALIGN(4) : { *(.rodata) }
.data ALIGN(4) : { *(.data) }
.bss ALIGN(16) : { *(.bss) }
_TEST_SESSION_START = .;
.TEST_SESSION :{*(.TEST_SESSION)}
_TEST_SESSION_END = (. - 1);
_Stack_start = .;
__STACK_SIZE = SIZEOF(INIT_SRAM_STACK);
__RAM_NO_CACHEABLE_START = ADDR(INIT_SRAM_NO_CACHEABLE);
}
Upvotes: 0
Views: 1433
Reputation: 47
Changing
.text ALIGN(4) : { *(.text) }
to
.text ALIGN(4) : { *(.text) *(.text.*) }
can fix this .text.xxx missing issue.
Upvotes: 2