agra-uni-bremen / riscv-vp

RISC-V Virtual Prototype
MIT License
139 stars 49 forks source link

Unable to run zephyr on hifive-vp #17

Closed A1245967 closed 2 years ago

A1245967 commented 2 years ago

I am trying to run zephyr RTOS on hifive-vp. I used zephyr hello_world example with the hifive1 board setting in zephyr. When I try to run the zephyr.elf on hifive1-vp, it shows the following error.

hifive-vp: /root/riscv-vp/vp/src/./core/common/elf_loader.h:62: void GenericElfLoader<T>::load_executable_image(load_if&, GenericElfLoader<T>::addr_t, Generic bool) [with T = rv32::Elf32Types; GenericElfLoader<T>::addr_t = unsigned int]: Assertion `(addr + p->p_memsz < offset + size) && "Section does not fit in tar Aborted (core dumped)

Here is my command. hifive-vp zephyr.elf --intercept-syscalls

It seems that hifive-vp do not have the --memory-start flag to set the memory start address like riscv-vp. I cannot use --memory-start=2147483648 which is used in riscv-freeRTOS demo examples to solve this problem. Thanks!

Cirromulus commented 2 years ago

Hi! Could you provide a link on how you built the binary?`

As a comment, the hifive-vp (should) behave just like the real one, so both memory-start and intercept-syscalls are not necessary or contraproductive (no need for the OS to intercept syscalls, if zephyr shall handle them).

The https://github.com/agra-uni-bremen/riscv-freertos is pretty obsolete, we should either delete or update it. In the meantime, you could give the newer https://github.com/agra-uni-bremen/sifive-hifive1/ a try, there is a (small and brief) section on Zephyr.

A1245967 commented 2 years ago

Hi !

I just follow the https://github.com/agra-uni-bremen/sifive-hifive1/ and run zephyr RTOS again. The simulation of the snake example is successful.

I follow the zephyr part to build zephyr.elf, so I source the zephyr-env.sh first. The toolchain is riscv64-zephyr-elf-gcc. Then I build the hello_world example with this command. mkdir build && cd build && cmake .. -DBOARD=hifive1 However, I still cannot simulate the zephyr.elf with the command hifive-vp zephyr.elf.

Thanks!

Cirromulus commented 2 years ago

As a comment, the hifive-vp (should) behave just like the real one, so both memory-start and intercept-syscalls are not necessary or contraproductive (no need for the OS to intercept syscalls, if zephyr shall handle them).

You were using the riscv-vp, which is by default not compatible to the hifive. Please use the hifive-vp.

(edited my answer, because I copied your commands...)