Skip to content

Bare metal programming on the RED-V Thing Plus board (SiFive RISC-V FE310 SoC)

License

Notifications You must be signed in to change notification settings

Embedded-System-Lovers/RED-V_SiFive_RISC-V_FE310_SoC

Repository files navigation

RED-V_SiFive_RISC-V_FE310_SoC

Bare metal programming on the RED-V Thing Plus board (SiFive RISC-V FE310 SoC).

Build Status Unlicense

This repository implements an entirely manually-written, pure bare metal Blinky Project for the SiFive RISC-V FE310 SoC (on the RED-V Thing Plus board).

Features include:

  • CPU, power, chip, clock and PLL initialization,
  • timebase derived from mtimer,
  • blinky LED show with adjustable frequency,
  • implementation in C99 with absolute minimal use of assembly.

Clear and easy-to-understand build systems based on either GNUmake or CMake complete this fun and educational project.

This repository provides keen insight on starting up a bare metal SiFive RISC-V controller. It emphasizes simplicity and independence from monolithic toolchains through its lightweight, self-written implementation.

Details on the Application

The application boots from a tiny startup code in the boot ROM.

Following low-level chip initialization, the program jumps to the main() subroutine. Here the timer interrupt is setup for LED blinky.

The adjustable LED-phase (its half-period) can be tuned to provide a rudimentary, visible blinky LED show. The timebase for blinky is based on the mtimer interrupt handler.

Blinky running on the target is shown in the image below.

Building the Application

Build on *nix* is easy using gcc-riscv32-unknown-elf

Both Make and Cmake can be used to build the Application:

cd RED-V_SiFive_RISC-V_FE310_SoC

Make

./Rebuild.sh

CMake

mkdir Output && cd Output
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-unix.cmake .. && make

The build results including ELF-file, HEX-mask, MAP-file and assembly list file are created in the Outputdirectory.

If gcc-riscv32-unknown-elf is not installed, it can easily be obtained from embecosm. Add the path of the RISC-V GCC tools' bin folder to $PATH in the usual *nix way.

Continuous Integration

CI runs on pushes and pull-requests with simple build(s) including result verification on ubuntu-latest and macos-latest using GitHub Actions.

Licensing

About

Bare metal programming on the RED-V Thing Plus board (SiFive RISC-V FE310 SoC)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published