uclinux-2008R1-RC8(bf561)到VDSP5的移植(20):远调用

本文介绍了解决嵌入式软件开发过程中遇到的链接错误问题,包括如何修改调用方式以及调整函数存放位置等解决方案。
 
  
经过前面的处理,还有两个错误:
[Error li1080] "corea.dlb[head.doj](program):0x17c" address of '_cmdline_init' (=0x4000) is out of range
        Referenced from 0xffa00c80
        Valid relative range is [-0x1000000,0xfffffe]
 
 
[Error li1080] "corea.dlb[head.doj](program):0x1be" address of '_main' (=0x1000) is out of range
        Referenced from 0xffa00cc2
        Valid relative range is [-0x1000000,0xfffffe]
首先看看head.s中对cmdline_init的调用:
 
       /* pass the uboot arguments to the global value command line */
       R0 = R7;
       call _cmdline_init;
再看看cmdline_init的声明:
void __init cmdline_init(const char *r0)
看看__init的定义:
#define __init         __attribute__ ((__section__ (".init.text")))
也就是说,用__init修饰的代码是放在.init.text段中的,而.init.text段是放在SDRAM中的,但是head.s的代码是放在L1中的,因此就造成了这样的错误。
解决的方法很简单,直接将call改为call.x:
       /* pass the uboot arguments to the global value command line */
       R0 = R7;
       call.x _cmdline_init;
对main的处理稍微麻烦一点,因为head.s中是以jump指令跳转到main函数的:
       jump.l _main;//start_kernel;
但是jump指令并不支持从L1到SDRAM的跳转,因此我们必须将main函数也放到L1中:
 
asmlinkage void __attribute__ ((__section__ (".l1.text"))) main( void )
{
       /* The default startup code does not include any functionality to allow core
          A to enable core B. A convenient way to enable core B is to use the
          'adi_core_b_enable()' function. */
       //adi_core_b_enable();
 
       /* Begin adding your custom code here */
       start_kernel();
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

嵌云阁主

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

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

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

打赏作者

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

抵扣说明:

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

余额充值