Skip to content

Using Barebox Via JTAG On RDU2 Board

Andrey Smirnov edited this page Dec 30, 2015 · 23 revisions

Initial Semihosting 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


### Programming Minimal Flashless Configuration Into i210's iNVM

Below are the steps the were used to configure i210 in order to be
able to do basic functionality test ("ping") in Linux, note however:

a) These setting are by no means final, and, most likely, for optimal
performance Intel's FAE feedback should be solicited

b) As experiment shows none of the steps below are necessary to use
i210 in Barebox (at least for a basic "ping" test functionality)


* Configure iNVM to program word 0x0D with device id 0x157B

	```
> mw -l -d /dev/e1000-invm0 0x00 0x157B1A11
	```

* Configure iNVM to program word 0x0A with 0x402f

	```
> mw -l -d /dev/e1000-invm0 0x04 0x402F1411
	```

* Configure iNVM to pre-populate MAC address (this
  particular example uses "A0:36:9F:69:4C:54" as an example, replace
  appropriate bytes with desired values):

	```
> mw -l -d /dev/e1000-invm0 0x08 0x36a00019
> mw -l -d /dev/e1000-invm0 0x0c 0x689f0219
> mw -l -d /dev/e1000-invm0 0x10 0x544c0419
	```

Note: All of the commands above assume a pristine iNVM, if it is not
the case, please replace given offset with the ones that are more
appropriate to your particular configuration

Note: To dump you current iNVM state use:

md -l -s /dev/e1000-invm0


### Configuring Network Interfaces

Built-in i.MX6 FEC can be configured via DHCP as follows:

ifup eth0


On-board i210 chip is configured using a very similar command

ifup eth1


To select which interface Barebox is going to use for data transfer
do:

ethact eth