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