上几篇主要分析了UBOOT源码的汇编部分,还有一点没分析完,这一篇接着分析。
-------------------------------------------------------------------------------------------------------------------
这应该是源码中进入C语言编写的代码的最后一部分汇编代码了,先设置堆栈,bss段清0,然后跳转到start_armboot。
----------------------------------------------------------------------------
skip_hw_init:
/* Set up the stack */
stack_setup:
#ifdef CONFIG_MEMORY_UPPER_CODE
ldr sp, =(CFG_UBOOT_BASE + CFG_UBOOT_SIZE - 0xc)
#else
ldr r0, _TEXT_BASE/* upper 128 KiB: relocated uboot */
sub r0, r0, #CFG_MALLOC_LEN/* malloc area */
sub r0, r0, #CFG_GBL_DATA_SIZE /*bdinfo */
---------------------------------------------------------------------------
其中有:
/*
* Size of malloc() pool
*/
//jkeqiang change it to avoid stack flow
#define CFG_MALLOC_LEN (CFG_ENV_SIZE + 512*1024)
//#define CFG_MALLOC_LEN (CFG_ENV_SIZE + 1024*1024)
#define CFG_GBL_DATA_SIZE 128/* size in bytes reserved for initial data */
---------------------------------------------------------------------------
#ifdef CONFIG_USE_IRQ
sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
#endif
sub sp, r0, #12/* leave 3 words for abort-stack */
#endif
clear_bss:
ldr r0, _bss_start/* find start of bss segment */
ldr r1, _bss_end/* stop here */
mov r2, #0x00000000/* clear */
clbss_l:
str r2, [r0]/* clear loop... */
add r0, r0, #4
cmp r0, r1
ble clbss_l
ldr pc, _start_armboot
_start_armboot:
.word start_armboot
--------------------------------------------------------------------------------------
上面这部分很简单,主要和下面这个图有关,虽然有一点改变,但总体来说,还是一样的。
----------------------------------------------------------------------------------------------------------
这一篇博客写完,uboot汇编部分的代码就分析完了,主要有三个文件。