ucl介绍

目录

1、概述

2、global configuration

3、update command list

3.1、UCL的格式:

3.2、host commands

3.3、firmware commands

3.4、条件执行

3.5、使用变量


1、概述

UCL是Update Command List的简称。从《mfgtools工作流程概述》这个文章中知道对目标单板的具体烧写过程是定义在ucl2.xml文件中的operation list中的。

update command list以xml文件的形式记录和存储。主要包含global configuration和command list两部分内容。

2、global configuration

mfgtools通过ucl2.xml文件中的global configuration部分识别通过USB连接的目标SOC。

global configuration包含在<CFG> 和 </CFG>.关键字之间。

例如:

<CFG>

<STATE name="BootStrap" dev="MX6UL" vid="15A2" pid="007D"/>

<STATE name="BootStrap" dev="MX6ULL" vid="15A2" pid="0080"/>

<STATE name="Updater" dev="MSC" vid="066F" pid="37FF"/>

</CFG>

从上图中可以看出,global configuration包含3个entry。

1)前2个entry属于BootStrap阶段,根据PID/VID识别目标SOC,加载ram kernel和uboot到目标单板并运行;

2)最后一个entry属于Updater阶段,用于烧写正式的文件;

3)对于Updater阶段,dev的取值目前仅支持"MSC"。

3、update command list

3.1、UCL的格式:

<LSIT name="xxx", desc="xxx">

commands

</LIST>

其中,此处name的值需要和Cfg.ini中name的值对应,mfgtools会根据Cfg.ini中name的值和UCL中name的值进行匹配,选择合适的operation list执行。

UCL中的commands则定义了具体的操作步骤和操作内容,commands又可以分为host commands和firmware commands。

3.2、host commands

<CMD state="BootStrap" type="load" file="mfgfiles-L4.1.15/mfg-zImage-myimx6a7" address="0x80800000"

loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE">load: zImage(mfg)</CMD>

这是一条典型的host command。state指明command执行的阶段,属于BootStrap还是Updater;type指明command的类型;file、address等则是command的参数;load: zImage(mfg)则是描述信息。

目前。host command主要有以下几条:

Command type

Body

Other parameters

Description

load

 

file

Address

loadSection

setSection

HasFlashHeader

CodeOffset

Download an image to RAM. It is strongly recommended to follow the example provided in release package since it involves ROM code parameters which may not be easy to understand.

下载文件到RAM中。

 

file: specify the path and name of the image file.

file:指定需要下载的文件

 

Parameter “address” specifies the RAM address where the image is located.

address:执行文件下载的ram地址

 

loadSection: a parameter used by ROM code, should be set to “OTH”

loadSection:由ROM代码使用,设置为"OTH"

 

setSection: a parameter used by ROM code, should be set to “OTH” if there are other images to be loaded; set to “APP” if the last image is loaded.

loadSection:由ROM代码使用,设置为"OTH",如果有另外一个文件需要加载,则设置为"OTH",否则设置为"APP"

 

HasFlashHeader: set TRUE if the image contains a flash header, or set to FALSE.

HasFlashHeader:如果image中包含flash头,设为TRUE;如果没有,则设为FALSE。

 

CodeOffset: the address offset of first executed instruct within the image.

CodeOffset:在image中,第一条被执行的指令的偏移

 

The command is only for Bulk-IO mode i.MX device except i.MX50 HID mode device.

jump

  

Notify ROM code to jump to the RAM image to run. The command must be followed after a load command in which setSection value is set to “APP”.

通知ROM代码跳转到iamge去执行,这条命令必须紧紧跟随在属性setSection的值为"APP"的命令后面。

但是查看NXP提供的官方例程中,发现"APP"并没有用到。

The command is only for Bulk-IO mode i.MX device except i.MX50 HID mode device.

boot

Recovery

File

if

Download an image to RAM.

下载image到RAM中。

3.3、firmware commands

firmware commands是host通过USB发送到device,在device上执行的。firmware command的type="push"

Command 

Arguments 

Description 

None 

Request to send the device identity information in XML form 

请求以XML的形式发送设备确认信息

integer 

Initiate the reboot depending on argument. 3 means reboot while

other values will force a shutdown. 

根据参数重新启动。3表示重新启动,而其他值将强制关机。

string 

Execute shell command

Example:

$ echo 'hello from utp' 

执行shell命令

例如

$ echo ‘hello from utp’

flush 

None 

Wait for all data transfer to be finished and processed.

等待所有的数据发送完毕并被执行

ffs 

None 

Partition the SD card and flash the boot stream to it.

对SD卡分区并刷入启动流。

mknod 

device_class,

device_item,node_t

o_create, type 

Create the device node by parsing sysfs entry.

通过解析sysfs条目创建设备节点。

Example:

例如

mknod class/mtd,mtd0,/dev/mtd0 

read 

string 

Read the file specified by parameter and send it to the host. If

there is no such file, the appropriate status will be returned. 

读取参数指定文件并且发送到主机,如果文件不存在,将返回适当的状态。

send 

None 

Receive the file from the host. Subsequent shell commands can

refer to the file received as $FILE.

从主机接受收文件,随后的shell命令可以通过$FILE引用这个文件.

Example:

<CMD type="push" body="send" file="stmp378x_ta1_linux.sb/>

<CMD type=”push” body=”kobs−nginit−dFILE" /> 

selftest 

None 

Perform self-diagnostic; returns either pass or appropriate

status. Implemented as empty function in current release.

进行自我诊断,返回或通过适当的状态。当前版本中实现为空函数。

save 

string 

Save the file received by command “send” to the file specified

as parameter. 

保存通过“send”命令发送的问题件,文件名有参数决定

pipe 

string 

require file attribute 

Execute shell command and read data from stdio pipe IN. mfg will send file to stdio pipe OUT.

执行shell命令并且从标准IO管道IN中读入数据,Mfg往标准管道OUT中发送数据

 

It is useful for big data transfer, more than physical memory size 

这对于那些数据大小大于内存的数据传输非常有用。

 

<CMD type="push" body="pipe tar -xv -C /mnt/ubi0" file="files/rootfs.tar"/>

<CMD type="push" body="flush">Finish Flashing NAND</CMD> 

Note: The above two commands must be combined to use 

注意:以上2条命令必须配合使用

 

Recommend: Please add below command prior to pipe command to free some memory.

建议:请添加下面这条命令在pipe命令之前,主要是为了释放一些内存。

<CMD type="push" body="$ echo 3 > /proc/sys/vm/drop_caches">release memory</CMD>

wff 

NONE 

Deprecate(已过时的命令,该方法不建议使用)

Prepare Write firmware to flash.

wfs 

NONE 

Deprecate(已过时的命令,该方法不建议使用)

Prepare Write firmware to SD CARD.

ffs 

NONE 

Write firmware to SD.

将固件写入SD卡中

wrf 

NONE,  

require file attribute 

ubiformat nand with ubi image. 

采用ubi文件系统格式化nand,并写入ubi image

Example

<CMD type="push" body="wrf" file="files/rootfs.tar"/>

<CMD type="push" body="frf">Finish Flashing NAND</CMD> 

wrs 

number of sd partition

require file attribute 

Write rootfs image to sd card.

写入rootfs image 到sd卡中

Example

<CMD type="push" body="wrs2" file="files/rootfs.ext2"/>

<CMD type="push" body="frs">Finish Flashing NAND</CMD>

 

You can also use 

<CMD type="push" body="pipe dd of=/dev/mmcblkp2 bs=1K" file="files/rootfs.ext2"/?

<CMD type="push" body="frs">Finish Flashing NAND</CMD> 

frf 

NONE 

same as flush 

frs 

NONE 

same as flush 

3.4、条件执行

通过ifde参数实现。例如:

<CMD state="BootStrap" type="load" file="firmware/uImage" address="0x12000000" loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" ifdev="MX6Q MX6D">Loading Kernel.</CMD>

只有dev为MX6Q或者MX6D的时候才执行。

3.5、使用变量

变量的引用形式为%variable%。有两种定义变量的方式:

1)在cfg.ini中定义,例如前文提到过的name变量

2)在启动mfgtool.exe时通过-s指定。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值