U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(19):分号惹祸
来源:互联网 发布:批量修改图片尺寸软件 编辑:程序博客网 时间:2024/05/17 18:18
在移植汇编代码时,VDSP中的分号造成了一些小困扰,但是相比之下,C中嵌入汇编引起的问题则要隐蔽得多,如cpu/blackfin/reset.c中的函数:
__attribute__ ((__l1_text__, __noreturn__))
void bfin_reset(void)
{
while (1) {
/* No idea why this is needed, but with out this, the ssync()
* after SWRST = 0x0 will hang indefinitely ...
*/
__builtin_bfin_ssync();
/* Initiate system software reset of peripherals */
bfin_write_SWRST(0x7);
/* Due to the way reset is handled in the hardware, we need
* to delay for 5 SCLKS. The only reliable way to do this is
* to calculate the CCLK/SCLK ratio and multiply 5. For now,
* we'll assume worse case which is a 1:15 ratio.
*/
asm(
"LSETUP (.Lreset_nops,.Lreset_nops) LC0 = %0/n"
".Lreset_nops: nop;"
:
: "a" (15 * 5)
: "LC0", "LB0", "LT0"
);
/* Clear system software reset */
bfin_write_SWRST(0);
__builtin_bfin_ssync();
/* Issue core reset */
asm("raise 1");
}
}
这里有两行的嵌入汇编,当在VDSP下编译时,它的提示信息为:
[Error ea5004] "C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/acc0a74df1e000/acc0a74df1e001.s":59 Syntax Error in :
.Lreset_nops: nop;
syntax error is at or near text '.Lreset_nops'.
Attempting error recovery by ignoring text until the ';'
[Error ea5004] "C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/acc0a74df1e000/acc0a74df1e001.s":79 Syntax Error in :
.LN7:
syntax error is at or near text '.LN7'.
Attempting error recovery by ignoring text until the ';'
Previous errors prevent assembly
第一个错误提示还好点,第二个提示就让人不知所云了。实际上,这两个错误都是由嵌入汇编中一个小小的分号引起的,修改后的代码如下:
__attribute__ ((__l1_text__, __noreturn__))
void bfin_reset(void)
{
while (1) {
/* No idea why this is needed, but with out this, the ssync()
* after SWRST = 0x0 will hang indefinitely ...
*/
__builtin_bfin_ssync();
/* Initiate system software reset of peripherals */
bfin_write_SWRST(0x7);
/* Due to the way reset is handled in the hardware, we need
* to delay for 5 SCLKS. The only reliable way to do this is
* to calculate the CCLK/SCLK ratio and multiply 5. For now,
* we'll assume worse case which is a 1:15 ratio.
*/
asm(
"LSETUP (.Lreset_nops,.Lreset_nops) LC0 = %0;/n"
".Lreset_nops: nop;"
:
: "a" (15 * 5)
: "LC0", "LB0", "LT0"
);
/* Clear system software reset */
bfin_write_SWRST(0);
__builtin_bfin_ssync();
/* Issue core reset */
asm("raise 1;");
}
}
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(19):分号惹祸
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(4):提示信息
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(5):ENDPROC
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(10):__xchg
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(11):bsz
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(13):使用L1
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(15):DECLARE_GLOBAL_DATA_PTR
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(16):*cplb_add
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(17): Entry.h
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(18):const
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(21):收工
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(6):使用u-boot的crt代码
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(7):改造u-boot.lds.s
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录:#if
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(2): .macro
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(3): 汇编空语句
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录:全文
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(9):bool的问题
- [转]西方国家这次为什么会如次的团结?
- MID软件系统中Moblin的角色
- Unix&Linux历史重温(ZZ)
- PHP 项目检查规范:
- Fibonacci递归算法
- U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(19):分号惹祸
- 嵌入式C编程经典面试题
- 求1+2+3+4+……+100之和 递归算法
- ORACLE9.2归档日志文件格式
- url重写的心得
- SQL Express 2005里面没有SQL Server Management Studio管理器的解决办法
- 强大的Flex调试工具-----FlexSpy
- Top10 Web2.0在线生成器
- 解决好人的问题,流程和工具才会更有意义