This project contains a chipyard-based hardware compilation for the ULX3S board. It runs linux until certain point, and only supports bootrom bootloaders. The intention is probably run some programs to do graphics via HDMI.
Clone using:
git clone https://github.com/ckdur/RISCVConsole.git
cd RISCVConsole
git submodule update --init
cd hardware/chipyard
./scripts/init-submodules-no-riscv-tools.shTo create the .bit file, please run:
export RISCV=/path/to/riscv32imac
cd fpga/ULX3S
make pack
sudo make programFor linux compiling, we offer also a repository named linux-custom:
git clone https://github.com/ckdur/linux-custom.git
cd linux-custom
git submodule update --init --recursive
# Creating buildroot
export XLEN=32
export RISCV=/path/to/riscv32imac
./run_buildroot.sh
# Creating linux
./run_linux.sh
# Creating OpenSBI
./run_opensbi.shFrom here, we format an SD card, and create a partition with the bootloader:
git clone https://github.com/tmagik/gptfdisk.git
cd gptfdisk
make all
sudo ./gptfdisk /dev/sdXSteps:
- Create GPT partition (n)
- Can be anywhere, but the size has to be less than 32M (or 65535 sectors)
- Use code 5202 for identify the partition as the bootloader (Stage 2 bootloader)
Then, copy the firmware of the opensbi to the partition
cd linux-custom
sudo dd if=./opensbi/build/platform/ratona/firmware/fw_payload.bin of=/dev/sdX1 conv=fsync bs=4096Instead of writing the SD card every time, a program (e.g. software/RISCVConsoleCode) can be loaded
into RAM through the JTAG adapter. The SD card boot still works as before: on reset sdboot copies the
SD partition to RAM and jumps there. If the SD card is missing or fails, sdboot now waits for JTAG
instead of jumping into an empty RAM.
The bootrom has a fixed JTAG entry at 0x10004, which jumps to the payload in RAM (0x80000000) with
a0 = hartid and a1 = DTB, exactly like the SD boot path.
source ~/init_riscv-multi.sh
cd software/RISCVConsoleCode && make elf && cd ..
# Reset, load the ELF into RAM and run it
./jtag-boot.sh RISCVConsoleCode/build/out.elf
# Same, but open gdb halted at the program entry (breakpoints, stepping, etc.)
./jtag-boot.sh -g RISCVConsoleCode/build/out.elfUse OPENOCD_CFG=/path/to/adapter.cfg to select another adapter config (default software/ftdi.cfg).
A compilation of 32-bit toolchain should work. The configuration that worked is as follows:
git clone https://github.com/riscv/riscv-gnu-toolchain.git
cd riscv-gnu-toolchain
sudo mkdir /opt/riscv32imac
sudo chown -R $USER /opt/riscv32imac
./configure --prefix=/opt/riscv32imac --with-arch=rv32imac --with-abi=ilp32
make && make linuxA test custom board was also done for QEMU. Compile it using:
cd linux-custom
./run_qemu.sh