franzflasch/riscv_em

riscv_em_rv32_mmu_linux.sh

Closed this issue · 9 comments

Hello:

First, thank you for creating this exciting project!

The softcore and dtb both compiled without error.
When I tried to compile the Linux image, it failed with the following errors. See attached.

Any advice?

Thank you,

Mong
Screenshot from 2022-05-09 05-46-20

Hi Mong!

Thanks for reporting! Which toolchain did you use?

If you used my toolchain from here https://github.com/franzflasch/gcc-build-tools then I guess this issue comes from the latest GCC 12 and binutils upgrade. It should work with an older toolchain version below GCC 12.

But I'll take a look and try to fix this asap.

Hello Franzflasch:

I use ubuntu 20.04.4 LTS and 22.04 LTS; both have the same build issues.

The GCC in my system for the 22.04 is gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
and in the 20.04.4 is gcc (Ubuntu 9.4.0-1ubuntu1~20.4.1) 9.4.0

And the riscv compiler from here:
https://github.com/franzflasch/linux_for_riscv_em

Is there any issue with what I have?

Thank you,

Your setup looks fine. The problem is that with newer compilers the zicsr/zifencei extension is not automatically included in the risc-v I extension anymore. That's why the build fails.

The problem should be fixed now in https://github.com/franzflasch/linux_for_riscv_em
Please pull the new changes and do a complete rebuild, best would be to remove the output directory and then do the rebuild.

Hello franzflasch:

It is working now, thank you!!

Any tips on how to add other applications such as top, etc.

Thank you,

Screenshot from 2022-05-09 12-09-16

Great! Glad that it works now.

If you want to add other applications you need to modify the buildroot configuration and change it to your needs.

Hello franzflasch:

When you completed the rv64 version with MMU, let me know; I can be your tester, :)

Your make file works well and I can run Linux.
However, to help me understand your code, I used codelite and created a project. It compiled both debug and release but when I ran it, the system crashed :(.

Thank you for your time, :)

Screenshot from 2022-05-14 19-47-14

This looks like you are using 8250 uart instead of my own "simple_uart" implementation. 8250 does not work because it is not fully implemented in the emulator.

I don't know how you build the emulator in codelite but in the original CMakeLists.txt there is a check:

OPTION(RISCV_EM_DEBUG "RISC-V Debug Enable" "1")
if(RISCV_EM_DEBUG STREQUAL "1")
    add_compile_definitions(RISCV_EM_DEBUG)
else()
    add_compile_definitions(USE_SIMPLE_UART)
endif()

which decides if UART8250 or simple_uart is used.

Just make sure that in your build the global define "USE_SIMPLE_UART" is enabled and "RISCV_EM_DEBUG" is disabled.

Now both ports work using Codelite IDE and Windows 10 MS Visual C/C++

Port to MS Visual C/C++

MSVC

Using Codelite IDE on Ubuntu
Screenshot from 2022-05-15 19-16-10