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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

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

以下代码摘抄自:uboot 2009源码中board/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 */

我的疑问是上面代码标红的部分的意义是什么?确切的说,IMX6Q既然规定了IVT在不同的boot devices中的偏移地址,比如我的应用场景是emmc,偏移地址是0x400(1K),那么我的uboot镜像完全可以按照:IVT+uboot本体的格式来构建,这样一来当使用mfg工具烧写uboot镜像时就可以用以下的命令来执行:

<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk0 bs=512 seek=2 ">write U-Boot to sd card</CMD>

而不是默认的命令(跳过uboot.bin前0x400的字节):

<CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk0 bs=512 seek=2 skip=2">write U-Boot to sd card</CMD>

这样看,那么flash_header.S前面的0x400字节是不是多余的呢,还是有什么特别的用处,如果直接把这种uboot.bin烧写到emmc的0x400处(不跳过uboot.bin前0x400的字节,即b _start, .org CONFIG_FLASH_HEADER_OFFSET),那是不是就直接会调整到_start函数开始执行,而不会进行DCD相关的配置?

Labels (1)
Comments

It is for link.   

You can burn the image anywhere here is 0x400.  

But the all the address for the image, need to know the link address.   

我也有同样的疑问,能否请教“It is for link”具体是什么意思?

No ratings
Version history
Last update:
‎04-02-2018 03:09 AM
Updated by: