How to Update U-Boot on pico-imx6q/dl boards
--------------------------------------------

Required software on the host PC:

- UUU: https://github.com/NXPmicro/mfgtools

Build U-Boot for pico:

$ make mrproper
$ make pico-imx6_defconfig
$ make

This generates the SPL and u-boot-dtb.img binaries.

1. Loading U-Boot via USB Serial Download Protocol

Note: This method is convenient for development purposes.
If the eMMC has already a U-Boot flashed then the user can
go to step 2 below in order to update U-Boot.

Put pico board in USB download mode (Refer to the following link for details:
https://www.technexion.com/support/knowledgebase/boot-configuration-settings-for-pico-baseboards/).

Connect a USB to serial adapter between the host PC and pico.

Connect a USB cable between the OTG pico port and the host PC.

Open a terminal program such as minicom.

Copy SPL and u-boot-dtb.img to the uuu folder.

Load the U-Boot via USB:

$ sudo ./uuu -v uuu_script

where uuu_script contains the following:

SDP:  boot -f SPL
SDPU: write -f u-boot-dtb.img -addr 0x10000000
SDPU: jump -addr 0x10000000

Then U-Boot starts and its messages appear in the console program.

Use the default environment variables:

=> env default -f -a
=> saveenv

2. Flashing U-Boot into the eMMC

The  default  U-Boot   environment  expects  the  use   of  eMMC  user
partition. To ensure we are using  the proper eMMC partition for boot,
please run:

=> mmc partconf 0 0 0 0

Next, run the DFU agent so we can flash the new images using dfu-util
tool:

=> dfu 0 mmc 0

Flash SPL and u-boot-dtb.img into the eMMC running the following commands on a PC:

$ sudo dfu-util -D SPL -a spl

$ sudo dfu-util -D u-boot-dtb.img -a u-boot

Remove power from the pico board.

Put pico board into normal boot mode.

Power up the board and the new updated U-Boot should boot from eMMC.
