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

6 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