Skip to content

Instantly share code, notes, and snippets.

@hansemro
Last active December 21, 2023 07:09
Show Gist options
  • Save hansemro/38c4962a91ec31476a9d4cbb0d79cc13 to your computer and use it in GitHub Desktop.
Save hansemro/38c4962a91ec31476a9d4cbb0d79cc13 to your computer and use it in GitHub Desktop.
Booting Linux on KC705 with LiteX-VexRiscvSMP
$ litex_term --images=images/boot.json /dev/ttyUSB2
__ _ __ _ __
/ / (_) /____ | |/_/
/ /__/ / __/ -_)> <
/____/_/\__/\__/_/|_|
Build your hardware, easily!
(c) Copyright 2012-2023 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs
BIOS CRC passed (62b60279)
LiteX git sha1: 7062e337
--=============== SoC ==================--
CPU: VexRiscv SMP-LINUX @ 75MHz
BUS: WISHBONE 32-bit @ 4GiB
CSR: 32-bit data
ROM: 64.0KiB
SRAM: 6.0KiB
SDRAM: 512.0MiB 32-bit @ 600MT/s (CL-6 CWL-5)
MAIN-RAM: 512.0MiB
--========== Initialization ============--
Ethernet init...
Initializing SDRAM @0x40000000...
Switching SDRAM to software control.
Write leveling:
tCK equivalent taps: 40
Cmd/Clk scan (0-20)
|10000000000000011111| best: 15
Setting Cmd/Clk delay to 15 taps.
Data scan:
m0: |1111111111110000000000| delay: 00
m1: |1111111111100000000000| delay: 00
m2: |1111111111111110000000| delay: 00
m3: |1111111111111110000000| delay: 00
Write latency calibration:
m0:6 m1:6 m2:6 m3:6
Write DQ-DQS training:
m0: |111111111110000000000000000000000| delays: 04+-04
m1: |111111111110000000000000000000000| delays: 04+-04
m2: |111111111100000000000000000000000| delays: 04+-04
m3: |111111111100000000000000000000000| delays: 04+-04
Read leveling:
m0, b00: |00000000000000000000000000000000| delays: -
m0, b01: |11111111111100000000000000000000| delays: 05+-05
m0, b02: |00000000000000001111111111111111| delays: 23+-07
m0, b03: |00000000000000000000000000000000| delays: -
m0, b04: |00000000000000000000000000000000| delays: -
m0, b05: |00000000000000000000000000000000| delays: -
m0, b06: |00000000000000000000000000000000| delays: -
m0, b07: |00000000000000000000000000000000| delays: -
best: m0, b02 delays: 23+-07
m1, b00: |00000000000000000000000000000000| delays: -
m1, b01: |11111111110000000000000000000000| delays: 04+-04
m1, b02: |00000000000000011111111111111110| delays: 22+-07
m1, b03: |00000000000000000000000000000000| delays: -
m1, b04: |00000000000000000000000000000000| delays: -
m1, b05: |00000000000000000000000000000000| delays: -
m1, b06: |00000000000000000000000000000000| delays: -
m1, b07: |00000000000000000000000000000000| delays: -
best: m1, b02 delays: 22+-07
m2, b00: |00000000000000000000000000000000| delays: -
m2, b01: |11111111000000000000000000000000| delays: 03+-03
m2, b02: |00000000000001111111111111111100| delays: 21+-08
m2, b03: |00000000000000000000000000000000| delays: -
m2, b04: |00000000000000000000000000000000| delays: -
m2, b05: |00000000000000000000000000000000| delays: -
m2, b06: |00000000000000000000000000000000| delays: -
m2, b07: |00000000000000000000000000000000| delays: -
best: m2, b02 delays: 21+-08
m3, b00: |00000000000000000000000000000000| delays: -
m3, b01: |11111111110000000000000000000000| delays: 04+-04
m3, b02: |00000000000000111111111111111110| delays: 22+-08
m3, b03: |00000000000000000000000000000000| delays: -
m3, b04: |00000000000000000000000000000000| delays: -
m3, b05: |00000000000000000000000000000000| delays: -
m3, b06: |00000000000000000000000000000000| delays: -
m3, b07: |00000000000000000000000000000000| delays: -
best: m3, b02 delays: 22+-08
Switching SDRAM to hardware control.
Memtest at 0x40000000 (2.0MiB)...
Write: 0x40000000-0x40200000 2.0MiB
Read: 0x40000000-0x40200000 2.0MiB
Memtest OK
Memspeed at 0x40000000 (Sequential, 2.0MiB)...
Write speed: 127.1MiB/s
Read speed: 61.2MiB/s
--============== Boot ==================--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
[LITEX-TERM] Received firmware download request from the device.
[LITEX-TERM] Uploading images/Image to 0x40000000 (7531468 bytes)...
[LITEX-TERM] Upload calibration... (inter-frame: 10.00us, length: 64)
[LITEX-TERM] Upload complete (9.9KB/s).
[LITEX-TERM] Uploading images/kc705.dtb to 0x40ef0000 (3615 bytes)...
[LITEX-TERM] Upload calibration... (inter-frame: 10.00us, length: 64)
[LITEX-TERM] Upload complete (9.9KB/s).
[LITEX-TERM] Uploading images/rootfs.cpio to 0x41000000 (3781632 bytes)...
[LITEX-TERM] Upload calibration... (inter-frame: 10.00us, length: 64)
[LITEX-TERM] Upload complete (9.9KB/s).
[LITEX-TERM] Uploading images/opensbi.bin to 0x40f00000 (53640 bytes)...
[LITEX-TERM] Upload calibration... (inter-frame: 10.00us, length: 64)
[LITEX-TERM] Upload complete (9.9KB/s).
[LITEX-TERM] Booting the device.
[LITEX-TERM] Done.
Executing booted program at 0x40f00000
--============= Liftoff! ===============--
OpenSBI v0.8-1-gecf7701
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : LiteX / VexRiscv-SMP
Platform Features : timer,mfdeleg
Platform HART Count : 8
Boot HART ID : 0
Boot HART ISA : rv32imas
BOOT HART Features : time
BOOT HART PMP Count : 0
Firmware Base : 0x40f00000
Firmware Size : 124 KB
Runtime SBI Version : 0.2
MIDELEG : 0x00000222
MEDELEG : 0x0000b101
[ 0.000000] Linux version 5.14.0 (florent@panda) (riscv32-buildroot-linux-gnu-gcc.br_real (Buildroot 2021.08-381-g279167ee8d) 10.3.0, GNU ld (GNU Binutils) 2.36.1) #1 SMP Tue Sep 21 12:57:31 CEST 2021
[ 0.000000] earlycon: liteuart0 at I/O port 0x0 (options '')
[ 0.000000] Malformed early option 'console'
[ 0.000000] earlycon: liteuart0 at MMIO 0xf0001000 (options '')
[ 0.000000] printk: bootconsole [liteuart0] enabled
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x0000000040000000-0x000000007fffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000040000000-0x000000007fffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000007fffffff]
[ 0.000000] SBI specification v0.2 detected
[ 0.000000] SBI implementation ID=0x1 Version=0x8
[ 0.000000] SBI TIME extension detected
[ 0.000000] SBI IPI extension detected
[ 0.000000] SBI RFENCE extension detected
[ 0.000000] SBI v0.2 HSM extension detected
[ 0.000000] riscv: ISA extensions aimp
[ 0.000000] riscv: ELF capabilities aim
[ 0.000000] percpu: Embedded 8 pages/cpu s11340 r0 d21428 u32768
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 260096
[ 0.000000] Kernel command line: console=liteuart earlycon=liteuart,0xf0001000 rootwait root=/dev/ram0
[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 0.000000] Sorting __ex_table...
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 1023248K/1048576K available (5685K kernel code, 572K rwdata, 883K rodata, 209K init, 221K bss, 25328K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=2.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] riscv-intc: 32 local interrupts mapped
[ 0.000000] plic: interrupt-controller@f0c00000: mapped 32 interrupts with 2 handlers for 4 contexts.
[ 0.000000] random: get_random_bytes called from start_kernel+0x4ac/0x63c with crng_init=0
[ 0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0]
[ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x39a85c4118, max_idle_ns: 881590405314 ns
[ 0.000014] sched_clock: 64 bits at 125MHz, resolution 8ns, wraps every 4398046511100ns
[ 0.005956] Console: colour dummy device 80x25
[ 0.008493] Calibrating delay loop (skipped), value calculated using timer frequency.. 250.00 BogoMIPS (lpj=500000)
[ 0.015303] pid_max: default: 32768 minimum: 301
[ 0.020559] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[ 0.025053] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[ 0.046376] ASID allocator using 9 bits (512 entries)
[ 0.050696] rcu: Hierarchical SRCU implementation.
[ 0.057789] smp: Bringing up secondary CPUs ...
[ 1.106904] CPU1: failed to come online
[ 1.109025] smp: Brought up 1 node, 1 CPU
[ 1.115591] devtmpfs: initialized
[ 1.145242] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 1.151455] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[ 1.161108] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[ 1.308188] pps_core: LinuxPPS API ver. 1 registered
[ 1.310691] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 1.316649] PTP clock support registered
[ 1.321121] FPGA manager framework
[ 1.333217] clocksource: Switched to clocksource riscv_clocksource
[ 1.464043] NET: Registered PF_INET protocol family
[ 1.468089] IP idents hash table entries: 16384 (order: 5, 131072 bytes, linear)
[ 1.488124] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[ 1.493843] TCP established hash table entries: 8192 (order: 3, 32768 bytes, linear)
[ 1.499366] TCP bind hash table entries: 8192 (order: 4, 65536 bytes, linear)
[ 1.505013] TCP: Hash tables configured (established 8192 bind 8192)
[ 1.509497] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[ 1.513752] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[ 1.532358] Unpacking initramfs...
[ 1.605828] workingset: timestamp_bits=30 max_order=18 bucket_order=0
[ 1.784003] io scheduler mq-deadline registered
[ 1.786521] io scheduler kyber registered
[ 2.001243] LiteX SoC Controller driver initialized
[ 2.592234] Initramfs unpacking failed: invalid magic at start of compressed archive
[ 2.646763] Freeing initrd memory: 8192K
[ 3.142660] f0001000.serial: ttyLXU0 at MMIO 0x0 (irq = 0, base_baud = 0) is a liteuart
[ 3.147801] printk: console [liteuart0] enabled
[ 3.147801] printk: console [liteuart0] enabled
[ 3.153140] printk: bootconsole [liteuart0] disabled
[ 3.153140] printk: bootconsole [liteuart0] disabled
[ 3.183753] liteeth f0002000.mac eth0: irq 2 slots: tx 2 rx 2 size 2048
[ 3.190369] i2c_dev: i2c /dev entries driver
[ 3.226452] NET: Registered PF_INET6 protocol family
[ 3.241593] Segment Routing with IPv6
[ 3.243616] In-situ OAM (IOAM) with IPv6
[ 3.246671] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 3.259887] NET: Registered PF_PACKET protocol family
[ 3.281031] litex-mmc f0006000.mmc: Requested clk_freq=12500000: set to 7812500 via div=16
[ 3.309111] Freeing unused kernel image (initmem) memory: 204K
[ 3.312332] Kernel memory protection not selected by kernel config.
[ 3.316250] Run /init as init process
Starting syslogd: OK
Starting klogd: OK
[ 4.525224] litex-mmc f0006000.mmc: Requested clk_freq=0: set to 488281 via div=256
Running sysctl: OK
Saving random seed: [ 5.070936] random: dd: uninitialized urandom read (512 bytes read)
OK
Starting network: OK
Welcome to Buildroot
buildroot login:
Welcome to Buildroot
buildroot login: root
__ _
/ / (_)__ __ ____ __
/ /__/ / _ \/ // /\ \ /
/____/_/_//_/\_,_//_\_\
/ _ \/ _ \
__ _ __ _ _\___/_//_/ ___ _
/ / (_) /____ | |/_/__| | / /____ __ / _ \(_)__ _____ __
/ /__/ / __/ -_)> </___/ |/ / -_) \ // , _/ (_-</ __/ |/ /
/____/_/\__/\__/_/|_|____|___/\__/_\_\/_/|_/_/___/\__/|___/
/ __/ |/ / _ \
_\ \/ /|_/ / ___/
/___/_/ /_/_/
32-bit RISC-V Linux running on LiteX / VexRiscv-SMP.
login[77]: root login on 'console'
root@buildroot:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
link/ether 6e:56:7b:64:ab:c2 brd ff:ff:ff:ff:ff:ff
3: sit0@NONE: <NOARP> mtu 1480 qdisc noop qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0
root@buildroot:~# ifconfig -a
eth0 Link encap:Ethernet HWaddr 6E:56:7B:64:AB:C2
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:2
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
root@buildroot:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
link/ether 6e:56:7b:64:ab:c2 brd ff:ff:ff:ff:ff:ff
3: sit0@NONE: <NOARP> mtu 1480 qdisc noop qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0
root@buildroot:~# ifconfig eth0 10.42.0.240
root@buildroot:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 6e:56:7b:64:ab:c2 brd ff:ff:ff:ff:ff:ff
inet 10.42.0.240/8 brd 10.255.255.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::6c56:7bff:fe64:abc2/64 scope link
valid_lft forever preferred_lft forever
3: sit0@NONE: <NOARP> mtu 1480 qdisc noop qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0
root@buildroot:~# ping 10.42.0.1
PING 10.42.0.1 (10.42.0.1): 56 data bytes
64 bytes from 10.42.0.1: seq=0 ttl=64 time=2.193 ms
64 bytes from 10.42.0.1: seq=1 ttl=64 time=0.995 ms
64 bytes from 10.42.0.1: seq=2 ttl=64 time=0.992 ms
^C
--- 10.42.0.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.992/1.393/2.193 ms
root@buildroot:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 6e:56:7b:64:ab:c2 brd ff:ff:ff:ff:ff:ff
inet 10.42.0.240/8 brd 10.255.255.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::6c56:7bff:fe64:abc2/64 scope link
valid_lft forever preferred_lft forever
3: sit0@NONE: <NOARP> mtu 1480 qdisc noop qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0
root@buildroot:~# ip route
10.0.0.0/8 dev eth0 scope link src 10.42.0.240
root@buildroot:~# udhcpc -i eth0
udhcpc: started, v1.33.1
udhcpc: sending discover
udhcpc: sending select for 10.42.0.75
udhcpc: lease of 10.42.0.75 obtained, lease time 3600
deleting routers
adding dns 10.42.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment