KRIA K26 production SOM is equipped with eMMC non-volatile memory and differs in that from starter kits SOMs. the project addresses programming the eMMC memory using KR260 video starter kit petalinux BSP with modifications enabling eMMC flash memory recognition.
Attached binary files allow to flash eMMC memory skipping code/projects modification stages.
The project is update of my previous one for KV260 (K26 eMMC linux image programming with kv260 carrier card), addressing KR260 carrier card
Hardware setupDisconnect red fan power cable from connector on the KR260 kit Carrier Card (CC). Unscrew and remove SOM with black fan from from the CC.
assembled KR260 starter kit
KR260 starter kit with unmounted SOM (one 240 ways connector)
Mount production K26 SOM to the CC, please notice the SOM orientation: white markers on the SOM have to be aligned with the same markers on the CC on both sides of the 240 way connector.
production K26 SOM (two 240 ways connectors)
KR260 Carier Card with K26 production SOM
K26 boot sequenceWe are going to flash eMMC memory from linux which has to be loaded by Second Stage Boot Loader (SSBL) u-boot, which will be loaded by First Stage Boot Loader (FSBL).
One of the ways to organize the process is to follow KR260 starter kit boot process flashing bootloaders file (BOOT.BIN) into QSPI memory and leveraging QSPI boot mode hardwired in the KR260 CC.
K26 SOM comes with empty QSPI memory. We can load prebuilt BOOT.BIN from the SOM or starter kit petalinux BSP but the former one doesn't recognize SD card while the latest disables eMMC memory. Therefor we have to modify bootloaders to enable both SD card to load linux and eMMC to flash the memory.
PS configurationMPSoC Processing System (PS) includes controllers for the peripherals of interest: eMMC card, SD card and USB. Xilinx distributes petalinux BSP with vivado project and we are going to modify the project to enable eMMC card in the KR260 starter kit petalinux.
Download the Kria K26 Starter Kit 2023.1 BSP from the PetaLinux Download link.
Initialize toolchain, create petalinux project from the BSP and enter the created project directory:
source /tools/Xilinx/Vitis/2023.1/settings64.sh
source /tools/Xilinx/petalinux/2023.1/settings.sh
petalinux-create -t project -n plnx2023_1_kr260 -s ./xilinx-kr260-starterkit-v2023.1-05080224.bsp
cd plnx2023_1_kr260
Open
vivado project (in 'hardware' directory) with the tool
'tree -L 2 hardware' output, there is.xpr vivado project file
vivado hardware/xilinx-kr260-starterkit-2023.1/kr260_starter_kit.xpr &
'Open Block Design' and double-click PS IP "ZYNQ UltraSCALE+" to modify its configuration
'SD 0 / eMMC' is disabled
Enable 'SD 0 / eMMC' and configure the peripheral controller to eMMC on pins 'MIO 13.. 22' (as it's configured in the production SOM petalinux BSP)
enabled and configured 'SD 0 / eMMC'
'Generate Bitstream' and File->Export Hardware to XSA file 'including bitstream'
Petalinux adaptationWe update the petalinux/yocto project with modified XSA file by means of
petalinux-config --get-hw-description=<path to the modified XSA file containing directory>
Overall the commands are
petalinux-config --get-hw-description=./hardware/xilinx-kr260-starterkit-2023.1/kr260_starter_kit_wrapper.xsa --silentconfig
petalinux-build
petalinux-package --boot --u-boot --force
petalinux-package --wic --images-dir images/linux/ --bootfiles "ramdisk.cpio.gz.u-boot,boot.scr,Image,system.dtb,system-zynqmp-sck-kr-g-revB.dtb" --disk-name "sda"
see notes for 2023.1 BSP on KRIA wiki page
The petalinux-package commands generate BOOT.BIN and petalinux-sdimage.wic(SD card linux image) files in images/linux directory. Compression of the image files reduces its size from 6GB to less than 300MB
gzip images/linux/petalinux-sdimage.wic
Built files reviewNow we have 3 following files in images/linux directory and we are ready to program production SOM non-volatile memory.
- BOOT.BIN (bootloaders file)
- petalinux-sdimage.wic.gz(compressed linux image)
- zynqmp_fsbl.elf (First Stage Boot Loader, the same as in the BOOT.BIN)
Apparently there are 2 ways to flash QSPI EEPROM while the memory is empty, it's the situation with new K26 SOM which was not used before.
- First method is described in the Firmware - QSPI to eMMC boot for Production SOM (section "Program QSPI using XSDB/XSCT and u-boot") with XSDB command line tool
- Alternative method is to open vivado (any version and OS, I used 2022.1 in Win10 64 bit) and Flow->Open Hardware Manager
Power up KR260 CC with K26 SOM connected to the PC with uUSB cable (JTAG and UART).
Open Target -> Auto connect in the Hardware Manager
connect Hardware Manager to MPSoC on the SoM
Add Configuration Memory Device to the xck26_0
adding QSPI flash to Hardware Manager
Choosemt25ql512-qspi-x4-single for "configuration memory part" which is equivalent to the QSPI memory on the SOM
QSPI flash part choice
and proceed to (re)program the QSPI flash memory
Point next dialog window to the modified BOOT.BIN(bootloaders file) and FSBL that was created by petalinux tool and flash the QSPI memory
bootloaders files choice
- If you flashed the QSPI EEPROM with BOOT.BIN containing u-boot, the 2 methods above will fail to stop A53 processor and get hold of it, however you can load new BOOT.BIN into DDR/RAM and flash it to the EEPOM by means of the u-boot tool (final part of 1st method tutorial)
SD card can be prepared with Balena Etcher (Win10 or Linux) and image file (it compressed with gzip)
SD card flashing tool
Image file petalinux-sdimage.wic.gz for flashing to eMMC memory can be copied to the SD card 1st partition (FAT32)
K26 SOM eMMC linux image preparationWe'll change a bit petalinux project to adapt it for eMMC flashing: K26 SOM petalinux BSP is 'eMMC aware', but it's not 'SD aware' because there is no SD card reader on the SOM (it's on the Carrier Card in KR260)
petalinux-config
in the Image Packaging Configuration we choose EXT4 partition on /dev/mmcblk0p2
and prepare the updated boot image
petalinux-package --wic --images-dir images/linux/ --bootfiles "ramdisk.cpio.gz.u-boot,boot.scr,Image,system.dtb,system-zynqmp-sck-kr-g-revB.dtb" --disk-name "mmcblk0"
gzip -c images/linux/petalinux-sdimage.wic > petalinux-sdimage_mmcblk0p2.wic.gz
Apparently we start from 'eMMC aware' petalinux configuration in this step, and equip it with 'SD awareness' to be able to read image file with which we'll flash eMMC memory.
K26 SOM eMMC memory programmingPlug in SD card into KR260 CC and power it up, login into linux and flash eMMC with the commands like the following (1st SD card partition, formatted FAT32, is mounted to /boot directory)
sudo su
gunzip -c /boot/petalinux-sdimage_mmcblk0p2.wic.gz | dd of=/dev/mmcblk0
u-boot environment file boot.scr on the QSPI EEPROM contains sophisticated script looping over boot media devices to looks for linux, therefore we need just to unplug SD card and power up KR260 CC: the device will fail to find linux installation on SD card and proceed to eMMC flash itself, we don't need to re-flash QSPI memory.
please notice the /dev/mmvcblk0p01 and /dev/mmvcblk0p02 partitions while there is no /dev/sda this time
NotesI didn't try to load BOOT.BIN over JTAG with petalinux-boot, it requires linux machine to be connected to the KR260 CC, but it can be alternative method avoiding QSPI memory flashing with SD card aware bootloaders file.
Comments
Please log in or sign up to comment.