Hi everyone,
I wanted to share with you a blog post I’ve written about how to write the startup code for the SiFive FE310-G002 processor in easily understandable C++ instead of quite-hard-to-read assembler code.
You can finde the blog post here: https://snowfox-project.org/blog/2020/04/04/microcontroller-startup-code-written-in-cpp/
In case you want to investigate the code’s behaviour on real hardware you can do so easily with the Segger Ozone debugging tool. In order to do that please follow the following steps:
#1: Download/Install RISCV64 compiler
sudo wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.2.0-2019.02.0-x86_64-linux-ubuntu14.tar.gz
sudo tar -xzvf riscv64-unknown-elf-gcc-8.2.0-2019.02.0-x86_64-linux-ubuntu14.tar.gz
export PATH=$PATH:/opt/riscv64-unknown-elf-gcc-8.2.0-2019.02.0-x86_64-linux-ubuntu14/bin
#2: Clone the Snowfox Repository with all examples
git clone --recurse-submodules https://github.com/snowfox-project/snowfox.git
cd snowfox
#3 Build the SiFive FE310-G002 LED blink example (the compiled binary is located in build/bin/hal-fe310-digital-out-pin
)
.ci/script/run-build-example.sh examples/hal/FE310/hal-fe310-digital-out-pin
#4: Download, install, start and configure Segger Ozone
#4a: Select the right device (FE310), Register Set (RV32I) and an optional peripheral file
#4b: Confirm that the HiFive 1 board is connected and the onboard JLink adapter is visible
#4c: Select the binary file for upload/debugging (snowfox/build/bin/hal-fe310-digital-out-pin
)
#4d: Download binary via Download & Reset Programm
and perform a reset and halt in order to start debugging from the very beginning via Reset & Halt
Kindly let me know any suggestions for improvements or if there is anything I missed
EDIT: @moderators if you could please remove the constraints of one-picture-per-post for my forum account so that I can add the other screenshots which is something I currently can’t.