Content
- Get and compile the latest uBoot
- Run uBoot on an empty board
- Flash uBoot for the very first time into a fresh board
- Programming eFuses on very fresh board
- Updating uBoot
- Important files
- Help! uBoot doesnt boot up.
- Booting uBoot from an SD card
- Booting printenv examples
Get and compile the latest uBoot
Run the following commands (be aware for which board you are downloading uBoot – you may want to use a different branch e.g. instead of “u-boot-2gb” use “u-boot-512mb”):
cd /home/fedevel/openrex/uboot git clone -b u-boot-2gb https://github.com/FEDEVEL/openrex-u-boot-2009.08.git cd openrex-u-boot-2009.08/ ./build_u-boot.sh
Run uBoot on an empty board(a fresh board just coming from production)
Register on the NXP website, login, download Mfgtools-Rel-4.1.0_130816_MX6Q_UPDATER and unpack it.
We need to do some changes in the config files. Follow these steps:
1. Open Mfgtools-Rel-4.1.0_130816_MX6Q_UPDATER\Profiles\MX6Q Linux Update\OS Firmware\ucl2.xml file
2. Find and just above this line place:
<LIST name="OpenRex-uBootOnly" desc="Only boot u-Boot.bin"> <CMD state="BootStrap" type="boot" body="BootStrap" file ="u-boot.bin" >Loading U-boot</CMD> <CMD state="BootStrap" type="load" file="initramfs.cpio.gz.uboot" address="0x10C00000" loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Loading Initramfs.</CMD> <CMD state="BootStrap" type="jump" > Jumping to u-boot. </CMD> </LIST>
3. Open the file Mfgtools-Rel-4.1.0_130816_MX6Q_UPDATER\cfg.ini and replace “name = Sabre-SD” with:
name = OpenRex-uBootOnly
4.Copy the u-boot binary file which you have generated (located in “/home/fedevel/openrex/uboot/openrex-u-boot-2009.08/u-boot.bin“) into the “Mfgtools-Rel-4.1.0_130816_MX6Q_UPDATER\Profiles\MX6Q Linux Update\OS Firmware” directory. Alternatively you can use our 2GB u-boot (do not forget to rename it).
5. Connect OpenRex micro USB (J11) with your Windows computer. If your board is completely new, JP2 must not be fitted. If you have already programmed efuses, JP2 must be fitted. The USB series resistors must be in positions: R323 Fitted / R326 Fitted / R322 Not Fitted / R325 Not Fitted.
6. Connect OpenRex board with serial FTDI cable to your windows machine and run Hyperterminal (or download and use Tera Term). Set it to Baud rate: 115200 / Data: 8 / Parity: none / Stop bit: 1 / Flow control: none.
7. Start MfgTool2.exe from Mfgtools-Rel-4.1.0_130816_MX6Q_UPDATER
8. Switch on power of the OpenRex board
9. The MfgTool2.exe must change from: “No device connected” to: “HID-compliant device”
10. Press “Start” button
11. Watch the serial console, u-boot should now start.
Flash uBoot for the very first time into a fresh board (only once)
Your u-boot is now running from the previous steps. Connect network cable. Run these commands (update MAC, IP and server IP according to your setup):
setenv netdev eth0 setenv ethprime FEC0 setenv ethact FEC0 setenv ethaddr 00:01:02:03:04:05 setenv fec_addr 00:01:02:03:04:05 setenv ipaddr 192.168.0.150 setenv serverip 192.168.0.80 setenv gatewayip 192.168.0.1
Copy the u-boot binary file into tftp folder (we are using Ubuntu 9.04):
cp -prv /home/fedevel/openrex/uboot/openrex-u-boot-2009.08/u-boot.bin /tftp/
Now flash the u-Boot into SPI. Check if the file u-boot.bin is placed in the tftp directory. Just copy and paste this line into your console:
mw.b 0x10800000 0xFF 0x80000;tftp 0x10800000 u-boot.bin;sf probe 3:2;sf erase 0x0 0x80000;sf write 0x10800000 0x0 0x80000
Programming eFuses on very fresh board (only once)
To be able to run the uBoot automatically from SPI, you need to program eFuses. Run these commands from uBoot. It’s very important you do it exactly this way – otherwise your board may never boot up.
//!!BEAWARE: Once you blow a bit to 1, it can NOT be changed back to 0!! //BE SURE YOU ARE DOING IT RIGHT - THIS IS THE CORRECT SETTING FOR OPENREX SPI BOOT //THE OPENREX SPI IS CONNECTED TO ECSPI3 and CS2 //for OPENREX, YOU MUST DO IT EXACTLY THIS WAY: imxotp blow --force 5 0x2A000030 imxotp blow --force 6 0x10
Program eFuses to set the MAC address. Be sure that you set the correct address – it cannot be changed back.
//!!BEAWARE: Once you blow a bit to 1, it can NOT be changed back to 0!! //USE YOUR MAC ADDRESS!!!!, this is just en example // example MAC Address: 00:0d:15:00:bc:4a imxotp blow --force 23 0x000d imxotp blow --force 22 0x1500bc4a
Now you can unplug the micro USB cable, remove the link on J2 and reset the board.
Updating uBoot
Anytime you need to update uBoot, just run this command:
mw.b 0x10800000 0xFF 0x80000;tftp 0x10800000 u-boot.bin;sf probe 3:2;sf erase 0x0 0x80000;sf write 0x10800000 0x0 0x80000
Important files
If you design your own baseboard, you may need to have a look at these files & directories:
imx6rex-u-boot-2009.08/board/freescale/mx6q_rex/ imx6rex-u-boot-2009.08/include/configs/mx6q_rex.h
Help! uBoot doesnt boot up.
If you accidentally flash a wrong u-boot, you can boot up through the USB cable and reflash it with a working one. Just follow the Run uBoot on an empty board steps.
Booting uBoot from an SD card
OpenRex boots up from the on-board SPI Flash (this is defined by eFuses) by default. Sometimes, you may want to boot uBoot from SD card. Follow these steps to do so:
To prepare a SD card, download cfimager (the tool is also included in MFGtools package under Utils\cfimager), download uboot (depending on your board configuration use e.g. 2GB u-boot version). Copy binary directly into the cfimager directory and rename it. Do not forget to change the name of the card reader drive letter (located at the end of the command e.g. G). Use this command in Windows command prompt:
cfimager.exe -raw -offset 0x400 -skip 0x400 -f u-boot.bin -d G
Insert the SD card into the slot – SD2 Interface. Now you have two options.
Option 1 – run this command from uBoot
Use this option if you want to just try the SD boot. After reset, default boot configuration will be used again.
mw.l 0x020d8040 0x3040; mw.l 0x020d8044 0x10000000; reset
Option 2 – reflash SPI with iMX6DQ_SPI_to_uSDHC2.bin
This method will write a special piece of code into the SPI Flash. After reset these changes are still valid.
Download our updated binary iMX6DQ_SPI_to_uSDHC2.bin (or go to original page) to your host machine and place it to the /tftp directory.
cd wget http://www.imx6rex.com/download/released-files/openrex/v1i1/firmware/iMX6DQ_SPI_to_uSDHC2.bin sudo cp -prv iMX6DQ_SPI_to_uSDHC2.bin /tftp
Go to you board and reflash the SPI:
mw.b 0x10800000 0xFF 0x8000;tftp 0x10800000 iMX6DQ_SPI_to_uSDHC2.bin;sf probe 3:2;sf erase 0x0 0x8000;sf write 0x10800000 0x0 0x8000
In case you would like to use the standard SPI uboot again, you need to reflash the SPI back:
mw.b 0x10800000 0xFF 0x80000;tftp 0x10800000 u-boot.bin;sf probe 3:2;sf erase 0x0 0x80000;sf write 0x10800000 0x0 0x80000
Booting printenv examples
Use HDMI as a default video output and SD card as filesystem device
setenv bootargs 'console=ttymxc0,115200' setenv bootcmd_mmc 'run bootargs_mmc; mmc dev 0; ext2load mmc 0 0x10800000 uImage 3850000; bootm 0x10800000' setenv bootargs_mmc 'setenv bootargs ${bootargs} ip=dhcp root=/dev/mmcblk0p1 rootwait video=mxcfb0:dev=hdmi,1280x720M@60,if=RGB666 vmalloc=400M fbmem=28M fbcon=28M' setenv bootcmd 'run bootcmd_mmc' saveenv
Use kernel from SD card and filesystem from SATA hard drive
setenv bootargs 'console=ttymxc0,115200' setenv bootcmd_sata 'run bootargs_sata; mmc dev 0; ext2load mmc 0 0x10800000 uImage 3850000; bootm 0x10800000' setenv bootargs_sata 'setenv bootargs ${bootargs} ip=dhcp root=/dev/sda1 rootwait video=mxcfb0:dev=hdmi,1280x720M@60,if=RGB666 vmalloc=400M fbmem=28M fbcon=28M' setenv bootcmd 'run bootcmd_sata' saveenv