We are still not having much luck with seL4 on the polarfire. We have attempted to boot on both Renode and via direct kernel boot on QEMU polarfire emulation:
https://qemu.readthedocs.io/en/latest/system/riscv/microchip-icicle-kit.html
Neither is working. I built two projects.
First I built sel4tests by following the instructions linked above. We are doing direct kernel boot in QEMU so we only needed this part:
repo init -u https://github.com/seL4/sel4test-manifest.git
repo sync
mkdir cbuild
cd cbuild
../init-build.sh -DPLATFORM=polarfire -DSel4testAllowSettingsOverride=True -DElfloaderImage=binary -DKernelVerificationBuild=OFF
ninja
When I attempt to boot I see the OpenSBI output and nothing else. I checked all 4 serial outputs defined in the dtb:
qemu-system-riscv64 -M microchip-icicle-kit -smp 5 -m 2G -display none -serial stdio -serial null -serial null -serial null -kernel /home/esandberg/projects/sel4/repo_sel4/cbuild/images/sel4test-driver-image-riscv-polarfire -dtb /home/esandberg/projects/sel4/repo_sel4/cbuild/kernel/kernel.dtb
OpenSBI v1.2
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : SiFive,FU540G
Platform Features : medeleg
Platform HART Count : 5
Platform IPI Device : ---
Platform Timer Device : --- @ 0Hz
Platform Console Device : uart8250
Platform HSM Device : ---
Platform PMU Device : ---
Platform Reboot Device : ---
Platform Shutdown Device : ---
Firmware Base : 0x80000000
Firmware Size : 244 KB
Runtime SBI Version : 1.0
Domain0 Name : root
Domain0 Boot HART : 3
Domain0 HARTs : 0*,1*,2*,3*,4*
Domain0 Region00 : 0x0000000080000000-0x000000008003ffff ()
Domain0 Region01 : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address : 0x0000000080200000
Domain0 Next Arg1 : 0x00000000bfe00000
Domain0 Next Mode : S-mode
Domain0 SysReset : yes
Boot HART ID : 3
Boot HART Domain : root
Boot HART Priv Version : v1.10
Boot HART Base ISA : rv64imafdc
Boot HART ISA Extensions : none
Boot HART PMP Count : 16
Boot HART PMP Granularity : 4
Boot HART PMP Address Bits: 54
Boot HART MHPM Count : 0
Boot HART MIDELEG : 0x0000000000000222
Boot HART MEDELEG : 0x000000000000b109
Second we added the polarfire to the dev fork here:
GitHub - Ivan-Velickovic/microkit: Microkit - A simple operating system framework for the seL4 microkernel
we modified the star64 example to work with the polarfire. Not a lot of changes were required:
BoardInfo(
name="polarfire",
arch=BoardArch.RISCV64,
gcc_flags = "",
loader_link_address=0x89300000,
kernel_options = {
"KernelIsMCS": True,
"KernelPlatform": "polarfire",
},
examples = {
"hello": Path("example/polarfire/hello")
}
),
and we copied the star64 example to the polarfire example dir.
When I attempt to boot in QEMU I see the OpenSBI output and then an error about the magic number. I checked all 4 serial outputs defined in the dtb:
qemu-system-riscv64 -M microchip-icicle-kit -smp 5 -m 2G -display none -serial stdio -serial null -serial null -serial null -kernel /home/esandberg/projects/sel4/ivan-vel-sel4cp/tmp_build/loader.img -dtb /home/esandberg/projects/sel4/ivan-vel-sel4cp/build/polarfire/release/sel4/build/kernel.dtb
OpenSBI v1.2
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : SiFive,FU540G
Platform Features : medeleg
Platform HART Count : 5
Platform IPI Device : aclint-mswi
Platform Timer Device : aclint-mtimer @ 1000000Hz
Platform Console Device : uart8250
Platform HSM Device : ---
Platform PMU Device : ---
Platform Reboot Device : ---
Platform Shutdown Device : ---
Firmware Base : 0x80000000
Firmware Size : 244 KB
Runtime SBI Version : 1.0
Domain0 Name : root
Domain0 Boot HART : 4
Domain0 HARTs : 0*,1*,2*,3*,4*
Domain0 Region00 : 0x0000000002000000-0x000000000200ffff (I)
Domain0 Region01 : 0x0000000080000000-0x000000008003ffff ()
Domain0 Region02 : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address : 0x0000000080200000
Domain0 Next Arg1 : 0x00000000bfe00000
Domain0 Next Mode : S-mode
Domain0 SysReset : yes
Boot HART ID : 4
Boot HART Domain : root
Boot HART Priv Version : v1.10
Boot HART Base ISA : rv64imafdc
Boot HART ISA Extensions : none
Boot HART PMP Count : 16
Boot HART PMP Granularity : 4
Boot HART PMP Address Bits: 54
Boot HART MHPM Count : 0
Boot HART MIDELEG : 0x0000000000000222
Boot HART MEDELEG : 0x000000000000b109
LDR|INFO: altloader for seL4 starting
LDR|ERROR: mismatch on loader data structure magic number