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