Attach an LED and a current limiting resistor between GPIO 2 and 3V3 pins of a development board.
- Make sure you have a
riscv-none-elf-gcc
toolchain installed and added to PATH. - Build the example with CMake:
For other chip, please use the
cd examples/blink mkdir build cmake -B build -D target=esp32c3 -G Ninja . cmake --build build
target=chip_name
, wherechip_name
can be any from the supported ones. You should get the following output at the end:The following files will be generated:[3/4] Running utility command for blink-size text data bss dec hex filename 1844 132 177 2153 869 blink [4/4] Generating blink.bin copy from `blink' [elf32-littleriscv] to `blink.bin' [binary]
blink
— ELF output fileblink.bin
— binary file for flashing into the chipblink.map
— linker map file
- Flash the example using esptool:
(Adjust the serial port name as needed.)
esptool.py --port /dev/ttyUSB0 --baud 921600 write_flash 0x0000 build/blink.bin
- The LED attached to GPIO 2 should be blinking at around 3 Hz rate for ESP32-C3 (frequency can be vary depending on the maximum frequency of the selected chip).