13b4410ddSAlexey Brodkin================================================================================ 23b4410ddSAlexey BrodkinUseful notes on bulding and using of U-Boot on ARC HS Development Kit (AKA HSDK) 33b4410ddSAlexey Brodkin================================================================================ 43b4410ddSAlexey Brodkin 53b4410ddSAlexey Brodkin BOARD OVERVIEW 63b4410ddSAlexey Brodkin 73b4410ddSAlexey Brodkin The DesignWare ARC HS Development Kit is a ready-to-use platform for rapid 83b4410ddSAlexey Brodkin software development on the ARC HS3x family of processors. 93b4410ddSAlexey Brodkin 103b4410ddSAlexey Brodkin For more information please visit: 113b4410ddSAlexey Brodkin https://www.synopsys.com/dw/ipdir.php?ds=arc-hs-development-kit 123b4410ddSAlexey Brodkin 133b4410ddSAlexey Brodkin User guide is availalble here: 143b4410ddSAlexey Brodkin https://github.com/foss-for-synopsys-dwc-arc-processors/ARC-Development-Systems-Forum/wiki/docs/ARC_HSDK_User_Guide.pdf 153b4410ddSAlexey Brodkin 163b4410ddSAlexey Brodkin It has the following features useful for U-Boot: 173b4410ddSAlexey Brodkin * On-board 2-channel FTDI TTL-to-USB converter 183b4410ddSAlexey Brodkin - The first channel is used for serial debug port (which makes it possible 193b4410ddSAlexey Brodkin to use a serial connection on pretty much any host machine be it 203b4410ddSAlexey Brodkin Windows, Linux or Mac). 213b4410ddSAlexey Brodkin On Linux machine typucally FTDI serial port would be /dev/ttyUSB0. 223b4410ddSAlexey Brodkin There's no HW flow-control and baud-rate is 115200. 233b4410ddSAlexey Brodkin 243b4410ddSAlexey Brodkin - The second channel is used for built-in Digilent USB JTAG probe. 253b4410ddSAlexey Brodkin That means no extra hardware is required to access ARC core from a 263b4410ddSAlexey Brodkin debugger on development host. Both proprietary MetaWare debugger and 273b4410ddSAlexey Brodkin open source OpenOCD + GDB client are supported. 283b4410ddSAlexey Brodkin 293b4410ddSAlexey Brodkin - Also with help of this FTDI chip it is possible to reset entire 303b4410ddSAlexey Brodkin board with help of a special `rff-ftdi-reset` utility, see: 313b4410ddSAlexey Brodkin https://github.com/foss-for-synopsys-dwc-arc-processors/rff-ftdi-reset 323b4410ddSAlexey Brodkin 333b4410ddSAlexey Brodkin * Micro SD-card slot 343b4410ddSAlexey Brodkin - U-Boot expects to see the very first partition on the card formatted as 353b4410ddSAlexey Brodkin FAT file-system and uses it for keeping its environment in `uboot.env` 363b4410ddSAlexey Brodkin file. Note uboot.env is not just a text file but it is auto-generated 373b4410ddSAlexey Brodkin file created by U-Boot on invocation of `saveenv` command. 383b4410ddSAlexey Brodkin It contains a checksum which makes this saved environment invalid in 393b4410ddSAlexey Brodkin case of maual modification. 403b4410ddSAlexey Brodkin 413b4410ddSAlexey Brodkin - There might be more useful files on that first FAT partition like 423b4410ddSAlexey Brodkin Linux kernl image in form of uImage (with or without built-in 433b4410ddSAlexey Brodkin initramfs), device tree blob (.dtb) etc. 443b4410ddSAlexey Brodkin 453b4410ddSAlexey Brodkin - Except FAT partition there might be others following the first FAT one 463b4410ddSAlexey Brodkin like Ext file-system with rootfs etc. 473b4410ddSAlexey Brodkin 483b4410ddSAlexey Brodkin * 1 Gb Ethernet socket 493b4410ddSAlexey Brodkin - U-Boot might get payload from TFTP server. This might be uImage, rootfs 503b4410ddSAlexey Brodkin image and anything else. 513b4410ddSAlexey Brodkin 523b4410ddSAlexey Brodkin * 2 MiB of SPI-flash 533b4410ddSAlexey Brodkin - SPI-flahs is used as a storage for image of an application auto-executed 543b4410ddSAlexey Brodkin by bootROM on power-on. Typically U-Boot gets programmed there but 553b4410ddSAlexey Brodkin there might be other uses. But note bootROM expects to find a special 563b4410ddSAlexey Brodkin header preceeding application image itself so before flashing anything 573b4410ddSAlexey Brodkin make sure required image is prepended. In case of U-Boot this is done 583b4410ddSAlexey Brodkin by invocation of `headerize-hsdk.py` with `make bsp-generate` command. 593b4410ddSAlexey Brodkin 603b4410ddSAlexey Brodkin 613b4410ddSAlexey Brodkin BUILDING U-BOOT 623b4410ddSAlexey Brodkin 633b4410ddSAlexey Brodkin 1. Configure U-Boot: 643b4410ddSAlexey Brodkin ------------------------->8---------------------- 653b4410ddSAlexey Brodkin make hsdk_defconfig 663b4410ddSAlexey Brodkin ------------------------->8---------------------- 673b4410ddSAlexey Brodkin 683b4410ddSAlexey Brodkin 2. To build Elf file (for example to be used with host debugger via JTAG 693b4410ddSAlexey Brodkin connection to the target board): 703b4410ddSAlexey Brodkin ------------------------->8---------------------- 713b4410ddSAlexey Brodkin make mdbtrick 723b4410ddSAlexey Brodkin ------------------------->8---------------------- 733b4410ddSAlexey Brodkin 743b4410ddSAlexey Brodkin This will produce `u-boot` Elf file. 753b4410ddSAlexey Brodkin 763b4410ddSAlexey Brodkin 3. To build artifacts required for U-Boot update in n-board SPI-flash: 773b4410ddSAlexey Brodkin ------------------------->8---------------------- 783b4410ddSAlexey Brodkin make bsp-generate 793b4410ddSAlexey Brodkin ------------------------->8---------------------- 803b4410ddSAlexey Brodkin 813b4410ddSAlexey Brodkin This will produce `u-boot.head` and `u-boot-update.scr` which should 823b4410ddSAlexey Brodkin be put on the first FAT partition of micro SD-card to be inserted in the 833b4410ddSAlexey Brodkin HSDK board. 843b4410ddSAlexey Brodkin 85*164abd17SAlexey Brodkin Note that Python3 script is used for generation of a header, thus 86*164abd17SAlexey Brodkin to get that done it's required to have Python3 with elftools installed. 87*164abd17SAlexey Brodkin On CentOS/RHEL/Fedora this could be installed with: 88*164abd17SAlexey Brodkin ------------------------->8---------------------- 89*164abd17SAlexey Brodkin sudo dnf install python3-pyelftools 90*164abd17SAlexey Brodkin ------------------------->8---------------------- 913b4410ddSAlexey Brodkin 923b4410ddSAlexey Brodkin EXECUTING U-BOOT 933b4410ddSAlexey Brodkin 943b4410ddSAlexey Brodkin 1. The HSDK board is supposed to auto-start U-Boot image stored in on-board 953b4410ddSAlexey Brodkin SPI-flash on power-on. For that make sure DIP-switches in the corner of 963b4410ddSAlexey Brodkin the board are in their default positions: BIM in 1:off, 2:on state 973b4410ddSAlexey Brodkin while both BMC and BCS should be in 1:on, 2:on state. 983b4410ddSAlexey Brodkin 993b4410ddSAlexey Brodkin 2. Though it is possible to load U-Boot as a simple Elf file via JTAG right 1003b4410ddSAlexey Brodkin in DDR and start it from the debugger. 1013b4410ddSAlexey Brodkin 1023b4410ddSAlexey Brodkin 2.1. In case of proprietary MetaWare debugger run: 1033b4410ddSAlexey Brodkin ------------------------->8---------------------- 1043b4410ddSAlexey Brodkin mdb -digilent -run -cl u-boot 1053b4410ddSAlexey Brodkin ------------------------->8---------------------- 1063b4410ddSAlexey Brodkin 1073b4410ddSAlexey Brodkin 1083b4410ddSAlexey Brodkin UPDATION U-BOOT IMAGE IN ON-BOARD SPI-FLASH 1093b4410ddSAlexey Brodkin 1103b4410ddSAlexey Brodkin 1. Create `u-boot.head` and `u-boot-update.scr` as discribed above with 1113b4410ddSAlexey Brodkin `make bsp-generate` command. 1123b4410ddSAlexey Brodkin 113*164abd17SAlexey Brodkin 2. Copy `u-boot.head` and `u-boot-update.scr` to the first FAT partition 114*164abd17SAlexey Brodkin of micro SD-card. 1153b4410ddSAlexey Brodkin 1163b4410ddSAlexey Brodkin 3. Connect USB cable from the HSDK board to the developemnt host and 1173b4410ddSAlexey Brodkin fire-up serial terminal. 1183b4410ddSAlexey Brodkin 1193b4410ddSAlexey Brodkin 3. Insert prepared micro SD-card in the HSDK board, press reset button 1203b4410ddSAlexey Brodkin and stop auto-execution of existing `bootcmd` pressing any key in serial 1213b4410ddSAlexey Brodkin terminal and enter the following command: 1223b4410ddSAlexey Brodkin ------------------------->8---------------------- 1233b4410ddSAlexey Brodkin mmc rescan && fatload mmc 0:1 ${loadaddr} u-boot-update.scr && source ${loadaddr} 1243b4410ddSAlexey Brodkin ------------------------->8---------------------- 1253b4410ddSAlexey Brodkin Wait before you see "u-boot update: OK" message. 1263b4410ddSAlexey Brodkin 1273b4410ddSAlexey Brodkin 4. Press RESET button and enjoy updated U-Boot version. 128