Skip to content

Using Barebox Via JTAG On RDU2 Board

Chris Healy edited this page Dec 14, 2015 · 23 revisions

Initial Smihosting Setup

To set up access to host's filesystem via JTAG do the following in Barebox command line:

mkdir /mnt/host
mount -t smhfs /dev/null /mnt/host

After this all of the files from OpenOCD's current working directory should be accesible at '/mnt/host'

Changing MAC address in OCOTP (via serial console)

To permanently program fuses with a MAC address do the following:

> ocotp0.sense_enable=1
> ocotp0.permanent_write_enable=1
> ocotp0.mac_addr=ec:fa:aa:aa:bb:cc
Here's what an i.MX51 fuse programming looks like:
barebox@Zodiac NUI board:/ iim.permanent_write_enable=1
barebox@Zodiac NUI board:/ iim.explicit_sense_enable=1 
barebox@Zodiac NUI board:/ iim.ethaddr0=ec:fa:aa:00:00:48
imx_iim 83f98000.iim: regul: 00000000

With the RDU2, the first three octets of the MAC address are always "ec:fa:aa" as that's Zodiac's vendor code. The last three octets are the hex equivalent of the serial number of the RDU2 mainboard. So, for example, if the serial number is 3658, the full MAC address would be "ec:fa:aa:00:0e:4a".

Here's what it looks like when executed:

> barebox@ZII RDU2 Board:/dev echo $ocotp0.mac_addr
00:00:00:00:00:00
> barebox@ZII RDU2 Board:/dev ocotp0.sense_enable=1
> barebox@ZII RDU2 Board:/dev ocotp0.permanent_write_enable=1
> barebox@ZII RDU2 Board:/dev ocotp0.mac_addr=ec:fa:aa:00:05:4a
imx_ocotp 21bc000.ocotp: reloading shadow registers...
> barebox@ZII RDU2 Board:/dev echo $ocotp0.mac_addr
ec:fa:aa:00:05:4a

Accesing I2C EEPROM

To read the contents of EERPOM into a file on the host do:

> cp /dev/eeprom0 /mnt/host/eeprom-dump.bin

To write the contents of a file on a host into EERPOM do:

> cp /mnt/host/eeprom-dump.bin /dev/eeprom0

Accessing SD/eMMC

To read the card inserted into slot J8 do:

> mmc1.probe=1

After that you can access device as a whole via '/dev/mmc1' and its individual partitions via `/dev/mmc1.n' where 'n' is a partition number. For example:

> cp /dev/mmc1 /mnt/host/mmc1.bin

should copy the contents of SD card in slot J8 into a file 'mmc1.bin'

Replace 'mmc1' with 'mmc2' for SD slot J9 and with 'mmc3' for eMMC.

Accessing SPI NOR flash

SPI NOR flash can be accessed via '/dev/m25p0' device. To erase the device do the following:

> erase /dev/m25p0

To write do:

> cp /mnt/host/data.bin /dev/m25p0

To read do:

> cp /dev/m25p0 /mnt/host/data.bin

Programming SPI NOR Flash With Barebox Image (via SD Card)

To program SPI NOR flash with barebox image do the following:

  • Copy '/images/barebox-zii-imx6q-rdu2.img' to a SD card (FAT partition is recommended)

  • Insert SD card into SD slot J8

  • In barebox prompt do:

mmc1.probe=1 mkdir /mnt/sd mount /dev/mmc1.0 /mnt/sd erase /dev/m25p0.barebox cp /mnt/sd/barebox-zii-imx6q-rdu2.img /dev/m25p0.barebox


* Configure PIC MCU to bootstrap i.MX6 from SPI NOR

### Programming SPI NOR Flash With Barebox Image (via Semihosting)

To program SPI NOR flash with barebox image do the following:
* Copy '<barebox>/images/barebox-zii-imx6q-rdu2.img' to '<openocd>'
* In barebox prompt do:

mkdir /mnt/host mount -t smhfs /dev/null /mnt/host erase /dev/m25p0.barebox cp /mnt/host/barebox-zii-imx6q-rdu2.img /dev/m25p0.barebox

* Configure PIC MCU to bootstrap i.MX6 from SPI NOR

### Reading Measurements From TEMPMON IP Block

The readings from that sensors are available via:

hwmon


### Reading Measurements From LM75 Sensor Connected To i.MX6

The readings from that sensors are available via:

hwmon


### Accessing SATA Drive

To detect the drive connected via SATA do:

ata0.probe=1


After that you can access device as a whole via '/dev/ata0'
For example:

cp /dev/ata0 /mnt/host/ata0.bin


should copy the contents of SATA into a file 'ata0.bin'

### Performing MMDC Calibration

MMDC calibration commands are available in IRAM bootable image and can be accessed as follows:

mmdc -t dqs # For DQS calibration mmdc -t write-level # For write-level calibration mmdc -p # For printing results of the calibration