Skip to content

Using Barebox Via JTAG On RDU2 Board

Chris Healy edited this page Dec 8, 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=aa:bb:ee:cc:dd:ee

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 SD 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

As of now, TEMPMON IP block is accessible in two ways (it may change once the driver is reviewed upstream):

* Raw 'int' (4 byte) values are available via `/dev/imx-thermal`
* ASCII representation is available by executing

echo $thermal0.temperature


### 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