Put gcc libs .data in specific section?

2019-05-10 06:47发布

I'm trying to switch to the GNU GCC compiler for our embedded system, but I'm having trouble linking the project as the memory layout of our chip is split:

RAM section 1: 0x10000-0x12FFF
RAM section 2: 0x18000-0x1BFFF

The data from our project can fit in section 1, but the data linked from the gcc libs doesn't. Map file extract:

.data          0x00012974      0x3c4 c:/tools/gnucr16_v1.1.3-elf/cr16-elf/bin/../lib/gcc/cr16-elf/4.5.1-GNUCR16_v1.1.3/../../../../cr16-elf/lib\libc.a(lib_a-impure.o)
               0x00012974                _impure_ptr

.data          0x00012d7c      0x410 c:/tools/gnucr16_v1.1.3-elf/cr16-elf/bin/../lib/gcc/cr16-elf/4.5.1-GNUCR16_v1.1.3/../../../../cr16-elf/lib\libc.a(lib_a-mallocr.o)
               0x00012d7c                __malloc_av_
               0x00013184                __malloc_trim_threshold
               0x00013188                __malloc_sbrk_base

Is it possible to put the .data section from the libs in the 2nd section? I've tried different thing without success... Linker script extract:

MEMORY
{
  SHARED1    : org =   0x10000, len = 0x3000
  SHARED2    : org =   0x18000, len = 0x4000
}

SECTIONS
{
  .data 0x12004 : { *(.data); } >SHARED1
  .data2 0x19000 : { libc*(.data); } >SHARED2
}

1条回答
相关推荐>>
2楼-- · 2019-05-10 07:16
SECTIONS
{
  .section_name:
  {
    *lib_a-impure.o (.data);  //That is the syntax to access sections of object files
   } >SHARED1
}

More info here: http://www.embedded.com/design/mcus-processors-and-socs/4026080/Building-Bare-Metal-ARM-Systems-with-GNU-Part-3

查看更多
登录 后发表回答