Blog Post - Getting Started with Zephyr


(Mark Corbin) #1

Hello

I’ve been working through the instructions in Nathaniel’s blog post, but I’m getting a failure with ‘make run’, as follows:

[  1%] Built target kobj_types_h_target
[  2%] Built target syscall_macros_h_target
[  6%] Built target syscall_list_h_target
[  8%] Built target driver_validation_h_target
[ 10%] Built target offsets
[ 11%] Built target offsets_h
[ 40%] Built target kernel
[ 42%] Built target app
[ 43%] Built target linker_script
[ 74%] Built target zephyr
[ 88%] Built target lib__libc__minimal
[ 90%] Built target drivers__serial
[ 93%] Built target zephyr_prebuilt
[ 94%] Built target linker_pass_final_script
[ 98%] Built target kernel_elf
[100%] 
To exit from QEMU enter: 'CTRL+a, x'
[QEMU] CPU: riscv32
qemu-system-riscv32: -nographic: unsupported machine type
Use -machine help to list supported machines
make[3]: *** [zephyr/CMakeFiles/run.dir/build.make:60: zephyr/CMakeFiles/run] Error 1
make[2]: *** [CMakeFiles/Makefile2:382: zephyr/CMakeFiles/run.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:389: zephyr/CMakeFiles/run.dir/rule] Error 2
make: *** [Makefile:160: zephyr/CMakeFiles/run.dir/rule] Error 2

The QEMU command appears to be using ‘sifive’ as the machine name, which I guess explains the unsupported machine type. However, if I try and run QEMU by hand with any of the valid machine types I can’t get it to boot zephyr.elf. Using zephyr.elf with the -kernel option results in a ‘rom: requested regions overlap’ error.

The relevant command in zephyr/CMakeFiles/run.dir/build.make seems to be:

/opt/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/qemu-system-riscv32 -m 32
-nographic -machine sifive -pidfile qemu${QEMU_INSTANCE}.pid -serial ${if ${QEMU_PTY},
pty, ${if ${QEMU_PIPE}, pipe:${QEMU_PIPE}, mon:stdio}} -kernel
/home/mark/zephyr/samples/hello_world/build/zephyr/zephyr.elf

Any ideas welcome.

Thanks

Mark

(Also the ‘source zephyr_env.sh’ command needs to be ‘source zephyr-env.sh’ with a dash instead of an underscore).


Zephyr RTOS HIFIVE!
(Nate Graff) #2

Hi Mark! First off, which commit/tag of the Zephyr sources are you using, which board are you building for, and which version of the Zephyr SDK have you installed?


(Mark Corbin) #3

Hello Nate

I’m following your blog instructions…

git checkout v1.13.0

cmake -DBOARD=qemu_riscv32 ..

I’ve installed ‘zephyr-sdk-0.9.5-setup.run’ as per the instructions on the Zephyr ‘Development Environment Setup on Linux’ page.

Regards

Mark


(Nate Graff) #4

Ah, this hits right on one of the pain points for some of the recent development work on Zephyr. The v1.13.0 release needs version 0.9.3 of the Zephyr SDK to simulate the qemu_riscv32 target. SDK 0.9.5 was just released on Friday and includes a version bump to QEMU 3.0.0 for RISC-V, which has different machine targets than qemu_riscv32 builds for in Zephyr v1.13.0.

There are two ways you can fix the problem you’re having:

  1. Check out the latest Zephyr master branch and continue using SDK 0.9.5. This pull request recently merged into master made it possible to simulate qemu_riscv32 and hifive1 in SDK 0.9.5.
  2. Continue using v1.13.0 and install SDK 0.9.3.

I should update my blog post to make mention of these changes, it looks like my post was timed perfectly to hit these issues. Sorry about that!