Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RISC-V: Add NEORV32 SoC support #39162

Merged
merged 9 commits into from
Oct 15, 2021

Conversation

henrikbrixandersen
Copy link
Member

This PR adds basic Zephyr support for the NEORV32 RISC-V SoC.

More information about the NEORV32 can be obtained here:

The implementation passes the full suite of applicable test cases and samples as selected by twister.

Add support for the open-source NEORV32 RISC-V compatible processor
system (SoC).

Signed-off-by: Henrik Brix Andersen <[email protected]>
Add UART driver for the open-source NEORV32 RISC-V compatible processor
system (SoC).

Signed-off-by: Henrik Brix Andersen <[email protected]>
Add devicetree nodes for the NEORV32 UART devices.

Signed-off-by: Henrik Brix Andersen <[email protected]>
@henrikbrixandersen henrikbrixandersen added the area: RISCV RISCV Architecture (32-bit & 64-bit) label Oct 5, 2021
Copy link
Member

@fkokosinski fkokosinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I've been trying to use the Tcl script located in setups/vivado/arty-a7-test-setup in the repository you've linked above to test this port on HW, but it seems to be referencing non-declared variables (such as $fileset_neorv32), and non-existing board part (at least on my Vivado 2020.2). Could you point me to a script that would allow me to build this setup? This would be also beneficial to add to the board documentation in Zephyr.

drivers/gpio/Kconfig Show resolved Hide resolved
soc/riscv/riscv-privilege/neorv32/soc.c Show resolved Hide resolved
@cfriedt
Copy link
Member

cfriedt commented Oct 8, 2021

Very cool!

Kind of a tangential question, but if someone wanted to do all of this in a module, would it be possible?

Add GPIO driver for the open-source NEORV32 RISC-V compatible processor
system (SoC).

Signed-off-by: Henrik Brix Andersen <[email protected]>
Add devicetree nodes for the NEORV32 GPIO device.

The GPIO port is 64 bits wide, but Zephyr only supports up to 32 bit
wide GPIO ports. The GPIO device is therefore handled as two Zephyr GPIO
devices with a nexus devicetree node mapping pins 0 to 31 to the device
handling the lower half, and pins 32 to 63 to the device handling the
upper half.

Signed-off-by: Henrik Brix Andersen <[email protected]>
Add a basic board definition for the open-source NEORV32 RISC-V
compatible processor system (SoC).

Signed-off-by: Henrik Brix Andersen <[email protected]>
Add basic GPIO API test configuration for the NEORV32.

Signed-off-by: Henrik Brix Andersen <[email protected]>
The GPIO block of the NEORV32 contains fully independent inputs and
outputs (inputN is fully independent of outputN).

This scenario is not handled by the 1pin GPIO test case, so exclude the
neorv32 for now.

Signed-off-by: Henrik Brix Andersen <[email protected]>
Take ownership of all the neorv32 specific files (dts bindings, soc
implementation, drivers, and board definition).

Signed-off-by: Henrik Brix Andersen <[email protected]>
@henrikbrixandersen
Copy link
Member Author

Very cool!

Thank you 👍

Kind of a tangential question, but if someone wanted to do all of this in a module, would it be possible?

As you are likely aware, Zephyr does support out-of-tree SoC, driver, and board implementations (see https://docs.zephyrproject.org/latest/application/index.html#custom-board-devicetree-and-soc-definitions).

Support for this particular SoC piggybacks on the soc/riscv/riscv-privilege/common code though, so an out-of-tree port of Zephyr for this SoC would have to jump through a few hoops in order to reuse that code outside of the main tree.

@henrikbrixandersen
Copy link
Member Author

henrikbrixandersen commented Oct 8, 2021

Hi, I've been trying to use the Tcl script located in setups/vivado/arty-a7-test-setup in the repository you've linked above to test this port on HW, but it seems to be referencing non-declared variables (such as $fileset_neorv32), and non-existing board part (at least on my Vivado 2020.2). Could you point me to a script that would allow me to build this setup? This would be also beneficial to add to the board documentation in Zephyr.

I have just submitted a PR against the NEORV32 project for fixing the setups/vivado/arty-a7-test-setup example: stnolting/neorv32#175

With this PR in, I was able to synthesise and implement the upstream example design using Xilinx Vivado 2020.02 (note, however, that you will need to modify the NEORV32 settings in that design in order to meet the requirements for running Zephyr on the NEORV32. The requirements are documented in the submitted board documentation).

I have also submitted a PR for hinting at installing board support files:
stnolting/neorv32#174

The Zephyr board documentation refers to the excellent upstream documentation for instructions on how to synthesise, implement, and load the NEORV32 FPGA designs. Any questions or generic NEORV32 documentation fixes are better addressed there.

Copy link
Member

@nandojve nandojve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @henrikbrixandersen ,
Very interesting. Just couple questions.

drivers/serial/uart_neorv32.c Show resolved Hide resolved
drivers/gpio/Kconfig.neorv32 Show resolved Hide resolved
@henrikbrixandersen henrikbrixandersen added the dev-review To be discussed in dev-review meeting label Oct 14, 2021
@henrikbrixandersen henrikbrixandersen removed the dev-review To be discussed in dev-review meeting label Oct 14, 2021
@henrikbrixandersen
Copy link
Member Author

@nandojve Was your request for changes addressed?

Copy link
Member

@nandojve nandojve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thank you for your contribution.

@cfriedt cfriedt merged commit 02fceed into zephyrproject-rtos:main Oct 15, 2021
@henrikbrixandersen henrikbrixandersen deleted the neorv32 branch July 12, 2022 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Boards area: Devicetree Binding PR modifies or adds a Device Tree binding area: Devicetree area: Documentation area: RISCV RISCV Architecture (32-bit & 64-bit)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants