https://github.com/codeljo/riscv-bare-metal
RISC-V Bare Metal Starter Kit
https://github.com/codeljo/riscv-bare-metal
esp32-c2 esp32-c3 esp32-c6 esp32-c6-devkitc-1-n8 esp32-h2 risc-v riscv riscv32
Last synced: 4 months ago
JSON representation
RISC-V Bare Metal Starter Kit
- Host: GitHub
- URL: https://github.com/codeljo/riscv-bare-metal
- Owner: codeljo
- License: mit
- Created: 2024-08-19T00:30:03.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-09-16T19:05:51.000Z (9 months ago)
- Last Synced: 2024-09-17T00:10:00.226Z (9 months ago)
- Topics: esp32-c2, esp32-c3, esp32-c6, esp32-c6-devkitc-1-n8, esp32-h2, risc-v, riscv, riscv32
- Language: BitBake
- Homepage:
- Size: 149 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RISC-V Bare Metal Programming
[Supported Devices](#supported-devices)
[Requirements](#requirements)
[Build](#build-instructions)# Supported Devices
* ESP32-C2
* ESP32-C3
* ESP32-C6
* ESP32-H2
* Coming soon - Raspberry Pi Pico 2 (RP2350)
# Requirements
1. RISC-V Cross Compiler
2. Make
3. esptool
# Install Cross Compiler
**Linux**
>
apt install gcc-riscv64-unknown-elf
**macOS**
>
brew tap riscv-software-src/riscv
brew install riscv-tools
**Windows, macOS, Linux**
>
The xPack GNU RISC-V Embedded GCC
A standalone cross-platform (Windows, macOS, GNU/Linux) binary distribution of GNU RISC-V Embedded GCC.
https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack
# Install Make
**Linux**
>
apt install make**macOS**
>
brew install make**Windows**
>
[https://github.com/xpack-dev-tools/windows-build-tools-xpack/](https://github.com/xpack-dev-tools/windows-build-tools-xpack/)
# Install Python
>Note: Optional as there are binary releases of esptool available below.**Linux**
>
Python is usually installed by default.
Open a terminal and type: `python`
apt install python
**Linux, macOS, Windows**
>
[https://www.python.org/downloads/](https://www.python.org/downloads/)
# Install esptool
**Linux, macOS, Windows**
>
Binary Release
[https://github.com/espressif/esptool/releases](https://github.com/espressif/esptool/releases)
Python Version
[https://docs.espressif.com/projects/esptool/en/latest/esp32/installation.html](https://docs.espressif.com/projects/esptool/en/latest/esp32/installation.html)
pip install esptool
# Build Instructions
```
Configure build environment variablesLinux / macOS:
export BMV_CC=riscv64-unknown-elf-gcc
export BMV_ESPTOOL=esptool
export BMV_CHIP=esp32c3
export BMV_PORT=/dev/ttyACM0Windows:
set BMV_CC=riscv-none-elf-gcc
set BMV_ESPTOOL=esptool
set BMV_CHIP=esp32c3
set BMV_PORT=COM3Note: BMV_CC, BMV_ESPTOOL must specify the full path if they are not in your PATH.
Binary:
export BMV_ESPTOOL=/opt/riscv/esptool/esptool
Python:
export BMV_ESPTOOL="python /opt/riscv/esptool/esptool.py"
``````
Open a command prompt, and change to the root directory of this project.build:
make -C examples/blink/flash:
make -C examples/blink/ flashhelp:
make -C examples/blink help
```
# Usage
> Environment Variables
| variable | default | valid values |
| ----------------------- | ----------------------- | ------------------------------------------------------- |
| BMV_CC | riscv64-unknown-elf-gcc | riscv64-unknown-elf-gcc, riscv-none-elf-gcc, clang, ... |
| BMV_ESPTOOL | esptool | esptool, "python esptool.py" |
| BMV_CHIP | esp32c3 | esp32c2, esp32c3, esp32c6, esp32h2 |
| BMV_PORT | /dev/ttyACM0 | /dev/ttyUSB0, /dev/ttyACM0, ..., COM1, COM2, ... |>Environment Override
`make -C examples/blink clean flash BMV_CC=clang BMV_ESPTOOL=/opt/riscv/esptool/esptool BMV_CHIP=esp32c3 BMV_PORT=/dev/ttyACM0`
>Show available make commands
`make -C examples/blink help`