1*3b4410ddSAlexey Brodkin================================================================================ 2*3b4410ddSAlexey BrodkinUseful notes on bulding and using of U-Boot on ARC HS Development Kit (AKA HSDK) 3*3b4410ddSAlexey Brodkin================================================================================ 4*3b4410ddSAlexey Brodkin 5*3b4410ddSAlexey Brodkin BOARD OVERVIEW 6*3b4410ddSAlexey Brodkin 7*3b4410ddSAlexey Brodkin The DesignWare ARC HS Development Kit is a ready-to-use platform for rapid 8*3b4410ddSAlexey Brodkin software development on the ARC HS3x family of processors. 9*3b4410ddSAlexey Brodkin 10*3b4410ddSAlexey Brodkin For more information please visit: 11*3b4410ddSAlexey Brodkin https://www.synopsys.com/dw/ipdir.php?ds=arc-hs-development-kit 12*3b4410ddSAlexey Brodkin 13*3b4410ddSAlexey Brodkin User guide is availalble here: 14*3b4410ddSAlexey Brodkin https://github.com/foss-for-synopsys-dwc-arc-processors/ARC-Development-Systems-Forum/wiki/docs/ARC_HSDK_User_Guide.pdf 15*3b4410ddSAlexey Brodkin 16*3b4410ddSAlexey Brodkin It has the following features useful for U-Boot: 17*3b4410ddSAlexey Brodkin * On-board 2-channel FTDI TTL-to-USB converter 18*3b4410ddSAlexey Brodkin - The first channel is used for serial debug port (which makes it possible 19*3b4410ddSAlexey Brodkin to use a serial connection on pretty much any host machine be it 20*3b4410ddSAlexey Brodkin Windows, Linux or Mac). 21*3b4410ddSAlexey Brodkin On Linux machine typucally FTDI serial port would be /dev/ttyUSB0. 22*3b4410ddSAlexey Brodkin There's no HW flow-control and baud-rate is 115200. 23*3b4410ddSAlexey Brodkin 24*3b4410ddSAlexey Brodkin - The second channel is used for built-in Digilent USB JTAG probe. 25*3b4410ddSAlexey Brodkin That means no extra hardware is required to access ARC core from a 26*3b4410ddSAlexey Brodkin debugger on development host. Both proprietary MetaWare debugger and 27*3b4410ddSAlexey Brodkin open source OpenOCD + GDB client are supported. 28*3b4410ddSAlexey Brodkin 29*3b4410ddSAlexey Brodkin - Also with help of this FTDI chip it is possible to reset entire 30*3b4410ddSAlexey Brodkin board with help of a special `rff-ftdi-reset` utility, see: 31*3b4410ddSAlexey Brodkin https://github.com/foss-for-synopsys-dwc-arc-processors/rff-ftdi-reset 32*3b4410ddSAlexey Brodkin 33*3b4410ddSAlexey Brodkin * Micro SD-card slot 34*3b4410ddSAlexey Brodkin - U-Boot expects to see the very first partition on the card formatted as 35*3b4410ddSAlexey Brodkin FAT file-system and uses it for keeping its environment in `uboot.env` 36*3b4410ddSAlexey Brodkin file. Note uboot.env is not just a text file but it is auto-generated 37*3b4410ddSAlexey Brodkin file created by U-Boot on invocation of `saveenv` command. 38*3b4410ddSAlexey Brodkin It contains a checksum which makes this saved environment invalid in 39*3b4410ddSAlexey Brodkin case of maual modification. 40*3b4410ddSAlexey Brodkin 41*3b4410ddSAlexey Brodkin - There might be more useful files on that first FAT partition like 42*3b4410ddSAlexey Brodkin Linux kernl image in form of uImage (with or without built-in 43*3b4410ddSAlexey Brodkin initramfs), device tree blob (.dtb) etc. 44*3b4410ddSAlexey Brodkin 45*3b4410ddSAlexey Brodkin - Except FAT partition there might be others following the first FAT one 46*3b4410ddSAlexey Brodkin like Ext file-system with rootfs etc. 47*3b4410ddSAlexey Brodkin 48*3b4410ddSAlexey Brodkin * 1 Gb Ethernet socket 49*3b4410ddSAlexey Brodkin - U-Boot might get payload from TFTP server. This might be uImage, rootfs 50*3b4410ddSAlexey Brodkin image and anything else. 51*3b4410ddSAlexey Brodkin 52*3b4410ddSAlexey Brodkin * 2 MiB of SPI-flash 53*3b4410ddSAlexey Brodkin - SPI-flahs is used as a storage for image of an application auto-executed 54*3b4410ddSAlexey Brodkin by bootROM on power-on. Typically U-Boot gets programmed there but 55*3b4410ddSAlexey Brodkin there might be other uses. But note bootROM expects to find a special 56*3b4410ddSAlexey Brodkin header preceeding application image itself so before flashing anything 57*3b4410ddSAlexey Brodkin make sure required image is prepended. In case of U-Boot this is done 58*3b4410ddSAlexey Brodkin by invocation of `headerize-hsdk.py` with `make bsp-generate` command. 59*3b4410ddSAlexey Brodkin 60*3b4410ddSAlexey Brodkin 61*3b4410ddSAlexey Brodkin BUILDING U-BOOT 62*3b4410ddSAlexey Brodkin 63*3b4410ddSAlexey Brodkin 1. Configure U-Boot: 64*3b4410ddSAlexey Brodkin ------------------------->8---------------------- 65*3b4410ddSAlexey Brodkin make hsdk_defconfig 66*3b4410ddSAlexey Brodkin ------------------------->8---------------------- 67*3b4410ddSAlexey Brodkin 68*3b4410ddSAlexey Brodkin 2. To build Elf file (for example to be used with host debugger via JTAG 69*3b4410ddSAlexey Brodkin connection to the target board): 70*3b4410ddSAlexey Brodkin ------------------------->8---------------------- 71*3b4410ddSAlexey Brodkin make mdbtrick 72*3b4410ddSAlexey Brodkin ------------------------->8---------------------- 73*3b4410ddSAlexey Brodkin 74*3b4410ddSAlexey Brodkin This will produce `u-boot` Elf file. 75*3b4410ddSAlexey Brodkin 76*3b4410ddSAlexey Brodkin 3. To build artifacts required for U-Boot update in n-board SPI-flash: 77*3b4410ddSAlexey Brodkin ------------------------->8---------------------- 78*3b4410ddSAlexey Brodkin make bsp-generate 79*3b4410ddSAlexey Brodkin ------------------------->8---------------------- 80*3b4410ddSAlexey Brodkin 81*3b4410ddSAlexey Brodkin This will produce `u-boot.head` and `u-boot-update.scr` which should 82*3b4410ddSAlexey Brodkin be put on the first FAT partition of micro SD-card to be inserted in the 83*3b4410ddSAlexey Brodkin HSDK board. 84*3b4410ddSAlexey Brodkin 85*3b4410ddSAlexey Brodkin 86*3b4410ddSAlexey Brodkin EXECUTING U-BOOT 87*3b4410ddSAlexey Brodkin 88*3b4410ddSAlexey Brodkin 1. The HSDK board is supposed to auto-start U-Boot image stored in on-board 89*3b4410ddSAlexey Brodkin SPI-flash on power-on. For that make sure DIP-switches in the corner of 90*3b4410ddSAlexey Brodkin the board are in their default positions: BIM in 1:off, 2:on state 91*3b4410ddSAlexey Brodkin while both BMC and BCS should be in 1:on, 2:on state. 92*3b4410ddSAlexey Brodkin 93*3b4410ddSAlexey Brodkin 2. Though it is possible to load U-Boot as a simple Elf file via JTAG right 94*3b4410ddSAlexey Brodkin in DDR and start it from the debugger. 95*3b4410ddSAlexey Brodkin 96*3b4410ddSAlexey Brodkin 2.1. In case of proprietary MetaWare debugger run: 97*3b4410ddSAlexey Brodkin ------------------------->8---------------------- 98*3b4410ddSAlexey Brodkin mdb -digilent -run -cl u-boot 99*3b4410ddSAlexey Brodkin ------------------------->8---------------------- 100*3b4410ddSAlexey Brodkin 101*3b4410ddSAlexey Brodkin 102*3b4410ddSAlexey Brodkin UPDATION U-BOOT IMAGE IN ON-BOARD SPI-FLASH 103*3b4410ddSAlexey Brodkin 104*3b4410ddSAlexey Brodkin 1. Create `u-boot.head` and `u-boot-update.scr` as discribed above with 105*3b4410ddSAlexey Brodkin `make bsp-generate` command. 106*3b4410ddSAlexey Brodkin 107*3b4410ddSAlexey Brodkin 2. Copy `u-boot.head` and `u-boot-update.scr` to the first the first FAT 108*3b4410ddSAlexey Brodkin partition of micro SD-card. 109*3b4410ddSAlexey Brodkin 110*3b4410ddSAlexey Brodkin 3. Connect USB cable from the HSDK board to the developemnt host and 111*3b4410ddSAlexey Brodkin fire-up serial terminal. 112*3b4410ddSAlexey Brodkin 113*3b4410ddSAlexey Brodkin 3. Insert prepared micro SD-card in the HSDK board, press reset button 114*3b4410ddSAlexey Brodkin and stop auto-execution of existing `bootcmd` pressing any key in serial 115*3b4410ddSAlexey Brodkin terminal and enter the following command: 116*3b4410ddSAlexey Brodkin ------------------------->8---------------------- 117*3b4410ddSAlexey Brodkin mmc rescan && fatload mmc 0:1 ${loadaddr} u-boot-update.scr && source ${loadaddr} 118*3b4410ddSAlexey Brodkin ------------------------->8---------------------- 119*3b4410ddSAlexey Brodkin Wait before you see "u-boot update: OK" message. 120*3b4410ddSAlexey Brodkin 121*3b4410ddSAlexey Brodkin 4. Press RESET button and enjoy updated U-Boot version. 122