0
votes

I am using gcc-arm-none-eabi 4.9 2014q4 to do my linking and the symbol addresses are not coming out the way I would expect and need for init.

My linker script attempts to create the following sections:

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 = .;

}

Because of my configuration I now need to relocate the data and zero the bss. When i look at the symbol table the values are incorrect... 0x20000000 _data 0x20000000 _edata

It looks from the map like the .data is not being place in the .data section?

.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

Have I somehow gotten my wildcards wrong for the data definition?

Thx, Devan

1

1 Answers

1
votes

Your wildcards are not matching .data.*. Put the following in the data section:

*(.data .data.*)