uclinux-2008R1-RC8(bf561)到VDSP5的移植(19):li2040

解决VDSP li2040警告
本文介绍了解决VDSP链接器li2040警告的方法,该警告通常出现在内存片段化导致输出段非连续映射时。通过使用NO_FORCE_CONTIGUITY命令,可以使链接器忽略代码和数据对象的连续性要求,从而避免警告。
 
  
在添加了.init段之后,VDSP报告li2040警告:
[Warning li2040] "./uclinux-2008r1-rc8.ldf":690 Due to memory fragmentation, output section '.init' in processor 'p0' was mapped discontinuously.
 Use FORCE_CONTIGUITY command to ensure that output section is mapped continuously.
 Use NO_FORCE_CONTIGUITY command if contiguity does not matter in this output section.
查了一下li2040,VDSP的解释是:
For most mapping operations, code and data from an object file are mapped contiguously, and input sections are mapped in the order specified inside the output section. If you have mapped an object into a location that causes a fragmentation of memory, the linker may map an object into the gap in such a way that code or data is no longer contiguous. Because of the fragmentation, the linker may also place input sections into memory in an order that is different from the order in which they appear in the output section. The linker warns that the mapping is not contiguous.
An additional (and probably more common) case of non-contiguous placement is when the sections are not mapped in the order specified in the LDF. Such a case might have nothing to do with internal fragmentation.
给出的解决方法是:
How to Fix
The LDF command FORCE_CONTIGUITY forces the linker to keep the variables contiguous. Using the FORCE_CONTIGUITY command may result in unused space in the output section.
You can indicate that it is not important that code and data objects are contiguous by using the LDF command NO_FORCE_CONTIGUITY. In the first example above, if the LDF file contained the NO_FORCE_CONTIGUITY command, the linker would not issue the warning.
If contiguous placement is not important in any of the output section, disable the warning by using the -w2040 command-line switch.
因为uclinux内核在启动完成后需要将.init段占用的空间回收,所以它必须是独立的,在此我选择使用NO_FORCE_CONTIGUITY命令,.init段就变成了:
        .init
        {
             NO_FORCE_CONTIGUITY
               ___init_begin = .;
 
               //.init.text
               INPUT_SECTION_ALIGN(4096)
               . = (. + 4095) / 4096 * 4096;
               __sinittext = .;
               INPUT_SECTIONS($LIBRARIES_CORE_A(.init.text))
               __einittext = .;
               
               //.init.data
               INPUT_SECTION_ALIGN(16)
               INPUT_SECTIONS($LIBRARIES_CORE_A(.init.data))
             
        } > MEM_SDRAM
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

嵌云阁主

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值