Rick Chen | f981e66 | 2018-05-29 10:29:20 +0800 | [diff] [blame] | 1 | Andes Technology SoC AE350 |
Rick Chen | 3fafced | 2017-12-26 13:55:59 +0800 | [diff] [blame] | 2 | =========================== |
| 3 | |
Rick Chen | f981e66 | 2018-05-29 10:29:20 +0800 | [diff] [blame] | 4 | AE350 is the mainline SoC produced by Andes Technology using AX25 CPU core |
Rick Chen | 3fafced | 2017-12-26 13:55:59 +0800 | [diff] [blame] | 5 | base on RISC-V architecture. |
| 6 | |
Rick Chen | f981e66 | 2018-05-29 10:29:20 +0800 | [diff] [blame] | 7 | AE350 has integrated both AHB and APB bus and many periphals for application |
Rick Chen | 3fafced | 2017-12-26 13:55:59 +0800 | [diff] [blame] | 8 | and product development. |
| 9 | |
Rick Chen | f981e66 | 2018-05-29 10:29:20 +0800 | [diff] [blame] | 10 | AX25-AE350 |
Rick Chen | 3fafced | 2017-12-26 13:55:59 +0800 | [diff] [blame] | 11 | ========= |
| 12 | |
Rick Chen | f981e66 | 2018-05-29 10:29:20 +0800 | [diff] [blame] | 13 | AX25-AE350 is the SoC with AE350 hardcore CPU. |
Rick Chen | 3fafced | 2017-12-26 13:55:59 +0800 | [diff] [blame] | 14 | |
| 15 | Configurations |
| 16 | ============== |
| 17 | |
| 18 | CONFIG_SKIP_LOWLEVEL_INIT: |
| 19 | If you want to boot this system from SPI ROM and bypass e-bios (the |
| 20 | other boot loader on ROM). You should undefine CONFIG_SKIP_LOWLEVEL_INIT |
Rick Chen | f981e66 | 2018-05-29 10:29:20 +0800 | [diff] [blame] | 21 | in "include/configs/ax25-ae350.h". |
Rick Chen | 3fafced | 2017-12-26 13:55:59 +0800 | [diff] [blame] | 22 | |
| 23 | Build and boot steps |
| 24 | ==================== |
| 25 | |
| 26 | build: |
| 27 | 1. Prepare the toolchains and make sure the $PATH to toolchains is correct. |
Rick Chen | f981e66 | 2018-05-29 10:29:20 +0800 | [diff] [blame] | 28 | 2. Use `make ax25-ae350_defconfig` in u-boot root to build the image. |
Rick Chen | 3fafced | 2017-12-26 13:55:59 +0800 | [diff] [blame] | 29 | |
| 30 | Verification |
| 31 | ==================== |
| 32 | |
| 33 | Target |
| 34 | ==================== |
| 35 | 1. startup |
| 36 | 2. relocation |
| 37 | 3. timer driver |
| 38 | 4. uart driver |
| 39 | 5. mac driver |
| 40 | 6. mmc driver |
| 41 | 7. spi driver |
| 42 | |
| 43 | Steps |
| 44 | ==================== |
| 45 | 1. Define CONFIG_SKIP_LOWLEVEL_INIT to build u-boot which is loaded via gdb from ram. |
| 46 | 2. Undefine CONFIG_SKIP_LOWLEVEL_INIT to build u-boot which is booted from spi rom. |
| 47 | 3. Ping a server by mac driver |
| 48 | 4. Scan sd card and copy u-boot image which is booted from flash to ram by sd driver. |
| 49 | 5. Burn this u-boot image to spi rom by spi driver |
| 50 | 6. Re-boot u-boot from spi flash with power off and power on. |
| 51 | |
Rick Chen | f981e66 | 2018-05-29 10:29:20 +0800 | [diff] [blame] | 52 | Messages of U-Boot boot on AE350 board |
Rick Chen | fcc7a07 | 2018-03-13 15:24:03 +0800 | [diff] [blame] | 53 | ====================================== |
Rick Chen | 3fafced | 2017-12-26 13:55:59 +0800 | [diff] [blame] | 54 | U-Boot 2018.01-rc2-00033-g824f89a (Dec 21 2017 - 16:51:26 +0800) |
| 55 | |
| 56 | DRAM: 1 GiB |
| 57 | MMC: mmc@f0e00000: 0 |
| 58 | SF: Detected mx25u1635e with page size 256 Bytes, erase size 4 KiB, total 2 MiB |
| 59 | In: serial@f0300000 |
| 60 | Out: serial@f0300000 |
| 61 | Err: serial@f0300000 |
| 62 | Net: |
| 63 | Warning: mac@e0100000 (eth0) using random MAC address - be:dd:d7:e4:e8:10 |
| 64 | eth0: mac@e0100000 |
| 65 | |
| 66 | RISC-V # version |
| 67 | U-Boot 2018.01-rc2-00033-gb265b91-dirty (Dec 22 2017 - 13:54:21 +0800) |
| 68 | |
| 69 | riscv32-unknown-linux-gnu-gcc (GCC) 7.2.0 |
| 70 | GNU ld (GNU Binutils) 2.29 |
| 71 | |
| 72 | RISC-V # setenv ipaddr 10.0.4.200 ; |
| 73 | RISC-V # setenv serverip 10.0.4.97 ; |
| 74 | RISC-V # ping 10.0.4.97 ; |
| 75 | Using mac@e0100000 device |
| 76 | host 10.0.4.97 is alive |
| 77 | |
| 78 | RISC-V # mmc rescan |
| 79 | RISC-V # fatls mmc 0:1 |
Rick Chen | f981e66 | 2018-05-29 10:29:20 +0800 | [diff] [blame] | 80 | 318907 u-boot-ae350-64.bin |
| 81 | 1252 hello_world_ae350_32.bin |
| 82 | 328787 u-boot-ae350-32.bin |
Rick Chen | 3fafced | 2017-12-26 13:55:59 +0800 | [diff] [blame] | 83 | |
| 84 | 3 file(s), 0 dir(s) |
| 85 | |
| 86 | RISC-V # sf probe 0:0 50000000 0 |
| 87 | SF: Detected mx25u1635e with page size 256 Bytes, erase size 4 KiB, total 2 MiB |
| 88 | |
| 89 | RISC-V # sf test 0x100000 0x1000 |
| 90 | SPI flash test: |
| 91 | 0 erase: 36 ticks, 111 KiB/s 0.888 Mbps |
| 92 | 1 check: 29 ticks, 137 KiB/s 1.096 Mbps |
| 93 | 2 write: 40 ticks, 100 KiB/s 0.800 Mbps |
| 94 | 3 read: 20 ticks, 200 KiB/s 1.600 Mbps |
| 95 | Test passed |
| 96 | 0 erase: 36 ticks, 111 KiB/s 0.888 Mbps |
| 97 | 1 check: 29 ticks, 137 KiB/s 1.096 Mbps |
| 98 | 2 write: 40 ticks, 100 KiB/s 0.800 Mbps |
| 99 | 3 read: 20 ticks, 200 KiB/s 1.600 Mbps |
| 100 | |
Rick Chen | f981e66 | 2018-05-29 10:29:20 +0800 | [diff] [blame] | 101 | RISC-V # fatload mmc 0:1 0x600000 u-boot-ae350-32.bin |
| 102 | reading u-boot-ae350-32.bin |
Rick Chen | 3fafced | 2017-12-26 13:55:59 +0800 | [diff] [blame] | 103 | 328787 bytes read in 324 ms (990.2 KiB/s) |
| 104 | |
| 105 | RISC-V # sf erase 0x0 0x51000 |
| 106 | SF: 331776 bytes @ 0x0 Erased: OK |
| 107 | |
| 108 | RISC-V # sf write 0x600000 0x0 0x50453 |
| 109 | device 0 offset 0x0, size 0x50453 |
| 110 | SF: 328787 bytes @ 0x0 Written: OK |
| 111 | |
| 112 | RISC-V # crc32 0x600000 0x50453 |
| 113 | crc32 for 00600000 ... 00650452 ==> 692dc44a |
| 114 | |
| 115 | RISC-V # crc32 0x80000000 0x50453 |
| 116 | crc32 for 80000000 ... 80050452 ==> 692dc44a |
| 117 | RISC-V # |
| 118 | |
| 119 | *** power-off and power-on, this U-Boot is booted from spi flash *** |
| 120 | |
| 121 | U-Boot 2018.01-rc2-00032-gf67dd47-dirty (Dec 21 2017 - 13:56:03 +0800) |
| 122 | |
| 123 | DRAM: 1 GiB |
| 124 | MMC: mmc@f0e00000: 0 |
| 125 | SF: Detected mx25u1635e with page size 256 Bytes, erase size 4 KiB, total 2 MiB |
| 126 | In: serial@f0300000 |
| 127 | Out: serial@f0300000 |
| 128 | Err: serial@f0300000 |
| 129 | Net: |
| 130 | Warning: mac@e0100000 (eth0) using random MAC address - ee:4c:58:29:32:f5 |
| 131 | eth0: mac@e0100000 |
| 132 | RISC-V # |
| 133 | |
Rick Chen | 3fafced | 2017-12-26 13:55:59 +0800 | [diff] [blame] | 134 | |
Rick Chen | fcc7a07 | 2018-03-13 15:24:03 +0800 | [diff] [blame] | 135 | Boot bbl and riscv-linux via U-Boot on QEMU |
| 136 | =========================================== |
| 137 | 1. Build riscv-linux |
| 138 | 2. Build bbl and riscv-linux with --with-payload |
Rick Chen | f981e66 | 2018-05-29 10:29:20 +0800 | [diff] [blame] | 139 | 3. Prepare ae350.dtb |
Rick Chen | fcc7a07 | 2018-03-13 15:24:03 +0800 | [diff] [blame] | 140 | 4. Creating OS-kernel images |
| 141 | ./mkimage -A riscv -O linux -T kernel -C none -a 0x0000 -e 0x0000 -d bbl.bin bootmImage-bbl.bin |
| 142 | Image Name: |
| 143 | Created: Tue Mar 13 10:06:42 2018 |
| 144 | Image Type: RISC-V Linux Kernel Image (uncompressed) |
| 145 | Data Size: 17901204 Bytes = 17481.64 KiB = 17.07 MiB |
| 146 | Load Address: 00000000 |
| 147 | Entry Point: 00000000 |
| 148 | |
Rick Chen | f981e66 | 2018-05-29 10:29:20 +0800 | [diff] [blame] | 149 | 4. Copy bootmImage-bbl.bin and ae350.dtb to qemu sd card image |
Rick Chen | fcc7a07 | 2018-03-13 15:24:03 +0800 | [diff] [blame] | 150 | 5. Message of booting riscv-linux from bbl via u-boot on qemu |
| 151 | |
| 152 | U-Boot 2018.03-rc4-00031-g2631273 (Mar 13 2018 - 15:02:55 +0800) |
| 153 | |
| 154 | DRAM: 1 GiB |
| 155 | main-loop: WARNING: I/O thread spun for 1000 iterations |
| 156 | MMC: mmc@f0e00000: 0 |
| 157 | Loading Environment from SPI Flash... *** Warning - spi_flash_probe_bus_cs() failed, using default environment |
| 158 | |
| 159 | Failed (-22) |
| 160 | In: serial@f0300000 |
| 161 | Out: serial@f0300000 |
| 162 | Err: serial@f0300000 |
| 163 | Net: |
| 164 | Warning: mac@e0100000 (eth0) using random MAC address - 02:00:00:00:00:00 |
| 165 | eth0: mac@e0100000 |
| 166 | RISC-V # mmc rescan |
| 167 | RISC-V # mmc part |
| 168 | |
| 169 | Partition Map for MMC device 0 -- Partition Type: DOS |
| 170 | |
| 171 | Part Start Sector Num Sectors UUID Type |
| 172 | RISC-V # fatls mmc 0:0 |
| 173 | 17901268 bootmImage-bbl.bin |
| 174 | 1954 ae2xx.dtb |
| 175 | |
| 176 | 2 file(s), 0 dir(s) |
| 177 | |
| 178 | RISC-V # fatload mmc 0:0 0x00600000 bootmImage-bbl.bin |
| 179 | 17901268 bytes read in 4642 ms (3.7 MiB/s) |
Rick Chen | f981e66 | 2018-05-29 10:29:20 +0800 | [diff] [blame] | 180 | RISC-V # fatload mmc 0:0 0x2000000 ae350.dtb |
Rick Chen | fcc7a07 | 2018-03-13 15:24:03 +0800 | [diff] [blame] | 181 | 1954 bytes read in 1 ms (1.9 MiB/s) |
| 182 | RISC-V # setenv bootm_size 0x2000000 |
| 183 | RISC-V # setenv fdt_high 0x1f00000 |
| 184 | RISC-V # bootm 0x00600000 - 0x2000000 |
| 185 | ## Booting kernel from Legacy Image at 00600000 ... |
| 186 | Image Name: |
| 187 | Image Type: RISC-V Linux Kernel Image (uncompressed) |
| 188 | Data Size: 17901204 Bytes = 17.1 MiB |
| 189 | Load Address: 00000000 |
| 190 | Entry Point: 00000000 |
| 191 | Verifying Checksum ... OK |
| 192 | ## Flattened Device Tree blob at 02000000 |
| 193 | Booting using the fdt blob at 0x2000000 |
| 194 | Loading Kernel Image ... OK |
| 195 | Loading Device Tree to 0000000001efc000, end 0000000001eff7a1 ... OK |
| 196 | [ 0.000000] OF: fdt: Ignoring memory range 0x0 - 0x200000 |
| 197 | [ 0.000000] Linux version 4.14.0-00046-gf3e439f-dirty (rick@atcsqa06) (gcc version 7.1.1 20170509 (GCC)) #1 Tue Jan 9 16:34:25 CST 2018 |
| 198 | [ 0.000000] bootconsole [early0] enabled |
| 199 | [ 0.000000] Initial ramdisk at: 0xffffffe000016a98 (12267008 bytes) |
| 200 | [ 0.000000] Zone ranges: |
| 201 | [ 0.000000] DMA [mem 0x0000000000200000-0x000000007fffffff] |
| 202 | [ 0.000000] Normal empty |
| 203 | [ 0.000000] Movable zone start for each node |
| 204 | [ 0.000000] Early memory node ranges |
| 205 | [ 0.000000] node 0: [mem 0x0000000000200000-0x000000007fffffff] |
| 206 | [ 0.000000] Initmem setup node 0 [mem 0x0000000000200000-0x000000007fffffff] |
| 207 | [ 0.000000] elf_hwcap is 0x112d |
| 208 | [ 0.000000] random: fast init done |
| 209 | [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 516615 |
| 210 | [ 0.000000] Kernel command line: console=ttyS0,38400n8 earlyprintk=uart8250-32bit,0xf0300000 debug loglevel=7 |
| 211 | [ 0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes) |
| 212 | [ 0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes) |
| 213 | [ 0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes) |
| 214 | [ 0.000000] Sorting __ex_table... |
| 215 | [ 0.000000] Memory: 2047832K/2095104K available (1856K kernel code, 204K rwdata, 532K rodata, 12076K init, 756K bss, 47272K reserved, 0K cma-reserved) |
| 216 | [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 |
| 217 | [ 0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0 |
| 218 | [ 0.000000] riscv,cpu_intc,0: 64 local interrupts mapped |
| 219 | [ 0.000000] riscv,plic0,e4000000: mapped 31 interrupts to 1/2 handlers |
| 220 | [ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns |
| 221 | [ 0.000000] Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS (lpj=40000) |
| 222 | [ 0.000000] pid_max: default: 32768 minimum: 301 |
| 223 | [ 0.004000] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes) |
| 224 | [ 0.004000] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes) |
| 225 | [ 0.056000] devtmpfs: initialized |
| 226 | [ 0.060000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns |
| 227 | [ 0.064000] futex hash table entries: 256 (order: 0, 6144 bytes) |
| 228 | [ 0.068000] NET: Registered protocol family 16 |
| 229 | [ 0.080000] vgaarb: loaded |
| 230 | [ 0.084000] clocksource: Switched to clocksource riscv_clocksource |
| 231 | [ 0.088000] NET: Registered protocol family 2 |
| 232 | [ 0.092000] TCP established hash table entries: 16384 (order: 5, 131072 bytes) |
| 233 | [ 0.096000] TCP bind hash table entries: 16384 (order: 5, 131072 bytes) |
| 234 | [ 0.096000] TCP: Hash tables configured (established 16384 bind 16384) |
| 235 | [ 0.100000] UDP hash table entries: 1024 (order: 3, 32768 bytes) |
| 236 | [ 0.100000] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes) |
| 237 | [ 0.104000] NET: Registered protocol family 1 |
| 238 | [ 0.616000] Unpacking initramfs... |
| 239 | [ 1.220000] workingset: timestamp_bits=62 max_order=19 bucket_order=0 |
| 240 | [ 1.244000] io scheduler noop registered |
| 241 | [ 1.244000] io scheduler cfq registered (default) |
| 242 | [ 1.244000] io scheduler mq-deadline registered |
| 243 | [ 1.248000] io scheduler kyber registered |
| 244 | [ 1.360000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled |
| 245 | [ 1.368000] console [ttyS0] disabled |
| 246 | [ 1.372000] f0300000.serial: ttyS0 at MMIO 0xf0300020 (irq = 10, base_baud = 1228800) is a 16550A |
| 247 | [ 1.392000] console [ttyS0] enabled |
| 248 | [ 1.392000] ftmac100: Loading version 0.2 ... |
| 249 | [ 1.396000] ftmac100 e0100000.mac eth0: irq 8, mapped at ffffffd002005000 |
| 250 | [ 1.400000] ftmac100 e0100000.mac eth0: generated random MAC address 6e:ac:c3:92:36:c0 |
| 251 | [ 1.404000] IR NEC protocol handler initialized |
| 252 | [ 1.404000] IR RC5(x/sz) protocol handler initialized |
| 253 | [ 1.404000] IR RC6 protocol handler initialized |
| 254 | [ 1.404000] IR JVC protocol handler initialized |
| 255 | [ 1.408000] IR Sony protocol handler initialized |
| 256 | [ 1.408000] IR SANYO protocol handler initialized |
| 257 | [ 1.408000] IR Sharp protocol handler initialized |
| 258 | [ 1.408000] IR MCE Keyboard/mouse protocol handler initialized |
| 259 | [ 1.412000] IR XMP protocol handler initialized |
| 260 | [ 1.456000] ftsdc010 f0e00000.mmc: mmc0 - using hw SDIO IRQ |
| 261 | [ 1.464000] bootconsole [early0] uses init memory and must be disabled even before the real one is ready |
| 262 | [ 1.464000] bootconsole [early0] disabled |
| 263 | [ 1.508000] Freeing unused kernel memory: 12076K |
| 264 | [ 1.512000] This architecture does not have kernel memory protection. |
| 265 | [ 1.520000] mmc0: new SD card at address 4567 |
| 266 | [ 1.524000] mmcblk0: mmc0:4567 QEMU! 20.0 MiB |
| 267 | [ 1.844000] mmcblk0: |
| 268 | Wed Dec 1 10:00:00 CST 2010 |
| 269 | / # |
| 270 | |
| 271 | |
| 272 | |
| 273 | TODO |
| 274 | ================================================== |
Rick Chen | f981e66 | 2018-05-29 10:29:20 +0800 | [diff] [blame] | 275 | Boot bbl and riscv-linux via U-Boot on AE350 board |