我正在使用gcc-arm-none-eabi 4.9 2014q4进行链接,符号地址没有按照我期望和初始化的方式出现。
我的链接描述文件尝试创建以下部分:
MEMORY
{
SRAM_L (rwx) : ORIGIN = 0x00000000, LENGTH = 32K
SRAM_U (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
}
SECTIONS
{
.vectors 0x00000000 :
{
*o(.vectors_)
}
.text :
{
. = ALIGN (4);
*(.text);
_etext = . ;
}
. = . ;
.data 0x20000000 :
AT ( ADDR(.text) + SIZEOF ( .text ) )
{
. = ALIGN (4);
_data = . ; *(.data); _edata = . ;
}
.bss :
AT ( ADDR(.data) + SIZEOF ( .data ) )
{
. = ALIGN (4);
_bss = . ; *(.bss) *(COMMON); _ebss = . ;
}
. = ALIGN (4);
. += 8;
free_memory_start = .;
_end_of_stack = .;
end = .;
_start_of_heap = .;
. = 0x20007000;
_start_of_stack = .;
_end_of_heap = .;
}
由于我的配置,我现在需要重新定位数据并将bss归零。当我查看符号表时,值不正确... 0x20000000 _data 0x20000000 _edata
从地图上看,.data没有放在.data部分?
.data 0x20000000 0x0 load address 0x00000814
0x20000000 . = ALIGN (0x4)
0x20000000 _data = .
*(.data)
0x20000000 _edata = .
.igot.plt 0x00003c30 0x0 load address 0x20000000
.igot.plt 0x00000000 0x0 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/armv7e-m/crtbegin.o
.data.impure_data
0x00003c30 0x428
.data.impure_data
0x00003c30 0x428 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m\libc.a(lib_a-impure.o)
.data._impure_ptr
0x00004058 0x4
.data._impure_ptr
0x00004058 0x4 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m\libc.a(lib_a-impure.o)
0x00004058 _impure_ptr
.data.__malloc_av_
0x0000405c 0x408
.data.__malloc_av_
0x0000405c 0x408 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m\libc.a(lib_a-mallocr.o)
0x0000405c __malloc_av_
.data.__malloc_trim_threshold
0x00004464 0x4
.data.__malloc_trim_threshold
0x00004464 0x4 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m\libc.a(lib_a-mallocr.o)
0x00004464 __malloc_trim_threshold
.data.__malloc_sbrk_base
0x00004468 0x4
.data.__malloc_sbrk_base
0x00004468 0x4 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m\libc.a(lib_a-mallocr.o)
0x00004468 __malloc_sbrk_base
.data.base 0x0000446c 0x4
.data.base 0x0000446c 0x4 ./src/hardware/iomux-v3.o
.data.heap 0x00004470 0x4
.data.heap 0x00004470 0x4 ./src/sys.o
0x00004470 heap
.data.lc_ctype_charset
0x00004474 0x20
.data.lc_ctype_charset
0x00004474 0x20 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m\libg.a(lib_a-locale.o)
.data.__mb_cur_max
0x00004494 0x4
.data.__mb_cur_max
0x00004494 0x4 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m\libg.a(lib_a-locale.o)
0x00004494 __mb_cur_max
.data.__wctomb 0x00004498 0x4
.data.__wctomb
0x00004498 0x4 c:/program files (x86)/gnu arm embedded/4.9 2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m\libg.a(lib_a-wctomb_r.o)
0x00004498 __wctomb
我是否因为数据定义而错误地将通配符弄错了?
THX, 德万
答案 0 :(得分:1)
您的通配符与.data.*
不匹配。将以下内容放在数据部分中:
*(.data .data.*)