freescale mfg工具命令祥解

来源:互联网 发布:skypeforbusiness mac 编辑:程序博客网 时间:2024/05/17 22:03

Manufacturing(Mfg) tool provides a quite flexible way for users to set their own operations.An xml script file is used to configure the users operation.

An xml filetypically consists of a number of tasks which can be executed by runningmanufacturing tool just one time.

1         UTP mode operation  串行传输协议,我们使用这种方法烧录

1.1      Global Configuration

Mfg tool uses global configuration to recognizewhich device is what user want to flash among a lot of USB devices connected toPC.

因为MFG工具同时支持4USB口烧录,这里指定了USB端口的VID/PID信息,由用户通过GUI操作生成,不需要手工修改。

Let’s explain it by an example.

 <CFG>

   <STATE name="BootStrap" dev="MX51" />

   <DEV name="MX51" vid="15A2"pid="0041"/>  定义i.mx5 USB口的VID/PID

   <STATE name="Updater"  dev="Updater" /> 定义升级模式不能修改

   <DEV name="Updater" vid="066F"pid="37FF" />

 </CFG>

Global configuration is contained betweenparameter <CFG> and </CFG>.

<STATE name="BootStrap"dev="MX51" /> is used to define ROM code running mode for targeteddevice. You can change "MX51" to any name you want.

<DEV name="MX51"vid="15A2" pid="0041"/> is used to specify USB deviceVID and PID of the device defined in the dev section of <STAT name=>sentence. The two dev names MUST be same.

<STATE name="Updater"   dev="Updater" /> is used todefine updater mode, it should be never be changed.

<DEV name="Updater" vid="066F"pid="37FF" /> is used to specify USB MSC device VID and PID fortargeted device.

1.2       Update Command List

The tool uses Update Command List (UCL) tospecify all the user tasks. The UCL contains a distinct list for each use case.Each list contains a set of command elements with attributes for the commandtype, body and payload. The command element text provides a user interfacemessage for the current operation.

Each UCL begins from <LIST name=”xx”,desc=”xxx”> while ending with </LIST>, wherein name can be specifiedby users. Parameter “desc” is used for comment purpose.

每一条更新命令列表如下列开始

<LISTname=”名字”,desc=”备注信息”>

</LIST>

 

There are two types of commands: hostspecific commands and firmware specific commands. Host specific commands areparsed and executed by host tool while firmware specific commands are parsedand executed by firmware runs on targeted device.

 

有两种命令:

1、   主机特定命令,由主机MFG工具执行

2、固件特定命令,由目标机执行

1.2.1    Host specific commands

Below example shows a typical command.

“CMD type” specifies the type of a command.指定命令类型

“body” is a parameter of the command.命令的参数

 “file”is another parameter. 命令的别一个参数

“Booting update client engine.” isdescription of the command.命令的描述,随意写。

<CMD type="boot" body="Recovery"file="uce.sb" if="HabDisable">Booting update clientengine.</CMD>

Command type

   

Body

   

Other parameters

   

Description

   

find

   

BootStrap /Updater

   

timeout

   

Find the device which is  under specified mode. The value of parameter “body” is the very one defined  in STATE section of Global Configuration. Parameter “timeout”  is used to specify the timeout value (second unit) when device is not found.

 

寻找处于引导模式的设备。因为MFG同时支持4个USB下载,所以利用该命令,可找到当前处于下载模式的设备。

   

init

   

Memory

   

file

   

Initialize RAM memory  which is used to store the mini-OS sent from host.

 

file: specify the path  and name of the file which contains memory initialization setting according  to the memory type of the targeted hardware uses.

 

The format of the file  must follow the example provided in release package.

 

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

   

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 is not easy to understand.

 

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

 

指定映像文件的路径和名称

 

Parameter “address”  specifies the RAM address where image locates. 映像在内存中的位置

 

loadSection: a parameter  used by ROM code, should be set to “OTH”    ROM代码的一个参数,应该设置为OTH(other)

 

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.

 

如果还有其他映像的话,设置为OTH,如果是最后一个映像了则设置为APP,用于通知ROM代码,下载结束了。

 

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

 

CodeOffset: the address  offset of first executed instruct within the 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代码跳至内存处执行,通过在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.

 

下载映像到内存

 

1.2.1.1 i.MX28 Platform

There are two types of i.MX28 boards:Hab-Enable and Hab-Disable type. We have to distinguish them.

<CMDtype="boot" body="Recovery" file="uce.sb"if="HabDisable">Booting update client engine.</CMD>

The command downloads a RAMimage uce.sb to RAM if the boardisHab-Disabled.

<CMDtype="boot" body="Recovery" file="uce_ivt.sb" if="HabEnable">Bootingupdate client engine.</CMD>

The command downloads a RAM image uce_ivt.sbto RAM if the board is Hab-Enabled.

<CMDtype="find" body="BootStrap" timeout="60"/>

The command searches the device which isunder boot strap mode within 60s.

1.2.1.2 i.MX23 Platform

<CMDtype="boot" body="Recovery" file="uce.sb" Bootingupdate client engine.</CMD>

The command downloads a RAM image uce.sbto RAM.

<CMDtype="find" body="BootStrap" timeout="60"/>

The command finds the device which isunder boot strap mode within 60s.

1.2.1.3 i.MX51 Platform

<CMDtype="find" body="BootStrap" timeout="60"/>

The command finds the device which isunder boot strap mode within 60s.

<CMDtype="init" body="Memory" file ="MX51_DDR.ddr.xml"/>

The command downloads file MX51_DDR.xmlto targeted device to perform memory initialization.

<CMDtype="load" file="uce.nb0" address="0x90200000"loadSection="OTH" setSection="OTH"HasFlashHeader="FALSE" >Doing preLoad."</CMD>

The command downloads a RAM image uce.nb0to RAM and will be stored in address 0x90200000.

 <CMD type="load"file="eboot_uut.nb0" address="0x90040000"loadSection="OTH" setSection="APP"HasFlashHeader="FALSE" >Loading OS image.</CMD>       

The command downloads a RAM image eboot_uut.nb0to RAM and will be stored in address 0x90040000.This is the last image to be loaded.

<CMDtype="load" file="eboot_uut.nb0"address="0x70041000" loadSection="OTH"setSection="APP" CodeOffset="0x800" >Loading OSimage.</CMD>

The command downloads a RAM image eboot_uut.nb0to RAM and will be stored in address 0x70041000. And the first executedinstruct is from the address offset “0x800” within the image. This is the lastimage to be loaded.

<CMDtype="jump" > Jumping to OS image. </CMD>

Till now, all the images are downloadedto RAM, and then notify ROM code to jump to the RAM image to run.

<CMDtype="find" body="Updater" timeout="180"/>

The command is used to find the devicewhich is under USB MSC mode within 180s.

1.2.1.4 i.MX50/53 Platform

<CMDtype="boot" body="Recovery" file ="eboot_uut.nb0">Running plugin to init LPDDR2 Memory.</CMD>

The command firstly downloads plugin (apart of eboot_uut.nb0) to iRAM to init RAM. Then it will download a RAM imageeboot_uut.nb0 to RAM and the stored address is calculated automatically.

<CMDtype="load" file="uce.nb0" address="0x70200000"loadSection="OTH" setSection="OTH">DoingpreLoad."</CMD>

The command downloads a RAM image uce.nb0to RAM and will be stored in address 0x70200000.

<CMDtype="jump" > Jumping to OS image. </CMD>

Till now, all the images are downloadedto RAM, and then notify ROM code to jump to the RAM image to run.

<CMDtype="find" body="Updater" timeout="180"/>

The command is used to find the devicewhich is under USB MSC mode within 180s.

Note: There may be some minor changesaccording to different platforms, but the functionality is similar.

All the above commands must be executedbefore doing any user task.

1.2.2    Firmware specific commands固件指令

If a command is typed as “push”, whichmeans the command is parsed and executed by the targeted device instead of host,the only thing host has to do is to send the command to the targeted device.

当命令类型为push的时候,说明这条指令将被目标机解析并执行。

The commands actually executed by OSimage downloaded inCommand lists, as a result, each kind of OS has its owncommands.

1.2.2.1 WinCE OS

1.2.2.1.1   Specify Media type

<CMDtype="push" body="MediaType:NAND">Send mediatype.</CMD>

Below commands show how to specify mediatype:

Here “NAND” is media type. For SD/MMCmedia, it should use “SDMMC” instead.

1.2.2.1.2   Check if a storage device is ready
Below two commands bothcan be used to check storage if ready.

<CMDtype="push" body="QueryStoreStatus:DSK1:,Timeout:10">Querystore status.</CMD>

The command specifies the name of a disk.

Here “DSKx:” indicates the storage devicehandle in WinCE OS, which must be 5 bytes long; If a different disk type needsto be specified, then just change “DSK1:” to “DSKx:”, wherein “x” is the indexof the storage device.

“Timeout” specifies the timeout value(second) for the query operation. In this example, query operation will quit ifthe specified device “DSK1:” can’t be found within 10 seconds.

<CMDtype="push" body="QueryStoreName:XXXX ,Timeout:10">Sendstore name.</CMD>

“XXXX” is the name of a storage devicesuch as “NAND FLASH Storage”. And it can be found in WinCE registry, belowregistry gives an example:

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MSFlash]

"Name"="NAND FLASHStorage"

It should be changed according to users’own registry setting.

“Timeout” specifies the timeout value(second) for the query operation. In this example, query operation will quit ifthe specified device “XXXX” can’t be found within 10 seconds.

To write a firmware or raw data to media,the either one of the two commands must be executed firstly. The command is notnecessary when you write the second firmware or raw data.

1.2.2.1.3   Create Partitions if the media type is SD/MMC
Below commands show how to create partitions forSD/MMC media. Command1 is only for MX35/MX51 platform. And command2 is forMX23/MX28 platform.
<CMD type="push"body="Partitions:EBOOT:64MB,NK:32MB,File">Startingpartitions.</CMD>
<CMD type="push"body="Partitions:Firmware:100MB,File">Startingpartitions.</CMD>
Command1:Parameter”Partitions:EBOOT:XXMB,NK:XXMB,File”specifies SD/MMC card will be divided into three partitions. The firstpartition is for eboot download, the second partition is for NK download, andthe File partition is used for user. “XX” means the partition size, and Filepartition size is remained size of SD/MMC card except for the size of EBOOT andNK partition.
Command2: Parameter”Partitions:Firmware:XXMB,File”specifies SD/MMC card will be divided into two partitions. But the firstpartition of SD/MMC is File partition for user used. And the second partitionis for Firmware download. “XX” means the partition size, and File partitionsize is remained size of SD/MMC card except for the size of Firmware partition.
1.2.2.1.4   Flash a firmwareto media

Below a bench of commands show how toflash a firmware to media. If there are multiple firmwares to be written, thenthe whole bench of commands must be repeated.

        <CMD type="push"body="wfw">Notity device to prepare receiving afirmware.</CMD>

        <CMD type="push"body="fwtype:xxx">Specify firmware type.</CMD>

        <CMD type="push"body="send" file="xxx">Sending a firmwarefile.</CMD>

        <CMD type="push"body="save">write the firmware to NAND flash.</CMD>

Command1:Parameter”wfw” means writingfirmware.

Command2:Parameter”fwtype:xxx” specifiesthe name of a firmware. Here “xxx” is the name of firmware, there are five optionsused for the section: XL_NB, EB_NB, NK_NB, EB_SB, and NK_SB. And they supportthe different firmware type show as below.

XL_NB is for xldr.nb0 type,

EB_NB is for eboot.nb0 type,
NK_NB is for nk.nb0 type,

EB_SB is for eboot.sb type,

NK_SB is for nk.sb type.

The image file name is specified inCommand 3 which will send data of the file to targeted device.

Command4 is used to notify targeteddevice to flash whole data into media.

1.2.2.1.5   Write raw data to media

Below a bench of commands show how to writeraw data to media. The commands can be used when you need to write raw datainto specified address of a media.

        <CMD type="push"body="wrd:0x400">Write raw data to device with a specifiedstarting address.</CMD>

        <CMD type="push"body="send" file="files/xldr.nb0">Sending afile.</CMD>

        <CMD type="push"body="save">Finish sending data.</CMD>

Command 1: Write raw data to media. Thevalue of address to be written is specified along with the colon.

Command 2: Send data of the file whose nameand path are specified in keyword “file” to targeted device.

Command 3: Notify targeted device toflash whole data into media.

1.2.2.1.6   Check if a disk is ready

Before write a file to a disk, belowcommand must be executed.

<CMDtype="push" body="QueryFolderStatus:XXXX,Timeout:10">Queuefolder status.</CMD>

“XXXX” is the name of a disk such as “NANDFlash”.And it can be found in WinCE registry, below registry gives an example:

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MSFlash]

"Folder"="NANDFlash"

It should be changed according to users’own registry setting.

“Timeout” specifies the timeout value(second) for the query operation. In this example, query operation will quit ifthe specified disk “NANDFlash” can’t be found within 10 seconds.

To write a file to media, the commandmust be executed firstly. The command is not necessary when you write thesecond file.

1.2.2.1.7   Write a file to a disk

Below a bench of commands show how towrite a file to a disk. If there are multiple files to be written, then thewhole bench of commands must be repeated.

         <CMD type="push"body="wfl">Notity device to prepare receiving a file.</CMD>

        <CMD type="push"body="filename:xxx ">Sending file name.</CMD>

        <CMD type="push"body="send" file=" xxx">Sending a file.</CMD>

        <CMD type="push"body="save">Finish sending data.</CMD>

Command1:Parameter”wfl” means writing afile.

Command2:Parameter”filename:xxx”specifies the name and path of a file, xxx has to be replaced with user’s filename and path, for example:NANDFlash\\thriller.mp3.

The file name is specified in Command 3 whichwill send data of the file to targeted device.

Command4 is used to notify targeteddevice to write whole data into specified path.

1.2.2.1.8   OTP bits programming

The functions are only available for i.MX233.

Below command shows how to write a file toa disk:

<CMDtype="push" body="OtpSendData:0x00000020:0x00000001">Toprogram otp bits.</CMD>

0x00000020 is the address of an OTPregister; 0x00000001 is the value to be programmed.

Warning: the format of address and value in this command must be same withwhat the example shows since command parser only accept such kind of format.For instance, 0x20:0x01 is invalid.

1.2.2.2 Linux OS

1.2.2.3 当命令类型为push的时候,说明这条指令将被目标机解析并执行。

Command

   

Arguments

   

Description

   

?

   

None

   

Request to send the device identity  information in XML form

   

!

   

integer

   

Initiate the reboot depending on  argument. 3 means reboot,
  other values will force a shutdown.

 

根据参数初始化重启,3表示重启,其他值则强制关机

   

$

   

string

   

Execute shell command
  Example:
  $ echo 'hello from utp'  
执行shell命令

   

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.
  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
  Example:
  <CMD type="push" body="send"  file="stmp378x_ta1_linux.sb/>
  <CMD type=”push” body=”$ kobs-ng init -d $FILE" />

 

向目标机发送文件,随后的命令可以使用$FILE来引用它。

   

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.

 

接收文件并重命名。

   

pipe

   

string
  require file attribute

   

Execute shell command and read data  from stdio pipe IN. mfg will send file to stdio pipe 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>

 

执行管道命令,从输入管道读,mfg会发送文件到管道出。

 

对于大文件传输,超过物理内存的时候使用。

   

wff

   

NONE

   

Deprecate(反对)
  Prepare Write firmware to flash
准备写固件到flash

   

wfs

   

NONE

   

Deprecate(反对)
  Prepare Write firmware to SD CARD
准备写固件到SD

   

ffs

   

NONE

   

Write firmware to SD  写固件到SD

   

wrf

   

NONE, 
  require file attribute

   

ubiformat nand with ubi image. UBI格式的映像
  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
  Example
  <CMD type="push" body="wrs2"  file="files/rootfs.ext2"/>
  <CMD type="push" body="frs">Finish Flashing  NAND</CMD>
 
  You 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

 

 

2         RKL mode operation

2.1       Global Configuration

The global configuration of RKL (abbreviationof Ram kernel) mode is quite similar to what we do in UTP mode.

Let’s explain it by an example.

  <CFG>

    <STATE name="BootStrap"dev="MX51" />

    <STATE name="RamKernel"dev="MX51" />

    <DEV name="MX51"vid="15A2" pid="0041" />

  </CFG>

It can be seen that “Updater” state isreplaced by “RamKernel”. And the dev is only MX51. The configuration shouldn’tbe changed for same device type anytime.

2.1.1    Host specific commands

All the commands follow the same rule ofHost specific commands. The differences lie in theparameters specified in the commands. The commands shouldn’t be changedanytime.

2.1.2    Firmware specific commands

If a command is typed as “rklCmd” or “program”,which means the command is parsed and executed by the targeted device insteadof host, the only thing host has to do is to send the command to the targeteddevice.

如果命令是rklCmdprogram,则由目标机解析并执行。

2.1.2.1.1   Initialize a storage media

Below command is used to initialize astorage media.初始化存储设备

<CMDtype="rklCmd" body="FlashInit" />

2.1.2.1.2   Setting media parameter

For some kinds of media, some parametershould be set before writing a firmware. Below command is used to initialize astorage media.

对于一些媒介,在烧写之前可以需要设置一些参数。

<CMDtype="rklCmd" body="xxx" param1="x"/>

Here the value of body is the name of aparameter and the value of param1 is the value of the parameter.

For NAND flash, there are 4 kinds ofparameters:

SwapBI, FlashInterleave, FlashBBT,FlashLBA

The value of the parameters depend onplatforms and OS. It should follow the setting of sample provided in thepackage.

2.1.2.1.3   Flash a firmware烧写固件

<CMDtype="program" file="xxxx" address="xxx"readback="x" />

The command will program a firmware intospecified media.

Parameter “file” is used to specify thename of the firmware.指定文件名

Parameter “address” specifies the addresswhere the firmware is flashed.烧写地址

Parameter “readback” specifies if thefirmware is checked by reading back.读取检验

 

原创粉丝点击