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