经过前面的处理,还有两个错误:
[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();
}