AM335x u-boot启动流程问题
2014-10-16 11:33
399 查看
http://www.deyisupport.com/question_answer/dsp_arm/sitara_arm/f/25/t/17341.aspx
此问题尚无答案
![](http://www.deyisupport.com/cfs-file.ashx/__key/communityserver-components-roles/a9d2e4af-45b0-4302-981c-0eb305cdde5d/communitymember_5F00_cn.gif)
秀才130分
starter kit u-boot启动第一 阶 段程序和第二阶 段程序入口都是start.s文件的_start, 请问是根据 哪些宏定义决定编译哪些代码的 ?
![](https://oscdn.geek-share.com/Uploads/Images/Content/201909/21/640d22e995f1495a6348b54774f4bad5.gif)
榜眼23257分
SPL 的一个宏
Have a try, no Hesitate!
如果我的回答解决了您的问题,请确认答案,谢谢!:)
![](http://www.deyisupport.com/cfs-file.ashx/__key/communityserver-components-roles/a9d2e4af-45b0-4302-981c-0eb305cdde5d/communitymember_5F00_cn.gif)
秀才130分
您的意思是CONFIG_SPL_BUILD这个宏定义吧?
但是通过u-boot.map和u-boot-spl.map两个文件看,start.s执行到bl board_init_f这里没有ifdef或者ifndef CONFIG_SPL_BUILD,SPL调用的是omap-common文件夹spl.c的board_init_f() 函数,
但是第二阶段编译调用的是lib文件夹board.c的board_init_f() 函数,那编译器是通过什么选择编译哪个函数的?
![](https://oscdn.geek-share.com/Uploads/Images/Content/201909/21/640d22e995f1495a6348b54774f4bad5.gif)
榜眼23257分
makefile
Have a try, no Hesitate!
如果我的回答解决了您的问题,请确认答案,谢谢!:)
![](http://www.deyisupport.com/cfs-file.ashx/__key/communityserver-components-roles/a9d2e4af-45b0-4302-981c-0eb305cdde5d/communitymember_5F00_cn.gif)
秀才130分
不明白怎样通过makefile获取编译哪个函数?可否具体一点,以下是部分源代码
reset:
bl save_boot_params
/*
* set the cpu to SVC32 mode
*/
mrs r0, cpsr
bic r0, r0, #0x1f
orr r0, r0, #0xd3
msr cpsr,r0
#if defined(CONFIG_OMAP34XX)
/* Copy vectors to mask ROM indirect addr */
adr r0, _start @ r0 <- current position of code
add r0, r0, #4 @ skip reset vector
mov r2, #64 @ r2 <- size to copy
add r2, r0, r2 @ r2 <- source end address
mov r1, #SRAM_OFFSET0 @ build vect addr
mov r3, #SRAM_OFFSET1
add r1, r1, r3
mov r3, #SRAM_OFFSET2
add r1, r1, r3
next:
ldmia r0!, {r3 - r10} @ copy from source address [r0]
stmia r1!, {r3 - r10} @ copy to target address [r1]
cmp r0, r2 @ until source end address [r2]
bne next @ loop until equal */
#if !defined(CONFIG_SYS_NAND_BOOT) && !defined(CONFIG_SYS_ONENAND_BOOT)
/* No need to copy/exec the clock code - DPLL adjust already done
* in NAND/oneNAND Boot.
*/
bl cpy_clk_code @ put dpll adjust code behind vectors
#endif /* NAND Boot */
#endif
/* the mask ROM code should have PLL and others stable */
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
bl cpu_init_crit
#endif
/* Set stackpointer in internal RAM to call board_init_f */
call_board_init_f:
ldr sp, =(CONFIG_SYS_INIT_SP_ADDR)
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
ldr r0,=0x00000000
bl board_init_f
![](http://www.deyisupport.com/cfs-file.ashx/__key/communityserver-components-roles/a9d2e4af-45b0-4302-981c-0eb305cdde5d/communitymember_5F00_cn.gif)
秀才205分
makefile像一个大的框架,它控制了整个项目,编译工具链的定义,编译(compile)流程,链接流程(link). 有一篇蛮好的文章你可以看看http://blog.csdn.net/haoel/article/details/2886. 你仔细检查uboot,最外层有一个文件叫Makefile,然后进入子目录你会发现里面有很多config.mk,这个也是makefile文件,最外层的Makefile就像一个树的根部,config.mk为枝枝叶叶,定义了具体的编译细节. 你贴的这个代码中,具体哪些代码被编译进去是通过#define
这些宏定义来实现的,你可以在项目中搜索#if defined 后紧跟的宏定义名称是不是在项目的哪个文件中定义了,如果定义了,从#ifdef 到#endif这段代码就会被编译进去,如果没有定义就不会编译进去。
![](http://www.deyisupport.com/cfs-file.ashx/__key/communityserver-components-roles/a9d2e4af-45b0-4302-981c-0eb305cdde5d/communitymember_5F00_cn.gif)
秀才130分
这点我已经搞明白了,可以看u-boot-2011.09-psp04.06.00.08/arch/arm/cpu/armv7/omap-common的makefile:
ifdef CONFIG_SPL_BUILD
COBJS += spl.o
第二阶段没有define CONFIG_SPL_BUILD,所以不会生成spl.o,也就是不会编译spl.c,所以不会在spl.c文件中找board_init_f,而在u-boot-2011.09-psp04.06.00.08/arch/arm/lib的makefile中有
ifndef CONFIG_SPL_BUILD
COBJS-y += board.o
所以此时调用的是board.c的board_init_f,
但现在有另外一个不明白的问题困扰着我,有没有define CONFIG_SPL_BUILD,应该取决于有没有执行spl文件夹下面的makefile,因为里面有
CONFIG_SPL_BUILD := y
export CONFIG_SPL_BUILD
按照这样的想法,我在makefile中加入这样语句:
CONFIG_XXX := y
export CONFIG_XXX
然后在c文件中写
#ifdef CONFIG_XXX
相关代码。。。。。。
#endif
但是编译器就是不认为CONFIG_XXX被define了,但是编译器为什么又认CONFIG_SPL_BUILD被define呢?真是搞不明白。
![](https://oscdn.geek-share.com/Uploads/Images/Content/201909/21/640d22e995f1495a6348b54774f4bad5.gif)
探花9146分
同时,不仅在makefile,在uboot 源文件内也会根据
#ifdef CONFIG_SPL_BUILD
#ifndef CONFIG_SPL_BUILD
来选择哪些函数是否编译,具体可以查看代码
如果答案回答了您的问题,请确认答案,谢谢!:)
AM335x u-boot启动流程问题
此问题尚无答案![]() | 作者 wu jk 发表于 2013-1-9 23:33 |
![](http://www.deyisupport.com/cfs-file.ashx/__key/communityserver-components-roles/a9d2e4af-45b0-4302-981c-0eb305cdde5d/communitymember_5F00_cn.gif)
秀才130分
starter kit u-boot启动第一 阶 段程序和第二阶 段程序入口都是start.s文件的_start, 请问是根据 哪些宏定义决定编译哪些代码的 ?
回复 |
![]() | 作者 Yaoming Qin 发表于 2013-1-10 13:05 |
![](https://oscdn.geek-share.com/Uploads/Images/Content/201909/21/640d22e995f1495a6348b54774f4bad5.gif)
榜眼23257分
SPL 的一个宏
Have a try, no Hesitate!
如果我的回答解决了您的问题,请确认答案,谢谢!:)
回复 |
![]() | 作者 wu jk 发表于 2013-1-11 18:32 |
![](http://www.deyisupport.com/cfs-file.ashx/__key/communityserver-components-roles/a9d2e4af-45b0-4302-981c-0eb305cdde5d/communitymember_5F00_cn.gif)
秀才130分
您的意思是CONFIG_SPL_BUILD这个宏定义吧?
但是通过u-boot.map和u-boot-spl.map两个文件看,start.s执行到bl board_init_f这里没有ifdef或者ifndef CONFIG_SPL_BUILD,SPL调用的是omap-common文件夹spl.c的board_init_f() 函数,
但是第二阶段编译调用的是lib文件夹board.c的board_init_f() 函数,那编译器是通过什么选择编译哪个函数的?
回复 |
![]() | 作者 Yaoming Qin 发表于 2013-1-11 18:43 |
![](https://oscdn.geek-share.com/Uploads/Images/Content/201909/21/640d22e995f1495a6348b54774f4bad5.gif)
榜眼23257分
makefile
Have a try, no Hesitate!
如果我的回答解决了您的问题,请确认答案,谢谢!:)
回复 |
![]() | 作者 wu jk 发表于 2013-1-11 22:30 |
![](http://www.deyisupport.com/cfs-file.ashx/__key/communityserver-components-roles/a9d2e4af-45b0-4302-981c-0eb305cdde5d/communitymember_5F00_cn.gif)
秀才130分
不明白怎样通过makefile获取编译哪个函数?可否具体一点,以下是部分源代码
reset:
bl save_boot_params
/*
* set the cpu to SVC32 mode
*/
mrs r0, cpsr
bic r0, r0, #0x1f
orr r0, r0, #0xd3
msr cpsr,r0
#if defined(CONFIG_OMAP34XX)
/* Copy vectors to mask ROM indirect addr */
adr r0, _start @ r0 <- current position of code
add r0, r0, #4 @ skip reset vector
mov r2, #64 @ r2 <- size to copy
add r2, r0, r2 @ r2 <- source end address
mov r1, #SRAM_OFFSET0 @ build vect addr
mov r3, #SRAM_OFFSET1
add r1, r1, r3
mov r3, #SRAM_OFFSET2
add r1, r1, r3
next:
ldmia r0!, {r3 - r10} @ copy from source address [r0]
stmia r1!, {r3 - r10} @ copy to target address [r1]
cmp r0, r2 @ until source end address [r2]
bne next @ loop until equal */
#if !defined(CONFIG_SYS_NAND_BOOT) && !defined(CONFIG_SYS_ONENAND_BOOT)
/* No need to copy/exec the clock code - DPLL adjust already done
* in NAND/oneNAND Boot.
*/
bl cpy_clk_code @ put dpll adjust code behind vectors
#endif /* NAND Boot */
#endif
/* the mask ROM code should have PLL and others stable */
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
bl cpu_init_crit
#endif
/* Set stackpointer in internal RAM to call board_init_f */
call_board_init_f:
ldr sp, =(CONFIG_SYS_INIT_SP_ADDR)
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
ldr r0,=0x00000000
bl board_init_f
回复 |
![]() | 作者 Fangbo Xu 发表于 2013-1-27 18:03 |
![](http://www.deyisupport.com/cfs-file.ashx/__key/communityserver-components-roles/a9d2e4af-45b0-4302-981c-0eb305cdde5d/communitymember_5F00_cn.gif)
秀才205分
makefile像一个大的框架,它控制了整个项目,编译工具链的定义,编译(compile)流程,链接流程(link). 有一篇蛮好的文章你可以看看http://blog.csdn.net/haoel/article/details/2886. 你仔细检查uboot,最外层有一个文件叫Makefile,然后进入子目录你会发现里面有很多config.mk,这个也是makefile文件,最外层的Makefile就像一个树的根部,config.mk为枝枝叶叶,定义了具体的编译细节. 你贴的这个代码中,具体哪些代码被编译进去是通过#define
这些宏定义来实现的,你可以在项目中搜索#if defined 后紧跟的宏定义名称是不是在项目的哪个文件中定义了,如果定义了,从#ifdef 到#endif这段代码就会被编译进去,如果没有定义就不会编译进去。
回复 |
![]() | 作者 wu jk 发表于 2013-1-29 20:20 |
![](http://www.deyisupport.com/cfs-file.ashx/__key/communityserver-components-roles/a9d2e4af-45b0-4302-981c-0eb305cdde5d/communitymember_5F00_cn.gif)
秀才130分
这点我已经搞明白了,可以看u-boot-2011.09-psp04.06.00.08/arch/arm/cpu/armv7/omap-common的makefile:
ifdef CONFIG_SPL_BUILD
COBJS += spl.o
第二阶段没有define CONFIG_SPL_BUILD,所以不会生成spl.o,也就是不会编译spl.c,所以不会在spl.c文件中找board_init_f,而在u-boot-2011.09-psp04.06.00.08/arch/arm/lib的makefile中有
ifndef CONFIG_SPL_BUILD
COBJS-y += board.o
所以此时调用的是board.c的board_init_f,
但现在有另外一个不明白的问题困扰着我,有没有define CONFIG_SPL_BUILD,应该取决于有没有执行spl文件夹下面的makefile,因为里面有
CONFIG_SPL_BUILD := y
export CONFIG_SPL_BUILD
按照这样的想法,我在makefile中加入这样语句:
CONFIG_XXX := y
export CONFIG_XXX
然后在c文件中写
#ifdef CONFIG_XXX
相关代码。。。。。。
#endif
但是编译器就是不认为CONFIG_XXX被define了,但是编译器为什么又认CONFIG_SPL_BUILD被define呢?真是搞不明白。
回复 |
![]() | 作者 Gary Wu 发表于 2013-2-5 20:42 |
![](https://oscdn.geek-share.com/Uploads/Images/Content/201909/21/640d22e995f1495a6348b54774f4bad5.gif)
探花9146分
同时,不仅在makefile,在uboot 源文件内也会根据
#ifdef CONFIG_SPL_BUILD
#ifndef CONFIG_SPL_BUILD
来选择哪些函数是否编译,具体可以查看代码
如果答案回答了您的问题,请确认答案,谢谢!:)
相关文章推荐
- 关于AM335X uboot启动的时候找不到nand的问题
- am335x u-boot2011.09 SPL 流程跟踪
- 流程中启动其它流程的问题和解决方法-流程的锁定
- 如何在 Windows 恢复环境中使用 Bootrec.exe 工具解决和修复 Windows Vista 中的启动问题
- 系统启动时出现"Exiting Intel Boot Agent"问题解决一例
- 什么是JTAG,U-BOOT的启动流程及移植,如何正确使用ads(axd)
- u-boot总的启动流程
- U-BOOT的启动流程及移植
- 正式学习bootloader,基于u-boot1.1.4(启动流程框架)
- 14.3 U-Boot启动流程分析
- wince Boot Loader的启动流程
- u-boot系统启动流程
- U-BOOT的启动流程及移植
- 如何在 Windows 恢复环境中使用 Bootrec.exe 工具解决和修复 Windows Vista 中的启动问题
- U-BOOT的启动流程及移植
- U-BOOT的启动流程
- U-BOOT的启动流程及移植
- u-boot系统启动流程
- 用bootrec.exe工具修复vista的启动问题
- u-boot启动流程