In our previous post, we have explored basic details about Introduction to Provisioning and it’s needs. In this post we will narrow down our use case and experiment how it works. As mentioned in our previous post, we will use
Hardware: Phytec Phycore imx6UL/ULL SoM
We will assume that the hardware is shipped without any software (bootloader). If the hardware is shipped with Bootloader and BSP, then we need to force the hardware to boot from Serial Download Mode (SDP) using boot switch. Refer to imx6UL/ULL datasheet and Technical Reference manual to know more about boot mode selection.
imx6UL/ULL primarily comes with 2 USB OTG controllers and to use SDP, we need to use OTG1 controller. Setup to get into SDP is,
- Connect the USB OTG to the host machine (Raspberry PI in our case)
- Connect debug UART to see the functional booting of the target
When in SDP mode, connecting USB OTG enumerates the Freescale imx6UL/ULL device below (seen using
Bus 001 Device 007: ID 15a2:0080 Freescale Semiconductor, Inc.
When expanded with we have,
To detail, Freescale USB device enumerated with one configuration with one Interrupt Endpoint. SDP protocol uses this USB configuration (interrupt endpoint) to communicate with the SoC and upload images over USB. This is implemented as open source imx_usb_loader. In our case, I have cloned and compiled the latest version from Github. This utility depends on libusb.
The most important part of imx USB loader is imx_usb.conf,
pi@raspberrypi:~/imx_usb_loader $ cat imx_usb.conf
which stores the USB Vendor ID and Product ID and use respective configuration. Highlighted in RED is the Phytec’s imx6ULL SoC.
Loading U-boot bootloader image:
We are going to compile and load U-Boot using imx_usb_loader. To do so, we need to compile u-boot with SDP support. The mainline U-Boot version supports our board Phycore imx6UL/ULL and SDP is implemented as part of U-Boot. Please refer steps to compile u-boot and configuration option for your board/SoC in U-Boot documentation.
make ARCH=arm menuconfig
enable SDP in SPL and also in U-Boot and cross compile for ARM. Outcome of the compilation will be two images,
- SPL – Secondary Program Loader (Executed directly by imx6 ROM Code)
- U-Boot proper – Loaded by SPL
To load SPL first using imx_usb_loader,
sudo ./imx_usb ./SPL ./imx_usb.conf
which will load SPL into RAM and imx6 ROM code will start it. The next step is to load the U-Boot proper using,
sudo ./imx_usb ./u-boot-dtb.img ./imx_usb.conf
We can observe the same in imx6 targets UART Debug console,
U-Boot SPL 2019.10-00341-gffc379b42c-dirty (Oct 26 2019 - 21:54:46 +0200)
Trying to boot from USB SDP
SDP: handle requests...
Downloading file of size 382 to 0x81000000... done
Downloading file of size 22262368 to 0x82000000... done
Downloading file of size 410113 to 0x877fffc0... done
Jumping to header at 0x877fffc0
Header Tag is not an IMX image
U-Boot 2019.10-00341-gffc379b42c-dirty (Oct 26 2019 - 21:54:46 +0200)
CPU: Freescale i.MX6ULL rev1.0 792 MHz (running at 396 MHz)
CPU: Industrial temperature grade (-40C to 105C) at 46C
Reset cause: POR
Model: Phytec phyBOARD-i.MX6ULL-Segin SBC
Board: PHYTEC phyCORE-i.MX6ULL
DRAM: 256 MiB
MMC: FSL_SDHC: 0, FSL_SDHC: 1
Warning: ethernet@2188000 using MAC address from ROM
Hit any key to stop autoboot: 0
In this post we have viewed the basic details about SDP and it’s working when loading U-Boot using imx_usb_loader. In the next post we will explore in details about the Vendor ID and Product ID usage in U-Boot proper and relative configuration in imx_usb_load. This will help further to achieve our goal of automated flashing.