把gcc libs .data放在特定的部分? [英] Put gcc libs .data in specific section?

查看:340
本文介绍了把gcc libs .data放在特定的部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试切换到我们嵌入式系统的GNU GCC编译器,但是当我们的芯片的内存布局被拆分时,我无法连接项目:

  RAM部分1:0x10000-0x12FFF 
RAM部分2:0x18000-0x1BFFF

我们项目的数据可以适用于第1部分,但从gcc libs链接的数据不能。地图文件解压缩:

  .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 $ / $ / $ / $ / $ $ b

是否可以将第二部分的libs中的.data部分放在?我尝试过不同的事情没有成功...链接脚本提取:

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

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


解决方案

  SECTIONS 
{
.section_name:
{
* lib_a-impure.o(.data); //这是访问目标文件部分的语法
}> SHARED1
}

更多信息: http://www.embedded.com/design/mcus-processors-and-socs/4026080/Building-Bare-Metal-ARM-Systems-with-GNU-Part-3


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
}

解决方案

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

这篇关于把gcc libs .data放在特定的部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆