Skip to content

Latest commit

 

History

History

embed

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Adding libriscv to your project

This example project shows how you can embed libriscv in your own CMake projects.

We use FetchContent in order to retrive the latest version of libriscv:

include(FetchContent)
FetchContent_Declare(libriscv
  GIT_REPOSITORY https://github.com/fwsGonzo/libriscv
  GIT_TAG        master
  )

FetchContent_MakeAvailable(libriscv)

This will give us access to the riscv library in CMake. The library will automatically add includes and libraries to your own projects:

add_executable(example example.cpp)
target_link_libraries(example riscv)

fib.rv64.elf

The example program calculates fibonacci numbers. Run the program with the number as argument:

./.build/example fib.rv64.elf 64

Will calculate the 64th fibonacci number.