How to program this ESP32-C3 Lua board in C++?

I’m using the newest PlatformIO and VS Code on Ubuntu 22.04.2. I have a Hezhou CORE ESP32 core board (, which comes with Lua interpreter:

Screenshot from 2023-05-07 21-51-53

I was able to upload a simple blinky sketch (C++) with Arduino IDE 2.1 selecting Adafruit QtPy board and these settings:


I would like to program this board with PlatformIO. What would be a platformio.ini file with the settings from screen capture above?

Will uploading the binaries created by PlatformIO remove Lua firmware, so I can program the board in C++ like many other ESP32 boards?

I just found Using Luatos ESP32C3. Will test and post the results.

It seems that this board is supported as Deneyap Kart G, but freshly updated PlatformIO v6.1.7 responds to:

platform = espressif32
board = deneyapkartg
framework = arduino


Resolving deneyapkartg dependencies...
Error: Unknown board ID 'deneyapkartg'

The documentation version is 6.1.8a1. Do I have to wait for PlatformIO v6.1.8 to get this board ID recognized?

I copied deneyapkartg.json file from documentation to boards folder:

but the project fails to build now:

Processing deneyapkartg (platform: espressif32; board: deneyapkartg; framework: arduino)
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: Espressif 32 (4.4.0) > Deneyap Kart G
HARDWARE: ESP32C3 160MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
 - framework-arduinoespressif32 @ 3.20003.0 (2.0.3) 
 - tool-esptoolpy @ 1.30300.0 (3.3.0) 
 - tool-mkfatfs @ 2.0.1 
 - tool-mklittlefs @ 1.203.210628 (2.3) 
 - tool-mkspiffs @ 2.230.0 (2.30) 
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch3
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 32 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/deneyapkartg/src/main.cpp.o
Generating partitions .pio/build/deneyapkartg/partitions.bin
Archiving .pio/build/deneyapkartg/libFrameworkArduinoVariant.a
Indexing .pio/build/deneyapkartg/libFrameworkArduinoVariant.a
Compiling .pio/build/deneyapkartg/FrameworkArduino/Esp.cpp.o
Compiling .pio/build/deneyapkartg/FrameworkArduino/FirmwareMSC.cpp.o
Compiling .pio/build/deneyapkartg/FrameworkArduino/FunctionalInterrupt.cpp.o
Compiling .pio/build/deneyapkartg/FrameworkArduino/HWCDC.cpp.o
Compiling .pio/build/deneyapkartg/FrameworkArduino/HardwareSerial.cpp.o
Compiling .pio/build/deneyapkartg/FrameworkArduino/IPAddress.cpp.o
Compiling .pio/build/deneyapkartg/FrameworkArduino/IPv6Address.cpp.o
Compiling .pio/build/deneyapkartg/FrameworkArduino/MD5Builder.cpp.o
/home/paul/.platformio/packages/framework-arduinoespressif32/cores/esp32/HardwareSerial.cpp:6:10: fatal error: pins_arduino.h: No such file or directory

How to fix it?

Then your Espressif32 platform is not new enough.That’s why it doesn’t have the latest Arduino-ESP32 core too and throws you a missing pins_arduino.h error, because variants/deneyapkartg is not there.


  1. Remove deneyapkartg.json from your local project
  2. Open a PlatformIO core CLIpio pkg update -g -p espressif32
  3. Rebiuld while still referencing the above board name in the platformio.ini.

Thank you, it builds now. BTW, the log shows a dramatic version update:

Platform Manager: Updating espressif32 @ 4.4.0
Platform Manager: Removing espressif32 @ 4.4.0
Platform Manager: espressif32@4.4.0 has been removed!
Platform Manager: Installing platformio/espressif32 @ 6.2.0

I’ve been relying on VSCode auto updates. Should I update manually in the future, so I don’t fall that far behind?

I think I remember reading some time ago that auto-updating platforms were turned off because people couldn’t stand having their projects auto-broken with version increases. There’s always a losing side with this.

deneyapkartg is a wrong board specification - it uses ESP32C3 with 4MB of embedded Flash vs. Lua board with 4MB of external Flash. The boot fails. I can now program with this configuration:

platform = espressif32
board = esp32dev
board_build.mcu = esp32c3
framework = arduino

but it doesn’t provide serial communication through USB. I tried:

build_flags =  -DARDUINO_USB_CDC_ON_BOOT=1

but it makes Serial class undefined:

src/main.cpp: In function 'void setup()':
src/main.cpp:9:3: error: 'Serial' was not declared in this scope

It works fine with Arduino IDE.

Do you mean that PlatformIO Core auto-updates, which I witnessed, but underlying SDKs do not?

That’s uhm, an odd combination / rework. I don’t think that’s possible like that. Can you just try

board = lolin_c3_mini



It fails to boot after upload. Lolin uses ESP32C3 with embedded Flash. I think that configuration has to specify external Flash for correct boot.

Here is a configuration, which works:

platform = espressif32
board = lolin_c3_mini
framework = arduino
board_build.mcu = esp32c3
board_build.flash_mode = dio
1 Like