歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> uclinux-2008R1-RC8(bf561)到VDSP5的移植(20):遠調用

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

日期:2017/3/3 16:43:41   编辑:關於Linux

經過前面的處理,還有兩個錯誤:

[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();
}

Copyright © Linux教程網 All Rights Reserved