Zephyr RTOS HIFIVE!

The load to HiFive1 is failing because the offsets are wrong. If the Zephyr ELF is built correctly you should see it trying to load in the ~0x2040xxxx region:

Loading section vector, size 0x10 lma 0x20400000
Loading section exceptions, size 0x268 lma 0x20400010
Loading section text, size 0x2bd4 lma 0x20400278
Loading section devconfig, size 0x60 lma 0x20402e4c
Loading section log_const_sections, size 0x8 lma 0x20402eac
Loading section rodata, size 0x560 lma 0x20402eb4
Loading section datas, size 0x18 lma 0x20403414
Loading section initlevel, size 0x60 lma 0x2040342c

In your case the reset section is being loaded at 0x80000000, which isn’t in the region of memory mapped to the SPI flash.

One gotcha when developing a Zephyr app is that if you don’t completely clean the build sources when switching targets it doesn’t properly switch target configurations. So if you’ve built for qemu_riscv32, you’ll need to completely clean your build directory and re-run cmake. From .../zephyr/samples/hello_world/build run:

$ make pristine
$ cmake -DBOARD=hifive1 ..
$ make -j$(nproc)

At that point you should be able to flash the board with the resulting zephyr.elf. You’ll need to run make pristine and cmake -DBOARD=qemu_riscv32 again if you want to build for qemu_riscv32.

For the QEMU simulation failure, you probably hit the issue uncovered in this forum post. Long story short, in order to simulate qemu_riscv32 using the Zephyr SDK-packaged QEMU, you need Zephyr SDK 0.9.3.

Thank you for your patience working through these problems.