summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_D2WD.cmake1
-rw-r--r--ports/esp32/boards/ESP32_GENERIC/sdkconfig.d2wd16
-rw-r--r--ports/esp32/boards/ESP32_GENERIC_C2/board.json3
-rw-r--r--ports/esp32/boards/ESP32_GENERIC_C2/board.md2
-rw-r--r--ports/esp32/boards/ESP32_GENERIC_C2/mpconfigboard.h5
-rw-r--r--ports/esp32/boards/ESP32_GENERIC_C2/mpconfigvariant_FLASH_2M.cmake10
-rw-r--r--ports/esp32/boards/sdkconfig.flash_2MiB17
7 files changed, 39 insertions, 15 deletions
diff --git a/ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_D2WD.cmake b/ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_D2WD.cmake
index 170c214bd..ec9998cfa 100644
--- a/ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_D2WD.cmake
+++ b/ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_D2WD.cmake
@@ -1,5 +1,6 @@
set(SDKCONFIG_DEFAULTS
${SDKCONFIG_DEFAULTS}
+ boards/sdkconfig.flash_2MiB
boards/ESP32_GENERIC/sdkconfig.d2wd
)
diff --git a/ports/esp32/boards/ESP32_GENERIC/sdkconfig.d2wd b/ports/esp32/boards/ESP32_GENERIC/sdkconfig.d2wd
index 2ac983693..017a6c772 100644
--- a/ports/esp32/boards/ESP32_GENERIC/sdkconfig.d2wd
+++ b/ports/esp32/boards/ESP32_GENERIC/sdkconfig.d2wd
@@ -1,17 +1,3 @@
-# Optimise using -Os to reduce size
-CONFIG_COMPILER_OPTIMIZATION_SIZE=y
-CONFIG_COMPILER_OPTIMIZATION_PERF=n
-CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
-
-# Change maximum log level to error, to reduce firmware size.
-CONFIG_LOG_MAXIMUM_LEVEL_ERROR=y
-CONFIG_LOG_MAXIMUM_LEVEL_INFO=n
-
-# Disable SPI Ethernet driver to reduce firmware size.
-CONFIG_ETH_USE_SPI_ETHERNET=n
-
+# Setting specific to d2wd
CONFIG_ESPTOOLPY_FLASHMODE_DIO=y
CONFIG_ESPTOOLPY_FLASHFREQ_40M=y
-CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y
-CONFIG_PARTITION_TABLE_CUSTOM=y
-CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-2MiB.csv"
diff --git a/ports/esp32/boards/ESP32_GENERIC_C2/board.json b/ports/esp32/boards/ESP32_GENERIC_C2/board.json
index da0931a0e..c496396ef 100644
--- a/ports/esp32/boards/ESP32_GENERIC_C2/board.json
+++ b/ports/esp32/boards/ESP32_GENERIC_C2/board.json
@@ -18,5 +18,8 @@
"product": "ESP32-C2",
"thumbnail": "",
"url": "https://www.espressif.com/en/products/modules",
+ "variants": {
+ "FLASH_2M": "2MiB flash"
+ },
"vendor": "Espressif"
}
diff --git a/ports/esp32/boards/ESP32_GENERIC_C2/board.md b/ports/esp32/boards/ESP32_GENERIC_C2/board.md
index b8ed10069..7c5c295a4 100644
--- a/ports/esp32/boards/ESP32_GENERIC_C2/board.md
+++ b/ports/esp32/boards/ESP32_GENERIC_C2/board.md
@@ -1,3 +1,5 @@
The following files are firmware images that should work on most ESP32-C2-based
boards with at least 4MiB of flash and 26MHz crystal frequency. This includes
ESP8684-WROOM and ESP8684-MINI modules.
+
+If your board has only 2MiB of flash, you should try the FLASH\_2M variant
diff --git a/ports/esp32/boards/ESP32_GENERIC_C2/mpconfigboard.h b/ports/esp32/boards/ESP32_GENERIC_C2/mpconfigboard.h
index 999465373..300ddb0e2 100644
--- a/ports/esp32/boards/ESP32_GENERIC_C2/mpconfigboard.h
+++ b/ports/esp32/boards/ESP32_GENERIC_C2/mpconfigboard.h
@@ -1,7 +1,12 @@
// This configuration is for a generic ESP32C2 board with 4MiB (or more) of flash.
+#ifndef MICROPY_HW_BOARD_NAME
#define MICROPY_HW_BOARD_NAME "ESP32C2 module"
+#endif
+
+#ifndef MICROPY_HW_MCU_NAME
#define MICROPY_HW_MCU_NAME "ESP32C2"
+#endif
#define MICROPY_HW_ENABLE_SDCARD (0)
#define MICROPY_PY_MACHINE_I2S (0)
diff --git a/ports/esp32/boards/ESP32_GENERIC_C2/mpconfigvariant_FLASH_2M.cmake b/ports/esp32/boards/ESP32_GENERIC_C2/mpconfigvariant_FLASH_2M.cmake
new file mode 100644
index 000000000..74af633db
--- /dev/null
+++ b/ports/esp32/boards/ESP32_GENERIC_C2/mpconfigvariant_FLASH_2M.cmake
@@ -0,0 +1,10 @@
+set(SDKCONFIG_DEFAULTS
+ ${SDKCONFIG_DEFAULTS}
+ boards/sdkconfig.flash_2MiB
+)
+
+list(APPEND MICROPY_DEF_BOARD
+ MICROPY_HW_BOARD_NAME="Generic ESP32-C2 module with 2MiB Flash"
+ MICROPY_OPT_COMPUTED_GOTO=0
+ MICROPY_PY_NETWORK_LAN=0
+)
diff --git a/ports/esp32/boards/sdkconfig.flash_2MiB b/ports/esp32/boards/sdkconfig.flash_2MiB
new file mode 100644
index 000000000..5239fbd4f
--- /dev/null
+++ b/ports/esp32/boards/sdkconfig.flash_2MiB
@@ -0,0 +1,17 @@
+# Set flash size to 2MiB.
+CONFIG_ESPTOOLPY_FLASHSIZE_4MB=n
+CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y
+CONFIG_PARTITION_TABLE_CUSTOM=y
+CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-2MiB.csv"
+
+# Disable SPI Ethernet driver to reduce firmware size.
+CONFIG_ETH_USE_SPI_ETHERNET=n
+
+# Optimise using -Os to reduce size.
+CONFIG_COMPILER_OPTIMIZATION_SIZE=y
+CONFIG_COMPILER_OPTIMIZATION_PERF=n
+CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
+
+# Change maximum log level to error, to reduce firmware size.
+CONFIG_LOG_MAXIMUM_LEVEL_ERROR=y
+CONFIG_LOG_MAXIMUM_LEVEL_INFO=n