歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> uclinux-2008R1-RC8(bf561)到VDSP5的移植(3):Head.s

uclinux-2008R1-RC8(bf561)到VDSP5的移植(3):Head.s

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

uclinux系統的入口點為head.s,因此先將此文件添加到corea.dlb,先改下語法錯誤。

1 時鐘配置

因為沒有使用引導程序,因此在內核啟動時需要重新配置CPU的運行速度。在config.h中添加以下定義:

// 時鐘配置
#define CONFIG_CLKIN_HZ 27000000 // 晶振頻率
#define CONFIG_VCO_MULT 22 // 內核倍頻
#define CONFIG_CCLK_DIV 1 // 內核分頻
#define CONFIG_SCLK_DIV 6 // 系統分頻

// SDRAM配置
#define CONFIG_MEM_GENERIC_BOARD 1
#define CONFIG_MEM_SIZE 64  // 內存容量
#define CONFIG_MEM_ADD_WIDTH  9  // 位寬

#define CONFIG_BFIN_KERNEL_CLOCK 1  // 配置時鐘

2 __INIT

在include/linux/init.h中定義了這樣一個宏:

#define __INIT  .section ".init.text","ax"

而VDSP5顯然是不支持這樣的定義的。

因為我的板子使用的是方式1啟動,而head.s則是系統的入口,在啟動時bf561的boot rom必然要將其寫入到L1的0xffa0 0000,所以沒有必要將其放到.init.text這個段中。直接在head.s中將

__INIT

這行注釋掉。

同時加上以下幾行:

.section/DOUBLEANY program;
.file_attr requiredForROMBoot;
.align 2;

3 trace_buffer_init

在head.s中有這樣一行

trace_buffer_init(p0,r0);

中vdsp中編譯出錯:

[Error ea5004] "../../arch/blackfin/mach-bf561/head.S":105 Syntax Error in :
;
syntax error is at or near text ';'.
Attempting error recovery by ignoring text until the ';'

查trace_buffer_init的定義,在include/asm/trace.h中

#define trace_buffer_init(preg, dreg) /
preg.L = LO(TBUFCTL); /
preg.H = HI(TBUFCTL); /
dreg = BFIN_TRACE_INIT; /
[preg] = dreg;

看著沒什麼問題,原來在

trace_buffer_init(p0,r0);

這行的末尾多了個分號!

4 ENDPROC

Head.s中有一行:

ENDPROC(__start)

其錯誤為:

[Error ea5004] "../../arch/blackfin/mach-bf561/head.S":242 Syntax Error in :
.type __start, @function; .size __start, .-__start
syntax error is at or near text '@'.
Attempting error recovery by ignoring text until the ';'

查了下ENDPROC的定義,在include/linux/linkage.h中:

#ifndef END
#define END(name) /
.size name, .-name
#endif
#ifndef ENDPROC
#define ENDPROC(name) /
.type name, @function; /
END(name)
#endif

VDSP不需要使用

.size name, .-name

這樣的定義,因此直接修改為:

#ifndef ENDPROC
#define ENDPROC(name) /
#name.end:
#endif

5 __FINIT

在head.s中有這樣一行:

__FINIT

這個宏在include/linux/init.h中定義為:

#define __FINIT  .previous

在VDSP的幫助中對.previos的說明為:

The .PREVIOUS directive instructs the assembler to set the current section in memory to the section described immediately before the current one. The .PREVIOUS directive operates on a stack.
Syntax:

.PREVIOUS;

很明顯,uclinux的定義少了個分號,嘿嘿。

#define __FINIT  .previous;

Copyright © Linux教程網 All Rights Reserved