Skip to content

Commit ff79dab

Browse files
authored
Merge pull request #835 from tyeth/add-c5-devkit
Add Espressif C5 devkit
2 parents 88dc0bb + 2d13933 commit ff79dab

File tree

11 files changed

+117
-29
lines changed

11 files changed

+117
-29
lines changed

.github/workflows/build-clang-doxy.yml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ jobs:
145145
board_name=${board_name%_noota}
146146
# Remove 'wippersnapper_' prefix if present
147147
board_name=${board_name#wippersnapper_}
148+
# Remove 'espressif_' prefix if present
149+
board_name=${board_name#espressif_}
148150
content=$(cat ws-boards/boards/${board_name//_/-}/definition.json)
149151
{
150152
echo 'boardJson<<EOF'
@@ -367,6 +369,7 @@ jobs:
367369
"itsybitsy_esp32",
368370
"dfrobot_beetle_esp32c3",
369371
"wippersnapper_qtpy_esp32c3",
372+
"espressif_esp32c5_devkitc_1_n8r4",
370373
"wippersnapper_feather_esp32c6"
371374
]
372375
include:
@@ -375,6 +378,8 @@ jobs:
375378
arduino-platform: "dfrobot_beetle_esp32c3"
376379
- offset: "0x0"
377380
arduino-platform: "wippersnapper_qtpy_esp32c3"
381+
- offset: "0x2000"
382+
arduino-platform: "espressif_esp32c5_devkitc_1_n8r4"
378383
- offset: "0x0"
379384
arduino-platform: "wippersnapper_feather_esp32c6"
380385
steps:
@@ -450,7 +455,7 @@ jobs:
450455
mv nanopb/pb.h src/nanopb/nanopb.pb.h
451456
- name: Install Dependencies
452457
run: |
453-
pip install esptool==4.6
458+
pip install esptool
454459
- name: build ESP32 platforms
455460
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000
456461
- name: Check artifacts
@@ -459,6 +464,8 @@ jobs:
459464
- name: Rename build artifacts to reflect the platform name
460465
run: |
461466
mv examples/Wippersnapper_demo/build/*/Wippersnapper_demo.ino.bin wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.bin
467+
## We manually merge our own binary instead of relying on the arduino-cli auto-merged one. Uncomment to diagnose differences.
468+
# mv examples/Wippersnapper_demo/build/*/Wippersnapper_demo.ino.merged.bin wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.auto-merge.bin
462469
mv examples/Wippersnapper_demo/build/*/Wippersnapper_demo.ino.elf wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.elf
463470
mv examples/Wippersnapper_demo/build/*/Wippersnapper_demo.ino.map wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.map
464471
mv examples/Wippersnapper_demo/build/*/Wippersnapper_demo.ino.bootloader.bin wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.bootloader.bin
@@ -482,6 +489,8 @@ jobs:
482489
board_name=${board_name%_noota}
483490
# Remove 'wippersnapper_' prefix if present
484491
board_name=${board_name#wippersnapper_}
492+
# Remove 'espressif_' prefix if present
493+
board_name=${board_name#espressif_}
485494
content=$(cat ws-boards/boards/${board_name//_/-}/definition.json)
486495
{
487496
echo 'boardJson<<EOF'
@@ -492,14 +501,11 @@ jobs:
492501
run: |
493502
echo ${{ steps.get_board_json.outputs.boardJson }}
494503
echo ${{ fromJson(steps.get_board_json.outputs.boardJson) }}
495-
python3 -m esptool --chip ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.chip}} merge_bin \
496-
--flash_mode ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.flashMode}} \
497-
--flash_freq ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.flashFreq}} \
498-
--flash_size ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.flashSize}} \
504+
python3 -m esptool --chip ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.chip}} merge-bin \
505+
--flash-mode keep --flash-freq keep --flash-size keep \
499506
-o wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.combined.bin \
500507
${{ matrix.offset }} wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.bootloader.bin \
501508
0x8000 wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.partitions.bin \
502-
0xe000 wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.boot_app0.bin \
503509
0x10000 wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.bin
504510
- name: Zip build artifacts
505511
run: |
@@ -905,11 +911,15 @@ jobs:
905911
arduino-platform:
906912
[
907913
"wippersnapper_feather_esp32c6_debug",
914+
"espressif_esp32c5_devkitc_1_n8r4_debug",
908915
]
909916
include:
910917
- offset: "0x1000"
911918
- offset: "0x0"
912919
arduino-platform: "wippersnapper_feather_esp32c6_debug"
920+
- offset: "0x2000"
921+
arduino-platform: "espressif_esp32c5_devkitc_1_n8r4_debug"
922+
913923
steps:
914924
- name: "skip if unwanted"
915925
continue-on-error: true
@@ -983,7 +993,7 @@ jobs:
983993
mv nanopb/pb.h src/nanopb/nanopb.pb.h
984994
- name: Install Dependencies
985995
run: |
986-
pip3 install esptool==4.6
996+
pip3 install esptool
987997
- name: build ESP32 platforms
988998
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000
989999
- name: Check artifacts
@@ -992,6 +1002,7 @@ jobs:
9921002
- name: Rename build artifacts to reflect the platform name
9931003
run: |
9941004
mv examples/wippersnapper_debug/build/*/wippersnapper_debug.ino.bin wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.bin
1005+
mv examples/wippersnapper_debug/build/*/wippersnapper_debug.ino.merged.bin wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.auto-merge.bin
9951006
mv examples/wippersnapper_debug/build/*/wippersnapper_debug.ino.elf wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.elf
9961007
mv examples/wippersnapper_debug/build/*/wippersnapper_debug.ino.map wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.map
9971008
mv examples/wippersnapper_debug/build/*/wippersnapper_debug.ino.bootloader.bin wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.bootloader.bin
@@ -1017,6 +1028,8 @@ jobs:
10171028
board_name=${board_name%_debug}
10181029
# Remove 'wippersnapper_' prefix if present
10191030
board_name=${board_name#wippersnapper_}
1031+
# Remove 'espressif_' prefix if present
1032+
board_name=${board_name#espressif_}
10201033
content=$(cat ws-boards/boards/${board_name//_/-}/definition.json)
10211034
{
10221035
echo 'boardJson<<EOF'
@@ -1027,14 +1040,11 @@ jobs:
10271040
run: |
10281041
echo ${{ steps.get_board_json.outputs.boardJson }}
10291042
echo ${{ fromJson(steps.get_board_json.outputs.boardJson) }}
1030-
python3 -m esptool --chip ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.chip}} merge_bin \
1031-
--flash_mode ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.flashMode}} \
1032-
--flash_freq ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.flashFreq}} \
1033-
--flash_size ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.flashSize}} \
1043+
python3 -m esptool --chip ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.chip}} merge-bin \
1044+
--flash-mode keep --flash-freq keep --flash-size keep \
10341045
-o wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.combined.bin \
10351046
${{ matrix.offset }} wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.bootloader.bin \
10361047
0x8000 wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.partitions.bin \
1037-
0xe000 wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.boot_app0.bin \
10381048
0x10000 wippersnapper.${{ matrix.arduino-platform }}.littlefs.${{ env.WS_VERSION }}.bin
10391049
- name: Zip build artifacts
10401050
run: |

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ You will need a **free** [Adafruit IO](https://io.adafruit.com) account to use W
2020

2121
|Platform| MCU(s) |
2222
|--|--|
23-
|[ESP32-x](https://github.com/espressif/arduino-esp32)| ESP32, ESP32-Sx, ESP32-C3, ESP32-C6 |
23+
|[ESP32-x](https://github.com/espressif/arduino-esp32)| ESP32, ESP32-Sx, ESP32-C3, ESP32-C5, ESP32-C6 |
2424
|[ESP8266](https://github.com/esp8266/Arduino)| ESP8266 |
2525
|[RP2040](https://github.com/earlephilhower/arduino-pico)| RP2040 MCU w/WiFi (i.e: Pico W) |
2626
|[RP2350](https://github.com/earlephilhower/arduino-pico)| RP2350 MCU w/WiFi (i.e: Pico 2W) |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

platformio.ini

Lines changed: 59 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ lib_deps =
101101

102102
; Common build environment for ESP32 platform
103103
[common:esp32]
104-
platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.13/platform-espressif32.zip
105-
;;Funhouse uses 3.0.7 of arduino-esp32 for now:
106-
; platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.07/platform-espressif32.zip
104+
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.33/platform-espressif32.zip
107105
; This is needed for occasional new features and bug fixes
108106
; platform = https://github.com/pioarduino/platform-espressif32#develop
109107
lib_ignore = WiFiNINA, WiFiNINA_-_Adafruit_Fork, WiFi101, OneWire
@@ -150,7 +148,6 @@ build_flags = -DARDUINO_FEATHER_ESP32
150148
board_build.filesystem = littlefs
151149
board_build.partitions = min_spiffs.csv
152150

153-
154151
; Adafruit ESP32 Feather V2
155152
[env:featheresp32v2]
156153
extends = common:esp32
@@ -177,6 +174,33 @@ build_flags =
177174
board_build.filesystem = littlefs
178175
board_build.partitions = min_spiffs.csv
179176

177+
; Espressif ESP32-C5 8MB FLASH 2MB PSRAM ESP32-C5-DevKitC-1
178+
[env:espressif_esp32-c5-devkitc-1-n8r4]
179+
extends = common:esp32
180+
board = esp32-c5-devkitc1-n8r4
181+
build_type = debug
182+
; debug_tool = esp-builtin
183+
; upload_protocol = esp-builtin
184+
; debug_init_break = tbreak setup
185+
board_build.f_flash = 80000000L
186+
board_build.flash_size = 8MB
187+
board_build.flash_mode = qio
188+
board_build.boot_mode = dio
189+
board_build.f_cpu = 240000000L
190+
build_flags =
191+
-DWS_ESPRESSIF_ESP32C5_DEVKITC_1_N8R4
192+
-DARDUINO_ESP32C5_DEV
193+
-DDEBUG=1
194+
-DARDUINO_USB_MODE=1
195+
-DARDUINO_USB_CDC_ON_BOOT=1
196+
-DESP_LOG_LEVEL=5
197+
-DARDUINO_LOG_LEVEL=5
198+
-DCORE_DEBUG_LEVEL=5
199+
-DBOARD_HAS_PSRAM
200+
; -DMQTT_DEBUG=1
201+
board_build.filesystem = littlefs
202+
board_build.partitions = min_spiffs.csv
203+
180204
; Espressif ESP32-C6 4MB NO PSRAM esp32-c6-devkitm-1
181205
[env:espressif_esp32-c6-devkitm-1]
182206
extends = common:esp32
@@ -185,7 +209,6 @@ build_type = debug
185209
build_flags =
186210
-DARDUINO_ESPRESSIF_ESP32C6_DEVKITM_1
187211
-DARDUINO_ADAFRUIT_FEATHER_ESP32C6
188-
-DNDEBUG=1
189212
-DDEBUG=1
190213
-DESP_LOG_LEVEL=5
191214
-DARDUINO_CORE_DEBUG_LEVEL=5
@@ -196,6 +219,8 @@ build_flags =
196219
board_build.filesystem = littlefs
197220
board_build.partitions = min_spiffs.csv
198221

222+
223+
199224
; Adafruit Feather ESP32-S2
200225
[env:featheresp32s2]
201226
extends = common:esp32
@@ -299,6 +324,35 @@ build_flags = -DARDUINO_FUNHOUSE -DBOARD_HAS_PSRAM
299324
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
300325
extra_scripts = pre:rename_usb_config.py
301326

327+
; Adafruit Funhouse ESP32-S2
328+
[env:adafruit_funhouse_esp32s2_debug]
329+
extends = common:esp32
330+
board = adafruit_funhouse_esp32s2
331+
;lib_extra_dirs =
332+
build_type = debug
333+
build_flags =
334+
-DARDUINO_FUNHOUSE
335+
-DBOARD_HAS_PSRAM
336+
-DCFG_TUSB_DEBUG=1
337+
-DDEBUG=1
338+
-DESP_LOG_LEVEL=ESP_LOG_VERBOSE
339+
-DARDUINO_CORE_DEBUG_LEVEL=5
340+
-DCORE_DEBUG_LEVEL=5
341+
-DARDUHAL_LOG_LEVEL=5
342+
; USB Configuration
343+
; Uncomment if USB CDC on boot is needed
344+
; -DARDUINO_USB_CDC_ON_BOOT=1
345+
; -DARDUINO_USB_MODE=0 ; 0 for CDC + TinyUSB, 1 for Hardware CDC + JTAG
346+
; LVGL Debugging
347+
-DLV_USE_DEBUG=1
348+
-DLV_USE_LOG=1
349+
-DLV_LOG_PRINTF=1
350+
-DLV_LOG_COLOR=1
351+
-DLV_LOG_LEVEL=LV_LOG_LEVEL_TRACE
352+
;set partition to tinyuf2-partitions-4MB.csv as of idf 5.1
353+
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
354+
extra_scripts = pre:rename_usb_config.py
355+
302356
; Adafruit QT Py ESP32 Pico
303357
[env:adafruit_qtpy_esp32]
304358
extends = common:esp32
@@ -376,7 +430,6 @@ build_flags =
376430
-DARDUINO_ADAFRUIT_QTPY_ESP32S3_N4R2
377431
-DBOARD_HAS_PSRAM
378432
-DCFG_TUSB_DEBUG=1
379-
-DNDEBUG=1
380433
-DDEBUG=1
381434
-DESP_LOG_LEVEL=5
382435
-DARDUINO_CORE_DEBUG_LEVEL=5
@@ -497,7 +550,6 @@ build_flags = -DUSE_TINYUSB
497550
-DARDUINO_USB_CDC_ON_BOOT=1
498551
-DCFG_TUSB_DEBUG=1
499552
-DDEBUG=1
500-
-DNDEBUG=1
501553
-DUSE_AIRLIFT=1
502554
-g
503555
; -DUSBCON
@@ -565,7 +617,6 @@ build_flags =
565617
-DDEBUG_RP2040_SPI
566618
-DDEBUG_RP2040_CORE
567619
-DDEBUG_RP2040_WIFI
568-
-DNDEBUG
569620
-DLWIP_DEBUG=1
570621
-DDEBUG_RP2040_PORT=Serial1
571622
-DDEBUG_RP2040_UART_1
@@ -621,7 +672,6 @@ build_flags =
621672
; -DDEBUG_RP2040_SPI
622673
; -DDEBUG_RP2040_CORE
623674
; -DDEBUG_RP2040_WIFI
624-
; -DNDEBUG
625675
; -DLWIP_DEBUG
626676
; -DDEBUG_RP2040_PORT=Serial1
627677
; -DDEBUG_RP2040_UART_1

src/Wippersnapper.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2757,6 +2757,12 @@ void printDeviceInfo() {
27572757
WS_DEBUG_PRINTLN(BOARD_ID);
27582758
WS_DEBUG_PRINT("Adafruit.io User: ");
27592759
WS_DEBUG_PRINTLN(WS._config.aio_user);
2760+
if (strncmp(WS._config.aio_url, "io.adafruit.com", 16) != 0) {
2761+
WS_DEBUG_PRINT("Adafruit.io URL: ");
2762+
WS_DEBUG_PRINTLN(WS._config.aio_url);
2763+
WS_DEBUG_PRINT("Adafruit.io Port: ");
2764+
WS_DEBUG_PRINTLN(WS._config.io_port);
2765+
}
27602766
WS_DEBUG_PRINT("WiFi Network: ");
27612767
WS_DEBUG_PRINTLN(WS._config.network.ssid);
27622768

src/Wippersnapper_Boards.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,16 @@
171171
#define USE_STATUS_NEOPIXEL
172172
#define STATUS_NEOPIXEL_PIN PIN_NEOPIXEL
173173
#define STATUS_NEOPIXEL_NUM 1
174+
#elif defined(ARDUINO_ESP32C5_DEV)
175+
#define BOARD_ID "esp32c5-devkitc-1-n8r4"
176+
#define USE_LITTLEFS
177+
#define USE_STATUS_NEOPIXEL
178+
#define STATUS_NEOPIXEL_PIN PIN_RGB_LED
179+
// PIN_RGB_LED = 27, or GPIO_NUM+27 if using RGBwrite()
180+
#define STATUS_NEOPIXEL_NUM 1
181+
#ifdef BOARD_HAS_PSRAM
182+
#define USE_PSRAM ///< Board has PSRAM, use it for dynamic memory allocation
183+
#endif
174184
#elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32_V2)
175185
#define BOARD_ID "feather-esp32-v2"
176186
#define USE_LITTLEFS

src/network_interfaces/Wippersnapper_ESP32.h

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,20 @@ class Wippersnapper_ESP32 : public Wippersnapper {
196196
_mqtt_client_secure, WS._config.aio_url, WS._config.io_port, clientID,
197197
WS._config.aio_user, WS._config.aio_key);
198198
} else {
199-
// Insecure connections require a NetworkClient object rather than a
200-
// NetworkClientSecure object
201-
_mqtt_client_insecure = new NetworkClient();
202-
WS._mqtt = new Adafruit_MQTT_Client(
203-
_mqtt_client_insecure, WS._config.aio_url, WS._config.io_port,
204-
clientID, WS._config.aio_user, WS._config.aio_key);
199+
if (WS._config.io_port == 8883) {
200+
_mqtt_client_secure = new NetworkClientSecure();
201+
_mqtt_client_secure->setInsecure();
202+
WS._mqtt = new Adafruit_MQTT_Client(
203+
_mqtt_client_secure, WS._config.aio_url, WS._config.io_port,
204+
clientID, WS._config.aio_user, WS._config.aio_key);
205+
} else {
206+
// Insecure connections require a NetworkClient object rather than a
207+
// NetworkClientSecure object
208+
_mqtt_client_insecure = new NetworkClient();
209+
WS._mqtt = new Adafruit_MQTT_Client(
210+
_mqtt_client_insecure, WS._config.aio_url, WS._config.io_port,
211+
clientID, WS._config.aio_user, WS._config.aio_key);
212+
}
205213
}
206214
}
207215

0 commit comments

Comments
 (0)