From 0755145824d6159e46d5ddf58bec3903f019ab9c Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Tue, 14 Apr 2026 18:51:27 -0500 Subject: [PATCH] create generic targets for esp32 boards --- GNUmakefile | 15 ++++++--------- src/examples/pwm/esp32s3-wroom1.go | 11 ----------- src/machine/board_esp32-generic.go | 9 +++++++++ src/machine/board_esp32c3-generic.go | 8 ++++++++ src/machine/board_esp32s3-generic.go | 18 ++++++++++++++++++ src/machine/board_esp32s3-wroom1.go | 18 ------------------ targets/esp32-generic.json | 4 ++++ targets/esp32c3-generic.json | 4 ++++ targets/esp32s3-generic.json | 4 ++++ targets/esp32s3-wroom1.json | 4 ---- 10 files changed, 53 insertions(+), 42 deletions(-) delete mode 100644 src/examples/pwm/esp32s3-wroom1.go create mode 100644 src/machine/board_esp32-generic.go create mode 100644 src/machine/board_esp32c3-generic.go create mode 100644 src/machine/board_esp32s3-generic.go delete mode 100644 src/machine/board_esp32s3-wroom1.go create mode 100644 targets/esp32-generic.json create mode 100644 targets/esp32c3-generic.json create mode 100644 targets/esp32s3-generic.json delete mode 100644 targets/esp32s3-wroom1.json diff --git a/GNUmakefile b/GNUmakefile index b0840b681..0838926a6 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -913,6 +913,12 @@ endif $(TINYGO) build -size short -o test.hex -target=digispark -gc=leaking examples/blinky1 @$(MD5SUM) test.hex ifneq ($(XTENSA), 0) + $(TINYGO) build -size short -o test.bin -target=esp32-generic examples/machinetest + @$(MD5SUM) test.bin + $(TINYGO) build -size short -o test.bin -target=esp32c3-generic examples/machinetest + @$(MD5SUM) test.bin + $(TINYGO) build -size short -o test.bin -target=esp32s3-generic examples/machinetest + @$(MD5SUM) test.bin $(TINYGO) build -size short -o test.bin -target=esp32-mini32 examples/blinky1 @$(MD5SUM) test.bin $(TINYGO) build -size short -o test.bin -target=esp32c3-supermini examples/blinky1 @@ -951,15 +957,6 @@ ifneq ($(XTENSA), 0) @$(MD5SUM) test.bin $(TINYGO) build -size short -o test.bin -target=esp32s3-supermini examples/adc @$(MD5SUM) test.bin - # esp32s3-wroom1 - $(TINYGO) build -size short -o test.bin -target=esp32s3-wroom1 examples/blinkm - @$(MD5SUM) test.bin - $(TINYGO) build -size short -o test.bin -target=esp32s3-wroom1 examples/mcp3008 - @$(MD5SUM) test.bin - $(TINYGO) build -size short -o test.bin -target=esp32s3-wroom1 examples/pwm - @$(MD5SUM) test.bin - $(TINYGO) build -size short -o test.bin -target=xiao-esp32s3 examples/adc - @$(MD5SUM) test.bin endif # esp32c3-supermini $(TINYGO) build -size short -o test.bin -target=esp32c3-supermini examples/blinky1 diff --git a/src/examples/pwm/esp32s3-wroom1.go b/src/examples/pwm/esp32s3-wroom1.go deleted file mode 100644 index b3e5dcb58..000000000 --- a/src/examples/pwm/esp32s3-wroom1.go +++ /dev/null @@ -1,11 +0,0 @@ -//go:build esp32s3_wroom1 - -package main - -import "machine" - -var ( - pwm = machine.PWM0 - pinA = machine.GPIO17 - pinB = machine.GPIO18 -) diff --git a/src/machine/board_esp32-generic.go b/src/machine/board_esp32-generic.go new file mode 100644 index 000000000..41b8e3d46 --- /dev/null +++ b/src/machine/board_esp32-generic.go @@ -0,0 +1,9 @@ +//go:build esp32_generic + +package machine + +// I2C pins +const ( + SDA_PIN = NoPin + SCL_PIN = NoPin +) diff --git a/src/machine/board_esp32c3-generic.go b/src/machine/board_esp32c3-generic.go new file mode 100644 index 000000000..d6956fbed --- /dev/null +++ b/src/machine/board_esp32c3-generic.go @@ -0,0 +1,8 @@ +//go:build esp32c3_generic + +package machine + +const ( + SDA_PIN = NoPin + SCL_PIN = NoPin +) diff --git a/src/machine/board_esp32s3-generic.go b/src/machine/board_esp32s3-generic.go new file mode 100644 index 000000000..2f18ffc4b --- /dev/null +++ b/src/machine/board_esp32s3-generic.go @@ -0,0 +1,18 @@ +//go:build esp32s3_generic + +package machine + +const ( + SCL_PIN = NoPin + SDA_PIN = NoPin + + SPI1_SCK_PIN = NoPin // SCK + SPI1_MOSI_PIN = NoPin // SDO (MOSI) + SPI1_MISO_PIN = NoPin // SDI (MISO) + SPI1_CS_PIN = NoPin // CS + + SPI2_SCK_PIN = NoPin // SCK + SPI2_MOSI_PIN = NoPin // SDO (MOSI) + SPI2_MISO_PIN = NoPin // SDI (MISO) + SPI2_CS_PIN = NoPin // CS +) diff --git a/src/machine/board_esp32s3-wroom1.go b/src/machine/board_esp32s3-wroom1.go deleted file mode 100644 index 20c888318..000000000 --- a/src/machine/board_esp32s3-wroom1.go +++ /dev/null @@ -1,18 +0,0 @@ -//go:build esp32s3_wroom1 - -package machine - -const ( - SCL_PIN = GPIO17 - SDA_PIN = GPIO18 - - SPI1_SCK_PIN = GPIO12 // SCK - SPI1_MOSI_PIN = GPIO11 // SDO (MOSI) - SPI1_MISO_PIN = GPIO13 // SDI (MISO) - SPI1_CS_PIN = GPIO10 // CS - - SPI2_SCK_PIN = GPIO36 // SCK - SPI2_MOSI_PIN = GPIO35 // SDO (MOSI) - SPI2_MISO_PIN = GPIO37 // SDI (MISO) - SPI2_CS_PIN = GPIO34 // CS -) diff --git a/targets/esp32-generic.json b/targets/esp32-generic.json new file mode 100644 index 000000000..84dd729bd --- /dev/null +++ b/targets/esp32-generic.json @@ -0,0 +1,4 @@ +{ + "inherits": ["esp32"], + "build-tags": ["esp32_generic"] +} diff --git a/targets/esp32c3-generic.json b/targets/esp32c3-generic.json new file mode 100644 index 000000000..198671e63 --- /dev/null +++ b/targets/esp32c3-generic.json @@ -0,0 +1,4 @@ +{ + "inherits": ["esp32c3"], + "build-tags": ["esp32c3_generic"] +} diff --git a/targets/esp32s3-generic.json b/targets/esp32s3-generic.json new file mode 100644 index 000000000..c44201c8a --- /dev/null +++ b/targets/esp32s3-generic.json @@ -0,0 +1,4 @@ +{ + "inherits": ["esp32s3"], + "build-tags": ["esp32s3_generic"] +} \ No newline at end of file diff --git a/targets/esp32s3-wroom1.json b/targets/esp32s3-wroom1.json deleted file mode 100644 index 56f8d57d2..000000000 --- a/targets/esp32s3-wroom1.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "inherits": ["esp32s3"], - "build-tags": ["esp32s3_wroom1"] -} \ No newline at end of file