Compiling NuttX to ESP32-C3

First you need to install the risc-v toolchain:

$ cd /tmp
$ wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz
$ tar xvf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz
$ cd riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14
$ sudo cp -a * /usr/local/

Clone the nuttx and apps repositories:

$ mkdir ~/nuttxspace
$ cd ~/nuttxspace
$ git clone https://github.com/protobits/incubator-nuttx nuttx
$ git clone https://github.com/protobits/incubator-nuttx-apps apps

Configure the board:
$ cd nuttx
$ ./tools/configure.sh esp32c3-devkit:nsh

Compile:

$ make

Convert the NuttX ELF file:

$ esptool.py --chip esp32-c3 elf2image --flash_mode dio --flash_size 2MB -o ./nuttx.bin nuttx

Put the board in bootloader mode (press and hold Boot button and click on RST button, release Boot button)
Flash it:

$ sudo esptool.py --chip esp32-c3 --port /dev/ttyUSB0 --baud 921600 write_flash 0x10000 nuttx.bin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s