1*a6b8c29fSAlexey Brodkin================================================================================ 2*a6b8c29fSAlexey BrodkinUseful notes on bulding and using of U-Boot on 3*a6b8c29fSAlexey BrodkinARC IoT Development Kit (AKA IoTDK) 4*a6b8c29fSAlexey Brodkin================================================================================ 5*a6b8c29fSAlexey Brodkin 6*a6b8c29fSAlexey Brodkin BOARD OVERVIEW 7*a6b8c29fSAlexey Brodkin 8*a6b8c29fSAlexey Brodkin The DesignWare ARC IoT Development Kit is a versatile platform that includes 9*a6b8c29fSAlexey Brodkin the necessary hardware and software to accelerate software development and 10*a6b8c29fSAlexey Brodkin debugging of sensor fusion, voice recognition and face detection designs. 11*a6b8c29fSAlexey Brodkin 12*a6b8c29fSAlexey Brodkin The ARC IoT Development Kit includes a silicon implementation of the 13*a6b8c29fSAlexey Brodkin ARC Data Fusion IP Subsystem running at 144 MHz on SMIC's 14*a6b8c29fSAlexey Brodkin 55-nm ultra-low power process, and a rich set of peripherals commonly used 15*a6b8c29fSAlexey Brodkin in IoT designs such as USB, UART, SPI, I2C, PWM, SDIO and ADCs. 16*a6b8c29fSAlexey Brodkin 17*a6b8c29fSAlexey Brodkin The board is shipped with pre-installed U-Boot in non-volatile memory 18*a6b8c29fSAlexey Brodkin (eFlash) so on power-on user sees U-Boot start header and command line 19*a6b8c29fSAlexey Brodkin prompt which might be used for U-Boot environment fine-tuning, manual 20*a6b8c29fSAlexey Brodkin loading and execution of user application binaries etc. 21*a6b8c29fSAlexey Brodkin 22*a6b8c29fSAlexey Brodkin The board has the following features useful for U-Boot: 23*a6b8c29fSAlexey Brodkin * On-board 2-channel FTDI TTL-to-USB converter 24*a6b8c29fSAlexey Brodkin - The first channel is used for serial debug port (which makes it possible 25*a6b8c29fSAlexey Brodkin to use a serial connection on pretty much any host machine be it 26*a6b8c29fSAlexey Brodkin Windows, Linux or Mac). 27*a6b8c29fSAlexey Brodkin On Linux machine typucally FTDI serial port would be /dev/ttyUSB0. 28*a6b8c29fSAlexey Brodkin There's no HW flow-control and baud-rate is 115200. 29*a6b8c29fSAlexey Brodkin 30*a6b8c29fSAlexey Brodkin - The second channel is used for built-in Digilent USB JTAG probe. 31*a6b8c29fSAlexey Brodkin That means no extra hardware is required to access ARC core from a 32*a6b8c29fSAlexey Brodkin debugger on development host. Both proprietary MetaWare debugger and 33*a6b8c29fSAlexey Brodkin open source OpenOCD + GDB client are supported. 34*a6b8c29fSAlexey Brodkin 35*a6b8c29fSAlexey Brodkin - Also with help of this FTDI chip it is possible to reset entire 36*a6b8c29fSAlexey Brodkin board with help of a special `rff-ftdi-reset` utility, see: 37*a6b8c29fSAlexey Brodkin https://github.com/foss-for-synopsys-dwc-arc-processors/rff-ftdi-reset 38*a6b8c29fSAlexey Brodkin 39*a6b8c29fSAlexey Brodkin * Micro SD-card slot 40*a6b8c29fSAlexey Brodkin - U-Boot expects to see the very first partition on the card formatted as 41*a6b8c29fSAlexey Brodkin FAT file-system and uses it for keeping its environment in `uboot.env` 42*a6b8c29fSAlexey Brodkin file. Note uboot.env is not just a text file but it is auto-generated 43*a6b8c29fSAlexey Brodkin file created by U-Boot on invocation of `saveenv` command. 44*a6b8c29fSAlexey Brodkin It contains a checksum which makes this saved environment invalid in 45*a6b8c29fSAlexey Brodkin case of maual modification. 46*a6b8c29fSAlexey Brodkin 47*a6b8c29fSAlexey Brodkin - There might be more useful files on that first FAT partition like 48*a6b8c29fSAlexey Brodkin user applications, data files etc. 49*a6b8c29fSAlexey Brodkin 50*a6b8c29fSAlexey Brodkin * USB OTG connector 51*a6b8c29fSAlexey Brodkin - U-Boot may access USB mass-storage devices attached to this connector. 52*a6b8c29fSAlexey Brodkin Note only FAT file-system is supported. It might be used for storing 53*a6b8c29fSAlexey Brodkin user application binaries as well as micro SD-card mentioned above. 54*a6b8c29fSAlexey Brodkin 55*a6b8c29fSAlexey Brodkin * The following memories are avaialble on the board: 56*a6b8c29fSAlexey Brodkin - eFlash: 256 KiB @ 0x0000_0000 57*a6b8c29fSAlexey Brodkin A non-volatile memory from which ARC core may execute code directly. 58*a6b8c29fSAlexey Brodkin Still is is not direcly writable, thus this is not an ordinary RAM. 59*a6b8c29fSAlexey Brodkin 60*a6b8c29fSAlexey Brodkin - ICCM: 256 KiB @ 0x2000_0000 61*a6b8c29fSAlexey Brodkin Instruction Closely Coupled Memory - fast on-chip memory primary used 62*a6b8c29fSAlexey Brodkin for code being executed, still data could be placed in this memory too. 63*a6b8c29fSAlexey Brodkin In that sense it's just a general purpose RAM. 64*a6b8c29fSAlexey Brodkin 65*a6b8c29fSAlexey Brodkin - SRAM: 128 KiB @ 0x3000_0000 66*a6b8c29fSAlexey Brodkin On-chip SRAM. From user perspective is the same as ICCM above. 67*a6b8c29fSAlexey Brodkin 68*a6b8c29fSAlexey Brodkin - DCCM: 128 KiB @ 0x8000_0000 69*a6b8c29fSAlexey Brodkin Data Closely Coupled Memory is similar to ICCM with a major difference - 70*a6b8c29fSAlexey Brodkin ARC core cannot execute code from DCCM. So this is very special RAM 71*a6b8c29fSAlexey Brodkin only suitable for data. 72*a6b8c29fSAlexey Brodkin 73*a6b8c29fSAlexey Brodkin BUILDING U-BOOT 74*a6b8c29fSAlexey Brodkin 75*a6b8c29fSAlexey Brodkin 1. Configure U-Boot: 76*a6b8c29fSAlexey Brodkin ------------------------->8---------------------- 77*a6b8c29fSAlexey Brodkin make iot_devkit_defconfig 78*a6b8c29fSAlexey Brodkin ------------------------->8---------------------- 79*a6b8c29fSAlexey Brodkin 80*a6b8c29fSAlexey Brodkin 2. To build Elf file (for example to be used with host debugger via JTAG 81*a6b8c29fSAlexey Brodkin connection to the target board): 82*a6b8c29fSAlexey Brodkin ------------------------->8---------------------- 83*a6b8c29fSAlexey Brodkin make mdbtrick 84*a6b8c29fSAlexey Brodkin ------------------------->8---------------------- 85*a6b8c29fSAlexey Brodkin 86*a6b8c29fSAlexey Brodkin This will produce `u-boot` Elf file. 87*a6b8c29fSAlexey Brodkin 88*a6b8c29fSAlexey Brodkin 3. To build binary image to be put in "ROM": 89*a6b8c29fSAlexey Brodkin ------------------------->8---------------------- 90*a6b8c29fSAlexey Brodkin make u-boot.bin 91*a6b8c29fSAlexey Brodkin ------------------------->8---------------------- 92*a6b8c29fSAlexey Brodkin 93*a6b8c29fSAlexey Brodkin 94*a6b8c29fSAlexey Brodkin EXECUTING U-BOOT 95*a6b8c29fSAlexey Brodkin 96*a6b8c29fSAlexey Brodkin 1. The IoTDK board is supposed to auto-start U-Boot image stored in eFlash on 97*a6b8c29fSAlexey Brodkin power-on. Note it's possible to update that image - follow instructions in 98*a6b8c29fSAlexey Brodkin user's manual. 99*a6b8c29fSAlexey Brodkin 100*a6b8c29fSAlexey Brodkin 2. Though it is possible to load and start U-Boot as a simple Elf file 101*a6b8c29fSAlexey Brodkin via JTAG right in ICCM. For that it's required to re-configure U-Boot 102*a6b8c29fSAlexey Brodkin so it gets linked to ICCM address 0x2000_0000 (remember eFlash is not 103*a6b8c29fSAlexey Brodkin direcly writable). 104*a6b8c29fSAlexey Brodkin Run U-Boot's configuration utility with "make menuconfig", go to 105*a6b8c29fSAlexey Brodkin "Boot images" and change "Text Base" from default 0x00000000 to 106*a6b8c29fSAlexey Brodkin 0x20000000. Exit & save new configuration. Now run "make mdbtrick" to 107*a6b8c29fSAlexey Brodkin build new Elf. 108*a6b8c29fSAlexey Brodkin 109*a6b8c29fSAlexey Brodkin 2.1. In case of proprietary MetaWare debugger run: 110*a6b8c29fSAlexey Brodkin ------------------------->8---------------------- 111*a6b8c29fSAlexey Brodkin mdb -digilent u-boot 112*a6b8c29fSAlexey Brodkin ------------------------->8---------------------- 113*a6b8c29fSAlexey Brodkin 114*a6b8c29fSAlexey Brodkin USING U-BOOT 115*a6b8c29fSAlexey Brodkin 116*a6b8c29fSAlexey Brodkin Note due to limited memory size it's supposed that user will run binary 117*a6b8c29fSAlexey Brodkin images of their applications instead of loading Elf files. 118*a6b8c29fSAlexey Brodkin 119*a6b8c29fSAlexey Brodkin 1. To load and start application binary from micro SD-card execute 120*a6b8c29fSAlexey Brodkin the following commands in U-Boot's shell: 121*a6b8c29fSAlexey Brodkin ------------------------->8---------------------- 122*a6b8c29fSAlexey Brodkin fatload mmc 0 0x20000000 yourapp.bin 123*a6b8c29fSAlexey Brodkin go 0x20000000 124*a6b8c29fSAlexey Brodkin ------------------------->8---------------------- 125*a6b8c29fSAlexey Brodkin 126*a6b8c29fSAlexey Brodkin 2. To load and start application binary from USB mass-storage device execute 127*a6b8c29fSAlexey Brodkin the following commands in U-Boot's shell: 128*a6b8c29fSAlexey Brodkin ------------------------->8---------------------- 129*a6b8c29fSAlexey Brodkin usb start 130*a6b8c29fSAlexey Brodkin fatload usb 0x20000000 yourapp.bin 131*a6b8c29fSAlexey Brodkin go 0x20000000 132*a6b8c29fSAlexey Brodkin ------------------------->8---------------------- 133*a6b8c29fSAlexey Brodkin 134*a6b8c29fSAlexey Brodkin 3. To have a sequence of commands executed on U-Boot start put those 135*a6b8c29fSAlexey Brodkin commands in "bootcmd" with semicolon between them. 136*a6b8c29fSAlexey Brodkin For example to get (1) done automatically: 137*a6b8c29fSAlexey Brodkin ------------------------->8---------------------- 138*a6b8c29fSAlexey Brodkin setenv bootcmd fatload mmc 0 0x20000000 yourapp.bin\; go 0x20000000 139*a6b8c29fSAlexey Brodkin saveenv 140*a6b8c29fSAlexey Brodkin ------------------------->8---------------------- 141*a6b8c29fSAlexey Brodkin 142*a6b8c29fSAlexey Brodkin 4. To reboot the board just run: 143*a6b8c29fSAlexey Brodkin ------------------------->8---------------------- 144*a6b8c29fSAlexey Brodkin reset 145*a6b8c29fSAlexey Brodkin ------------------------->8---------------------- 146