Chinaunix首页 | 论坛 | 博客
  • 博客访问: 550616
  • 博文数量: 114
  • 博客积分: 1620
  • 博客等级: 上尉
  • 技术积分: 1104
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-30 09:16
文章分类

全部博文(114)

文章存档

2016年(1)

2015年(2)

2014年(4)

2013年(9)

2012年(20)

2011年(78)

分类: 嵌入式

2011-05-03 15:55:24

原文地址:http://hi.baidu.com/vim_li/blog/item/5ae3f839749701e515cecbc9.html

 

1、刚刚完成bootloader部分的框架及Makefile,写了几个driver,编译后,链接时,出现下面错误:

ipl/ipl.o: In function `low_level_init':
ipl.c:(.text+0x28): relocation truncated to fit: R_ARM_CALL against symbol `system_clk_init' defined in .text section in /work/new_plat/bootloader/drivers/libdrivers.a(clock.o)
ipl.c:(.text+0x2c): relocation truncated to fit: R_ARM_CALL against symbol `serial_init' defined in .text section in /work/new_plat/bootloader/drivers/libdrivers.a(serial.o)
make: *** [bootloader] Error 1

原因:外部函数调用时,指令跳转返回太长,超出了ARM instruction的范围(The maximum branch is +/- 32Mbytes in ARM mode and +/- 4Mbytes in Thumb mode.)

解决方法:

对于C文件来说,编译选项CFLAGS加入'-mlong-calls'选项;

对汇编文件来说,使用如下的跳转指令

ldr r4, =func

mov lr, pc

bx r4


阅读(3488) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~