Friday, January 16, 2015

Linux Flashing for Freescale i.MX6

We often have customer and R&D projects where we build embedded SW solutions on the Freescale i.MX6 platform. As our OS of choice usually is Linux, developing those solutions has been a bit problematic since Freescale's own tool for flashing (MFGTool) is only available for Windows. Our developers finally got bored of having a separate Windows -workstation for flashing the stuff they had developed on Linux. Therefore they decided to create a Linux tool for flashing to speed up the
development process.

The result of this work was a tool called utp_com which can be used with imx_usb to flash i.MX6 based hardware from Linux environment. As we are talking about Linux we also decided to make the tool publicly available.

Development started from point where we were able to flash "flashing OS" into the device with imx_usb tool. After this a SD card device (/dev/sd* ) is available from the target device to the host machine via an USB connection. The SD card device is not a conventional one, but communication is done with the SCSI commands. On top of them Freescale has defined an Update Transport Protocol ( UTP ) which is used for communication. UTP message data is sent in the vendor specific CDB field of the SCSI message. Return values come as part of the SCSI sense data.

Example commands how a file is copied to the target device and then written to a flash device below:

utp_com -d /dev/sdb -c "send" -f u-boot.bin
utp_com -d /dev/sdb -c "$ dd if=\$FILE of=/dev/mtd0 bs=512"

Code is under GNU GPL v2.0 license, and can be found from: http://github.com/ixonos/utp_com.

We hope you find it as useful as we do!

Teemu Piiroinen, SW Specialist, Ixonos Plc

11 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. After loading the flashing OS with imx_usb_loader I can't see the mentioned SD card device (/dev/sd*). Do you know what could be happening?

    Thanks!!

    ReplyDelete
    Replies
    1. I will leave this here in case someone ends up here looking for answers.

      I was obsessed looking for a /dev/sd* device when I should have looked at some other different name.

      I figured out that after loading the mfg image with the imx_usb_loader, the device present itself not with a name of /dev/sd* but with a name of /dev/sg* that is a SCSI generic device.

      Using that device name (/dev/sg2 in my case) I was able to successfully flash my board using utp commands in linux!! FINALLY!!

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Does Update Transport Protocol support getting a file? I can upload a tests script via 'send', then run via a command '$', but now I would like to 'get' the output log file. Is that possible?

    ReplyDelete
  7. All the best blogs that is very useful for keeping me share the ideas of the future as well this is really what I was looking for, and I am very happy to come here. Thank you very much Feel free to visit my website; 바카라사이트

    ReplyDelete
  8. Awesome and entertaining article. I like to write a little comment to support you. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. I wanted to see hope in future you will continue to sharing such an excellent post. Feel free to visit my website; 토토사이트

    ReplyDelete
  9. Some companies moving services for limited area but L & L Global Paradigm moving solution is offering long distance moving services in Philadelphia PA with affordable prices. Do check them and avail their best moving services.

    ReplyDelete
  10. Flashing linux can be difficult but if have basic knowledge of linux you can easily install, on my college days when i was writing Best Digital Marketing Thesis Topics
    i use to do some practice in linux OS as well

    ReplyDelete