YosysHQ / picorv32

PicoRV32 - A Size-Optimized RISC-V CPU
ISC License
3.06k stars 749 forks source link

port linux and picorv32 on fpga #147

Open winner96 opened 4 years ago

winner96 commented 4 years ago

Hi. I'm newbie on these tasks.

I wants to port picorv32 on my fpga board. (KC705 or ZCU102)

I tried to find various guides, but it was hard to find.

which looks better to port picorv32 using axi-module or picosoc on fpga?

is it possible to add uart IP beside picorv32 and see linux displays on monitor?

thanks :)

jeremyherbert commented 4 years ago

Linux needs an MMU (which I'm pretty sure picorv32 does not have) so it won't be possible to boot linux on it. I think this project is more suitable for applications where you would normally find a microcontroller.

If you are looking to boot Linux on an FPGA using RISCV then perhaps you could look at the litex project which uses VexRiscV to boot linux on ECP5 FPGAs.

winner96 commented 4 years ago

Thanks for comments.

I have some more question as newbie.

https://unix.stackexchange.com/questions/190350/mmu-less-kernel

is it possible to build linux kernel with no mmu support. and If it succeed, still possible to port on picorv32?

let me first look into VexRiscV. Thanks :)

jeremyherbert commented 4 years ago

You can build MMU-less linux (also known as uclinux) but it is very tricky to use because there is no virtual memory support. Errors that would lead to your program crashing on a PC will take down the entire kernel.

I think the "pico" in picorv32 is enough evidence that this processor was not designed to be used with linux.

winner96 commented 4 years ago

Sincerely thank you for your help.

But I still do not understand why it makes error. If uclinux does not support virtual memory and picorv32 have no MMU, what makes PC to crash..

sorry for bothering u

bittenbybytes commented 4 years ago

The MMU protects memory regions against non-priviledged access(either accidental or malicious) on a hardware level. Without it any faulty code can corrupt sensitive kernel memory. As jeremyherbert hinted at: this core is optimized to be very small for low resource use and not intended for projects requiring large operating systems(maybe something like FreeRTOS at most). If your project absolutely requires Linux and your hardware has the required logic resource and memory, this low end version of the Risc-V is not the best choice.

winner96 commented 4 years ago

Thanks for reply :) it helps me a lot.