Help Flashing to Custom imx6 Board With JTAG

Hello all,

This is a bit of a long shot, but i'm inexperienced in this area and would just like some direction.

So I've been working on a custom-made board with an imx6ul. Thus far, i've been using the generic imx6 profile and have been able to get openWRT running by booting from an SD card and then using dd to install my zImage and rootfs.tar.gz to the eMMC memory.

My problem is that the sysupgrade is not supported, and that as we remove the SD card slot I must find a new way to flash my firmware directly to the on-board memory. My limited knowledge tells me the JTAG will be the way; however, that means I can no longer just write the zImage and rootfs with dd.

I do not know very much, but I think that if flashing with jtag I will want my firmware to be in a .bin format. I was hoping someone could hint at how I might go about modifying a profile to build a bin or even some things I may really need to consider before doing this at all. Just looking at the device profiles that do make bins has not been as enlightening as I'd hoped for.

Thanks for any help you can give!

I think the easiest solution would be to load u-boot, load a kernel with initramfs over tftp and flash your files from this non persistent system to your eMMC.

For further help, you have to describe more about your boot possibilities on your custom board...

I think as long as I get u-boot on there it will be fine, as I do have access to a usb port and uart.

I'm still a bit of a newbie to this level of software and hardware, so I really don't know what's standard and such, so I realize this may have been a pretty open question :sweat_smile:

Idk if its standard for things to come with any version of u-boot installed, but I've found that the SoM I'm using right now in the meantime comes with an old version already installed.

As far as I can tell, once u-boot is running I should be able to flash the mmc memory with the zImage and rootfs stored on some media attached to the usb. The problem with that is that I dont think it scales up very well. I've also just realized I might be able to just boot off of the usb and use that to install my firmware in essentially the same manner i've been using the sd card.

My other concern is how to support sysupgrade (although I have not looked deeply into this yet) so that we can install update using Luci.

Thanks :slight_smile:

Edit: apparently it is not normal for things to come with a boot loader installed, so I will likely have to install one with jtag, and then proceed to install the zImage and rootfs.

Writing a bl image to a spi nor flash, eMMC or something else with only jtag isn't straight forward and depends on your device hardware.

What is your jtag adapter and software?
Do you have available support for your jtag adapter/software?
On which device does your SoC expect the bootloader?
Do you have a working bootloader image or the board specific source code?
And a lot other questions arises but I'm to lazy to write it down now...

i am choosing a jtag adapter and software right now. I'll likely be using this

As we are designing the next revision of the board now, I should be able to add support for anything that will work with an imx6ull processor.

It will expect the bootloader on the eMMC memory.

I have a bootloader that i currently flash onto the board with dd. As far as I understand I should be able to use that same bootloader image. My understanding is that instead of using a SoM, we're essentially just building the SoM into our board, and I should be able to transfer most things right over.

Also, thank you for your help and patience with me. For me, this is a case of "you do software. So go make it work," and I'm just struggling to learn and do the best I can.

I'm not sure if this one works...
Probalby a lot of arm compatible JTAG will work with OpenOCD, but you won't have support or good hardware specific documentation.

Our developers and I use a Lauterbach Power Debug USB for all our arm based SoM and CoM.
There we have support, a very good debugger software and documentation included.

Hmm, you flash it with dd from a already running system on your custom board, right?
So your soldered eMMC is preflashed with a working bootloader.

Yes you can use your current bootloader, but why you wanna flash openwrt with a JTAG adapter if you have a working bootloader that can load the files for booting/flashing from usb/lan/...?

the next iteration of boards will not come with a bootloader, so I will have to flash it myself.

also thanks, I will look into that programmer.

You should really consider to solder a eMMC with preflashed u-boot or have a switch on your board where you can change the boot device to something else other than eMMC like the devel boards from NXP.

yeah, i'd like to be able to somehow receive them with something already flashed onto their eMMC memory, but that is not up to me. (I assume if/when production ramps up we will do this)

Otherwise, I do currently have a dev board that can switch boot devices, which is how i've been programming the modules thus far; however, now I need another way to program the new boards since they will no longer be ... modular.


I'm not sure if you care, but I figured I would share my solution!

I found out that the imx6 will automatically go into a serial download mode and become a usb device if it cannot detect a bootloader. This means I don't have to use JTAG!

Using imx_usb_loader I was able to boot with a temporary bootloader on the device (I could not find out how to flash that onto mmc directly). Then I used that temporary bootloader to put the board into mass storage device mode (did this with the command ums 0 mmc 1), which allowed me to interact with it like an external drive when plugged into my laptop, allowing me to upload my stuff the same old way with dd!

Since I do not have access to the serial console, I had to make a custom u-boot.img that automatically went into mass storage device mode.

The only caveat was that in order to plug it into my laptop I had to make a male-to-male USB-A connector.

Thanks for your time and trying to help me out!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.