Compare commits

...

2 commits

Author SHA1 Message Date
a376d27260 updated readme with correct infomation on toolchain install for linux systems. 2026-02-15 16:28:51 -08:00
988b888f62 refactored the cmake toolchain configuration to use linuxator on FreeBSD
Now tested as being able to build hex/binary/elf files using the
`otto.sh` menu option 2.
2026-02-15 16:28:32 -08:00
2 changed files with 38 additions and 5 deletions

View file

@ -37,6 +37,7 @@ mkdir ./build && cd ./build
mkdir /usr/local/riscv && chmod -R 0775 /usr/local/riscv mkdir /usr/local/riscv && chmod -R 0775 /usr/local/riscv
# Setup to build newlib for 32bit embedded and compressed cpus. # Setup to build newlib for 32bit embedded and compressed cpus.
# Not needed for ch32fun as it uses musl
./configure --prefix=/usr/local/riscv --with-arch=rv32ec \ ./configure --prefix=/usr/local/riscv --with-arch=rv32ec \
--with-arch=rv32ec \ --with-arch=rv32ec \
--with-abi=ilp32e \ --with-abi=ilp32e \
@ -58,6 +59,36 @@ make -j4 build-binutils
Pretty much the same as FreeBSD, just follow the toolchain's `README.md` files Pretty much the same as FreeBSD, just follow the toolchain's `README.md` files
instructions. instructions.
First download the tar.gz file from the link in the requirements(Xpack).
Once you've downloaded the latest release extract the archive into it's own
file.
You should then move the contents into a new directory like so.
```sh
sudo mkdir -p /opt/riscv
tar -xvzf ./xpack<name_here>
sudo mv ./xpack<name_here>/* /opt/riscv/
```
You will also need to add the location to your path so it's picked up in your
terminal.
```sh
# Appends the new location on to the existing path variable.
echo "export PATH=/opt/riscv/bin:$PATH" >> ~/.bashrc
# Sources the bashrc(config file) to update current terminal session.
source ~/.bashrc
```
After following the above steps you should now have a working RISC-V toolchain
that can be used for development.
## TODO ## TODO

View file

@ -33,14 +33,16 @@ set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD") if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
message("OS:: FreeBSD") message("OS:: FreeBSD")
#set(NEWLIB /usr/local/riscv/riscv32-unknown-elf/include) #set(NEWLIB /usr/local/riscv/riscv32-unknown-elf/include)
set(NEWLIB /usr/local/lib/gcc/riscv32-unknown-elf/11.3.00/include) #set(NEWLIB /usr/local/lib/gcc/riscv32-unknown-elf/11.3.00/include)
set(CMAKE_C_COMPILER riscv32-unknown-elf-gcc) set(NEWLIB /compat/linux/opt/riscv/riscv-none-elf/include)
set(CMAKE_CXX_COMPILER riscv32-unknown-elf-g++) set(CMAKE_C_COMPILER riscv-none-elf-gcc)
set(CMAKE_ASM_COMPILER riscv32-unknown-elf-gcc) set(CMAKE_CXX_COMPILER riscv-none-elf-g++)
set(CMAKE_ASM_COMPILER riscv-none-elf-gcc)
# Don't know why this is here? # Don't know why this is here?
#set(CMAKE_FIND_ROOT_PATH /usr/local/riscv/) #set(CMAKE_FIND_ROOT_PATH /usr/local/riscv/)
set(CMAKE_FIND_ROOT_PATH /usr/local/lib/gcc/riscv32-unknown-elf/) #set(CMAKE_FIND_ROOT_PATH /usr/local/lib/gcc/riscv32-unknown-elf/)
set(CMAKE_FIND_ROOT_PATH /compat/linux/opt/riscv/)
#set(CMAKE_SYSROOT "/usr/local/riscv/" /usr/local/riscv/riscv32-unknown-elf) #set(CMAKE_SYSROOT "/usr/local/riscv/" /usr/local/riscv/riscv32-unknown-elf)