Note: This is a fork of stnolting/neorv32-setups with curated instructions and repository structure optimized for Ada firmware development with neorv32-hal. The original repository contains setups for many more FPGA boards.
This repository provides FPGA setups for the NEORV32 RISC-V Processor with Ada firmware support through neorv32-hal (included as a submodule).
This guide covers three development boards:
| Board | FPGA | Toolchain | Setup Location |
|---|---|---|---|
| Digilent Basys3 | Xilinx Artix-7 XC7A35TCPG236-1 |
Vivado | vivado/basys3-a7-test-setup |
| ULX3S | Lattice ECP5 LFE5U-85F |
Open Source (GHDL/Yosys/nextPNR) | osflow |
| Sipeed Tang Nano 9K | Gowin GW1NR-9 GW1NR-LV9QN88PC6/I5 |
Gowin EDA | gowineda/tang-nano-9k |
Important: This repository uses Git submodules. You must clone with submodules to get the complete project.
Clone this repository with submodules:
git clone --recurse-submodules https://github.com/GNAT-Academic-Program/neorv32-setups.git
cd neorv32-setupsPrerequisites: Xilinx Vivado installed
-
Navigate to the Basys3 setup directory:
cd vivado/basys3-a7-test-setup -
Generate the bitstream:
vivado -mode batch -source create_project.tcl
-
Program the FPGA:
vivado -mode batch -source program_bitstream.tcl
-
Connect via UART at 19200 baud, 8N1 (USB-UART appears as
/dev/ttyUSB0orCOM*on Windows)
See vivado/basys3-a7-test-setup/README.md for details.
Prerequisites: Docker installed
-
Pull the neorv32/impl container (includes GHDL, Yosys, nextPNR):
docker pull ghcr.io/stnolting/neorv32/impl:latest
-
Run the container:
docker run --rm -it -v "$(pwd)":/workspace ghcr.io/stnolting/neorv32/impl bash cd /workspace
-
Build the bitstream:
cd osflow make BOARD=ULX3S MinimalBoot -
Program the board using fujprog:
fujprog neorv32_ULX3S_MinimalBoot.bit
See osflow/README.md for more targets and details.
Prerequisites: Gowin EDA installed
-
Navigate to the Tang Nano 9K setup directory:
cd gowineda/tang-nano-9k -
Open the project in Gowin EDA IDE
-
Generate and program the bitstream using Gowin Programmer
See gowineda/tang-nano-9k/README.md for details.
-
Install Alire (Ada package manager): alire.ada.dev
-
Ensure RISC-V toolchain is in PATH (installed automatically by Alire):
Linux/macOS:
export PATH="$PATH:~/.local/share/alire/toolchains/gnat_riscv64_elf_*/bin"
Add to
~/.bashrcor~/.zshrcto make permanent.Windows (PowerShell):
$env:PATH += ";$env:USERPROFILE\.local\share\alire\toolchains\gnat_riscv64_elf_*\bin"
Add to PowerShell profile or set permanently via System Environment Variables.
-
Build and install the bootloader image generator:
Linux/macOS:
cd neorv32/sw/image_gen gcc image_gen.c -o image_gen sudo cp image_gen /usr/local/bin/Windows (PowerShell/CMD):
cd neorv32\sw\image_gen gcc image_gen.c -o image_gen.exeThen manually copy
image_gen.exeto a directory in your PATH (e.g.,C:\Windows\System32) or add the current directory to your PATH.
The neorv32-hal repository is already included as a submodule in this fork.
-
Navigate to the demos directory:
cd neorv32-hal/demos -
Build the firmware using the provided scripts:
For application binary (to upload via bootloader):
Linux/macOS:
./build_app_bin.sh
Windows:
build_app_bin.bat
This script builds the Ada firmware with Alire and converts it to the NEORV32 executable format (
bin/bios.exe) that can be uploaded via the bootloader.For bootloader VHDL image (to synthesize into bitstream):
-
Edit the linker script
neorv32-hal/src/link.ld:Change the ROM origin from:
rom (rx) : ORIGIN = 0x0, LENGTH = 0x10000To:
rom (rx) : ORIGIN = 0xFFE00000, LENGTH = 0x10000 -
Run the build script:
Linux/macOS:
./build_bld_vhd.sh
Windows:
build_bld_vhd.bat
This script builds the Ada firmware and generates a VHDL file (
neorv32/rtl/core/neorv32_bootloader_image.vhd) that will be synthesized directly into the FPGA bitstream as the bootloader ROM. -
-
Install gtkterm:
sudo apt install gtkterm
-
Connect to bootloader:
gtkterm --port /dev/ttyUSB0 --speed 19200
Set
CR LF autoin Configuration menu. -
Upload firmware:
- Type
uatCMD:>prompt - Press Ctrl+Shift+R and select
bin/bios.exe - After upload completes, type
eto execute
- Type
-
Install Tera Term: Download from teratermproject.github.io
-
Connect to bootloader:
- Open Tera Term
- Select your COM port (e.g., COM3)
- Set speed to 19200 baud, 8N1
- Go to Setup β Terminal β Set "New-line" to "Receive: AUTO" and "Transmit: CR+LF"
-
Upload firmware:
- Type
uatCMD:>prompt - Go to File β Transfer β XMODEM β Send
- Select
bin\bios.exe - After upload completes, type
eto execute
- Type
For information on integrating neorv32_hal into your own Ada projects, see the neorv32-hal README.
- NEORV32 Documentation
- neorv32-hal Repository
- Ada Blog Post: Open Source Ada from Gateware to Application
- NEORV32 User Guide
- Original neorv32-setups Repository
See LICENSE for details.