MFG tool. Is it possible to read from flash

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

MFG tool. Is it possible to read from flash

Jump to solution
4,865 Views
claussørensen
Contributor II

Hi

Is it possilbe to read data from the NAND flash on my MX53 board using the MFG tool.

 

I tried this:

     <CMD type="find" body="Updater" timeout="180"/>

     <CMD type="push" body="mknod class/mtd,mtd2,/dev/mtd2"/> <!-- The data location -->

     <CMD type="push" body="$ dd if=/dev/mtd2 of=pdata bs=1 count=100">Copy 100 bytes of data to a temp file named pdata</CMD>

     <CMD type="pull" body="read pdata" file="test">Read pdata</CMD>

When excuting the last pull command the MFG tool sometime stops working, or it only read 2 bytes. (The bytes is not the right bytes)

What is wrong, or is it not possible to read data from the board

(Output from debug)

UTP: received command 'mknod class/mtd,mtd2,/dev/mtd2'
class = 'class/mtd'
item = 'mtd2'
node = /dev/mtd2
type = (null)
UTP: running utp_mk_devnode(class/mtd,mtd2,/dev/mtd2,0x2000)
utp_mk_devnode: creating node '/dev/mtd2' with 90+4
UTP: sending Success
UTP: received command '$ dd if=/dev/mtd2 of=pdata bs=1 count=100'
UTP: sending Busy
UTP: executing "dd if=/dev/mtd2 of=pdata bs=1 count=100"
100+0 records in
100+0 records out
UTP: sending Success
utp_poll: pass returned.
UTP: received command 'read pdata'
UTP: sending DCopied to 9dd84000, 2 bytes started from 0
ata
UTP: received command '$ echo Read Complete!'
UTP: sending Busy
UTP: executing "echo Read Complete!"
Read Complete!
UTP: sending Success
utp_poll: pass returned.
g_file_storage gadget: high speed config #1

1 Solution
2,235 Views
VladanJovanovic
NXP Employee
NXP Employee

Not that familiar with it, but Apps\MfgTool.exe\OpUtpUpdate.cpp seems like a good start, just search for "pull".

View solution in original post

0 Kudos
8 Replies
2,235 Views
matthewmckay-da
Contributor II

Looking at the source code there is an undocumented XML attribute for the element command type push: savedfile.

I've just tried this with MfgTool2 and it seems to work.

<CMD state="Updater" type="push" body="read /mnt/flags/BoardInfo.bin" savedfile="test.bin">Retrieve BoardInfo.bin</CMD>

2,235 Views
jataylor
Contributor I

First real answer - kudos Matthew... 

I'm also trying to pull out a unique file name as a variable - kinda the opposite of pushing a file to the $file operator.

i.e

   <...> type"push" body="$ FILE=ls | grep .log" <...>

   <...> type"pull" body="read" name="$FILE" <...>

   <...> type"push" body="read '$NAME'.log" savedfile="'$NAME.log" <...>

Did you come across anything that would indicate this is possible?

0 Kudos
2,235 Views
matthewmckay-da
Contributor II

Hi Jon,

I'm afraid not. Though I didn't look at the code in detail. I have to admit that I only spent enough time looking at the code to find what I was after, and it was luck more than anything that I spotted the parsing of the undocumented attribute after just skimming through the code for about 15 minutes. Especially as I'd wasted quite a bit of time trying various combinations of push and pull commands before looking on the forums and finding this thread with the response elusively marked as correct.

I've used the 'read' command as part of sequence that programs the OTP MAC registers. Basically in production someone will scan a barcode sticker on the board with the MAC and this sets up mac.txt which gets sent to the board along with mac_prev.txt and a bash script checks that the same MAC isn't being used twice, in case the person forgets to scan the new MAC between boards. I read back the mac.txt to mac_prev.txt ready for the next program cycle.

0 Kudos
2,235 Views
SantiagoVillafu
Contributor II

Hi, I wrote a CFG entry on the ucl2.xml file to mount a USB drive and dump the partitions I needed. I hope it helps you.

<LIST name="imx6-dump-mmcblk2" desc="Dump /dev/mmcblk2 into an ext4 USB drive">

  <CMD state="BootStrap" type="boot" body="BootStrap" file ="u-boot_dl.bin" file1="u-boot_qd.bin" >Loading U-boot</CMD>

  <CMD state="BootStrap" type="load" file="uImage" address="0x10800000"

  loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Loading Kernel</CMD>

  <CMD state="BootStrap" type="load" file="initramfs.cpio.gz.uboot" address="0x10C00000"

  loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Loading Initramfs</CMD>

  <CMD state="BootStrap" type="jump" >Jumping to OS image</CMD>

  <!-- -->

  <CMD state="Updater" type="push" body="$ ls -la /">List root</CMD>

  <CMD state="Updater" type="push" body="$ ls -la /dev/sd*">List USB dev nodes</CMD>

  <CMD state="Updater" type="push" body="$ mkdir -p /tmp/mntusb">Make mntusb directory</CMD>

  <CMD state="Updater" type="push" body="$ mount -t ext4 /dev/sda1 /tmp/mntusb">Mount ext4 USB</CMD>

  <CMD state="Updater" type="push" body="$ cat /dev/mmcblk2 > /tmp/mntusb/mmcblk2_dump">Dump eMMC</CMD>

  <CMD state="Updater" type="push" body="$ ls -la /tmp/mntusb">List USB contents</CMD>

  <CMD state="Updater" type="push" body="$ sync">Sync USB FS</CMD>

  <!-- -->

    <CMD state="Updater" type="push" body="$ echo Dump Complete!">Dump Complete</CMD>

</LIST>

0 Kudos
2,235 Views
VladanJovanovic
NXP Employee
NXP Employee

You might want to download MfgTool source code and try to see where it actually fails. If you want to do a decision based on the data you read from device, or log it somewhere, you will probably have to rebuild MfgTool on your own anyway.

0 Kudos
2,235 Views
claussørensen
Contributor II

I have already downloaded the source code because I do ned to modify it.

I am still not sure the syntax is correct in the ucl.xml file, I cant find any examples for reading data back to the PC.

Any suggestions?

0 Kudos
2,236 Views
VladanJovanovic
NXP Employee
NXP Employee

Not that familiar with it, but Apps\MfgTool.exe\OpUtpUpdate.cpp seems like a good start, just search for "pull".

0 Kudos
2,235 Views
keitanagashima
Senior Contributor I

Dear Vladan Jovanovic,

Hello.

I got mfgtool.v2.2.3.SRC.zip for i.MX6 series from feescale's web site.

But, I couldn't find "pull" feature.

I checked DWORDParseUclXml(MFGLIB_VARS *pLibVars) in Apps\MfgToolLib\MfgToolLib.cpp

However, there was push feature but there was not pull feature.

Is "pull" feature implemented in mfgtool.v2.2.3.SRC for i.MX6?

Or, could you give me source code of MFG tool implemented "pull" feature for i.MX6?

Keita

0 Kudos