TI中文支持网
TI专业的中文技术问题搜集分享网站

uboot 中打开debug选项 (uboot/include/common.h #define DEBUG),编译大量报错?

ti sdk (u-boot-2017.01+gitAUTOINC+c68ed086bd-gc68ed086bd中),芯片为AM3358,板子为beaglebone black .

今天想要打开uboot的debug选项来更好的调试。

于是在uboot/include/common.h 中添加

#define  DEBUG  //添加部分

#ifdef DEBUG
#define _DEBUG 1
#else
#define _DEBUG 0
#endif

然后编译发现大量报错

In file included from ../cmd/mtdparts.c:74:0:
../cmd/mtdparts.c: In function 'parse_mtdparts':
../include/common.h:123:4: warning: 'p' is used uninitialized in this function [-Wuninitialized]
printf(pr_fmt(fmt), ##args); \
^~~~~~
../cmd/mtdparts.c:1546:14: note: 'p' was declared here
const char *p;
^
In file included from ../cmd/mtdparts.c:74:0:
../cmd/mtdparts.c: In function 'device_parse':
../include/common.h:123:4: warning: 'pend' may be used uninitialized in this function [-Wmaybe-uninitialized]
printf(pr_fmt(fmt), ##args); \
^~~~~~
../cmd/mtdparts.c:831:14: note: 'pend' was declared here
const char *pend;

……..

我看了.map文件,发现printf是定义的,可以搞不懂为什么?是不是需要修改编译选项?

Jian Zhou:

请问你用的是SDK里的交叉编译器么?

user4632301:

回复 Jian Zhou:

你好,是SDK里面的工具链

ti-processor-sdk-linux-rt-am335x-evm-04.03.00.05

我编译前如下设置交叉编译工具为

export PATH=/home/jipolun/ti-processor-sdk-linux-rt-am335x-evm-04.03.00.05/linux-devkit/sysroots/x86_64-arago-linux/usr/bin:$PATH

我的debug选项不打开(就是说我不去定义),编译是没有问题的,可以成功编译出MLO和uboot.img

Shine:

请参考下面的帖子。
e2e.ti.com/…/624286

Jian Zhou:

回复 user4632301:

没有这么试过,你看看是不是错误都是某个变量没有定义导致的,可能要手动修改下。

user4632301:

回复 Shine:

试了文中的方法发现无效

user4632301:

回复 Jian Zhou:

今天试了半天发现,,

比如:int p;

            printf("%d",p);

如果定义打开DEBUG选项,编译会报一个未初始化的警告。(这个可以理解)

然后造成最后MLO和uboot.img的原因为

arm-linux-gnueabihf-ld.bfd: u-boot-spl section `.rodata' will not fit in region `.sram'

arm-linux-gnueabihf-ld.bfd: region `.sram' overflowed by 16472 bytes

../scripts/Makefile.spl:295: recipe for target 'spl/u-boot-spl' failed

uboot-spl.lds 中的。sram异常,按照这个提示,难道说定义了DEBUG,只读数据变大很多,然后超过了ti_armv7_common.h定义的

#define CONFIG_SPL_MAX_SIZE (SRAM_SCRATCH_SPACE_ADDR – \ CONFIG_SPL_TEXT_BASE)

难道说 我要去改SRAM_SCRATCH_SPACE_ADDR这个值吗?不过这个值已改,uboot中的其他地方与之有关联的貌似还要改?

赞(0)
未经允许不得转载:TI中文支持网 » uboot 中打开debug选项 (uboot/include/common.h #define DEBUG),编译大量报错?
分享到: 更多 (0)