关于imx6q uboot中的flash_header.S的一些问题

时间:2018-07-01 14:44:57

标签: assembly u-boot imx6 nxp-microcontroller

以下代码摘自:uboot 2009源代码板/Freescale/mx6q_sabreauto/flash_header.S

#include <config.h>
#include <asm/arch/mx6.h>

#ifdef CONFIG_FLASH_HEADER
#ifndef CONFIG_FLASH_HEADER_OFFSET
# error "Must define the offset of flash header"
#endif

#define CPU_2_BE_32(l) \
((((l) & 0x000000FF) << 24) | \
(((l) & 0x0000FF00) << 8) | \
(((l) & 0x00FF0000) >> 8) | \
(((l) & 0xFF000000) >> 24))

#define MXC_DCD_ITEM(i, addr, val) \
dcd_node_##i: \
.word CPU_2_BE_32(addr) ; \
.word CPU_2_BE_32(val) ; \

.section ".text.flasheader", "x"
b _start
.org CONFIG_FLASH_HEADER_OFFSET

ivt_header: .word 0x402000D1 /* Tag=0xD1, Len=0x0020, Ver=0x40 */
app_code_jump_v: .word _start
reserv1: .word 0x0
dcd_ptr: .word dcd_hdr
boot_data_ptr: .word boot_data
self_ptr: .word ivt_header
app_code_csf: .word 0x0
reserv2: .word 0x0

boot_data: .word TEXT_BASE
image_len: .word _end_of_copy - TEXT_BASE + CONFIG_FLASH_HEADER_OFFSET
plugin: .word 0x0

dcd_hdr: .word 0x40D802D2 /* Tag=0xD2, Len=90*8 + 4 + 4, Ver=0x40 */
write_dcd_cmd: .word 0x04D402CC /* Tag=0xCC, Len=90*8 + 4, Param=0x04 */

#include <config.h>
#include <asm/arch/mx6.h>

#ifdef CONFIG_FLASH_HEADER
#ifndef CONFIG_FLASH_HEADER_OFFSET
# error "Must define the offset of flash header"
#endif

#define CPU_2_BE_32(l) \
((((l) & 0x000000FF) << 24) | \
(((l) & 0x0000FF00) << 8) | \
(((l) & 0x00FF0000) >> 8) | \
(((l) & 0xFF000000) >> 24))

#define MXC_DCD_ITEM(i, addr, val) \
dcd_node_##i: \
.word CPU_2_BE_32(addr) ; \
.word CPU_2_BE_32(val) ; \

.section ".text.flasheader", "x"
**b _start
.org CONFIG_FLASH_HEADER_OFFSET**

ivt_header: .word 0x402000D1 /* Tag=0xD1, Len=0x0020, Ver=0x40 */
app_code_jump_v: .word _start
reserv1: .word 0x0
dcd_ptr: .word dcd_hdr
boot_data_ptr: .word boot_data
self_ptr: .word ivt_header
app_code_csf: .word 0x0
reserv2: .word 0x0

boot_data: .word TEXT_BASE
image_len: .word _end_of_copy - TEXT_BASE + CONFIG_FLASH_HEADER_OFFSET
plugin: .word 0x0

dcd_hdr: .word 0x40D802D2 /* Tag=0xD2, Len=90*8 + 4 + 4, Ver=0x40 */
write_dcd_cmd: .word 0x04D402CC /* Tag=0xCC, Len=90*8 + 4, Param=0x04 */

我的问题是

是什么意思
b _start
.org CONFIG_FLASH_HEADER_OFFSET

以上代码。

具体来说,由于IMX6Q在不同的启动设备中指定了IVT的偏移量,例如,我的应用程序场景是sd,偏移量地址是0x400(1K),那么我的uboot映像可以完全如下:IVT + uboot格式已建立,以便在使用mfg工具刻录uboot映像时,可以使用以下命令:

将U-Boot写入SD卡

代替默认命令(在uboot.bin之前跳过0x400字节):

将U-Boot写入SD卡

看看,然后在flash_header.S前面的0x400字节不是多余的,或者有什么特殊用途,如果您直接将此uboot.bin写入emmc 0x400(请不要跳过ucode)在0x400字节之前的.bin,即b _start,.org CONFIG_FLASH_HEADER_OFFSET)是否直接调整为_start函数以开始执行,并且不会与DCD相关的配置?

另一个问题是我使用了flash_header.S并尝试在2017.03 uboot中移植以创建uboot.bin,同时使用gpt分区表(由mfg工具或fsl-sdcard-partition.sh使用)我的gpt + ivt + uboot.bin的偏移量不正确,

00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001c0 01 00 ee fe ff ff 01 00 00 00 ff af e2 0e 00 00 |................|
000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200 45 46 49 20 50 41 52 54 00 00 01 00 5c 00 00 00 |EFI PART....\...|
00000210 ff 8a 6c dd 00 00 00 00 01 00 00 00 00 00 00 00 |..l.............|
00000220 ff af e2 0e 00 00 00 00 22 00 00 00 00 00 00 00 |........".......|
00000230 de af e2 0e 00 00 00 00 8b 43 02 05 72 4d ed 4a |.........C..rM.J|
00000240 be 85 17 f1 e3 69 c2 32 02 00 00 00 00 00 00 00 |.....i.2........|
00000250 80 00 00 00 80 00 00 00 86 d2 54 ab 00 00 00 00 |..........T.....|
00000260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000400 36 07 00 ea 00 00 00 00 00 00 00 00 00 00 00 00 |6...............| ---------> b _start at 1KiB
00000410 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000800 d1 00 20 40 58 74 90 00 00 00 00 00 00 00 00 00 |.. @Xt..........| ---------------> ivt header at 2KiB

板子无法启动。

0 个答案:

没有答案
相关问题