From b1aa8b94f432c3c59b147c6da31432e1024eefb2 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 1 Jun 2021 15:19:04 +0200 Subject: [PATCH] Refactor ESP32 partition selection via boards.json --- boards/esp32-cam.json | 38 +++++++++++++++++++++++++++ boards/esp32-m5core2.json | 35 ++++++++++++++++++++++++ boards/esp32-odroid.json | 35 ++++++++++++++++++++++++ boards/esp32_16M.json | 38 +++++++++++++++++++++++++++ boards/esp32_4M.json | 38 +++++++++++++++++++++++++++ boards/esp32_8M.json | 38 +++++++++++++++++++++++++++ esp32_partition_app2944k_spiffs2M.csv | 6 +++++ platformio_tasmota32.ini | 3 +-- platformio_tasmota_env32.ini | 27 +++++++++---------- 9 files changed, 242 insertions(+), 16 deletions(-) create mode 100644 boards/esp32-cam.json create mode 100644 boards/esp32-m5core2.json create mode 100644 boards/esp32-odroid.json create mode 100644 boards/esp32_16M.json create mode 100644 boards/esp32_4M.json create mode 100644 boards/esp32_8M.json create mode 100644 esp32_partition_app2944k_spiffs2M.csv diff --git a/boards/esp32-cam.json b/boards/esp32-cam.json new file mode 100644 index 000000000..7164c6727 --- /dev/null +++ b/boards/esp32-cam.json @@ -0,0 +1,38 @@ +{ + "build": { + "arduino":{ + "ldscript": "esp32_out.ld", + "partitions": "esp32_partition_app1856k_spiffs320k.csv" + }, + "core": "esp32", + "extra_flags": "-DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue", + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "dio", + "mcu": "esp32", + "variant": "esp32" + }, + "connectivity": [ + "wifi", + "bluetooth", + "ethernet", + "can" + ], + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "AI Thinker ESP32-CAM, 4M Flash 4MB PSRAM, 1856k Code/OTA, 320k SPIFFS", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://wiki.ai-thinker.com/esp32-cam", + "vendor": "AI Thinker" +} diff --git a/boards/esp32-m5core2.json b/boards/esp32-m5core2.json new file mode 100644 index 000000000..f115726f3 --- /dev/null +++ b/boards/esp32-m5core2.json @@ -0,0 +1,35 @@ +{ + "build": { + "arduino":{ + "ldscript": "esp32_out.ld", + "partitions": "esp32_partition_app2944k_spiffs10M.csv" + }, + "core": "esp32", + "extra_flags": "-DARDUINO_M5STACK_Core2 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue", + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "dio", + "mcu": "esp32", + "variant": "m5stack_core2" + }, + "connectivity": [ + "wifi", + "bluetooth", + "ethernet", + "can" + ], + "frameworks": [ + "arduino", + "espidf" + ], + "name": "M5Stack Core2 16M Flash, 4MB PSRAM, 2944k Code/OTA, 10M SPIFFS", + "upload": { + "flash_size": "16MB", + "maximum_ram_size": 6553600, + "maximum_size": 16777216, + "require_upload_port": true, + "speed": 2000000 + }, + "url": "http://www.m5stack.com", + "vendor": "M5Stack" +} diff --git a/boards/esp32-odroid.json b/boards/esp32-odroid.json new file mode 100644 index 000000000..fa554aa83 --- /dev/null +++ b/boards/esp32-odroid.json @@ -0,0 +1,35 @@ +{ + "build": { + "arduino":{ + "ldscript": "esp32_out.ld", + "partitions": "esp32_partition_app2944k_spiffs10M.csv" + }, + "core": "esp32", + "extra_flags": "-DARDUINO_ODROID_ESP32 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue", + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "dio", + "mcu": "esp32", + "variant": "esp32-odroid" + }, + "connectivity": [ + "wifi", + "bluetooth", + "ethernet", + "can" + ], + "frameworks": [ + "arduino", + "espidf" + ], + "name": "ESP32 ODROID-GO 16M Flash, 4MB PSRAM, 2944k Code/OTA, 10M SPIFFS", + "upload": { + "flash_size": "16MB", + "maximum_ram_size": 327680, + "maximum_size": 16777216, + "require_upload_port": true, + "speed": 2000000 + }, + "url": "https://www.hardkernel.com/main/products/prdt_info.php?g_code=G152875062626", + "vendor": "Hardkernel" +} diff --git a/boards/esp32_16M.json b/boards/esp32_16M.json new file mode 100644 index 000000000..5f2e120f3 --- /dev/null +++ b/boards/esp32_16M.json @@ -0,0 +1,38 @@ +{ + "build": { + "arduino":{ + "ldscript": "esp32_out.ld", + "partitions": "esp32_partition_app2944k_spiffs10M.csv" + }, + "core": "esp32", + "extra_flags": "-DARDUINO_ESP32_DEV", + "f_cpu": "800000000L", + "f_flash": "40000000L", + "flash_mode": "dio", + "mcu": "esp32", + "variant": "esp32" + }, + "connectivity": [ + "wifi", + "bluetooth", + "ethernet", + "can" + ], + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif Generic ESP32 16M Flash, 2944k Code/OTA, 10M SPIFFS", + "upload": { + "flash_size": "16MB", + "maximum_ram_size": 327680, + "maximum_size": 16777216, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://en.wikipedia.org/wiki/ESP32", + "vendor": "Espressif" +} diff --git a/boards/esp32_4M.json b/boards/esp32_4M.json new file mode 100644 index 000000000..ea700ce94 --- /dev/null +++ b/boards/esp32_4M.json @@ -0,0 +1,38 @@ +{ + "build": { + "arduino":{ + "ldscript": "esp32_out.ld", + "partitions": "esp32_partition_app1856k_spiffs320k.csv" + }, + "core": "esp32", + "extra_flags": "-DARDUINO_ESP32_DEV", + "f_cpu": "800000000L", + "f_flash": "40000000L", + "flash_mode": "dio", + "mcu": "esp32", + "variant": "esp32" + }, + "connectivity": [ + "wifi", + "bluetooth", + "ethernet", + "can" + ], + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif Generic ESP32 4M Flash, 1856k Code/OTA, 320k SPIFFS", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://en.wikipedia.org/wiki/ESP32", + "vendor": "Espressif" +} diff --git a/boards/esp32_8M.json b/boards/esp32_8M.json new file mode 100644 index 000000000..7660dbeeb --- /dev/null +++ b/boards/esp32_8M.json @@ -0,0 +1,38 @@ +{ + "build": { + "arduino":{ + "ldscript": "esp32_out.ld", + "partitions": "esp32_partition_app2944k_spiffs2M.csv" + }, + "core": "esp32", + "extra_flags": "-DARDUINO_ESP32_DEV", + "f_cpu": "800000000L", + "f_flash": "40000000L", + "flash_mode": "dio", + "mcu": "esp32", + "variant": "esp32" + }, + "connectivity": [ + "wifi", + "bluetooth", + "ethernet", + "can" + ], + "debug": { + "openocd_board": "esp-wroom-32.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif Generic ESP32 8M Flash, 2944k Code/OTA, 2112k SPIFFS", + "upload": { + "flash_size": "8MB", + "maximum_ram_size": 327680, + "maximum_size": 8388608, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://en.wikipedia.org/wiki/ESP32", + "vendor": "Espressif" +} diff --git a/esp32_partition_app2944k_spiffs2M.csv b/esp32_partition_app2944k_spiffs2M.csv new file mode 100644 index 000000000..9c0897d51 --- /dev/null +++ b/esp32_partition_app2944k_spiffs2M.csv @@ -0,0 +1,6 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x5000, +otadata, data, ota, 0xe000, 0x2000, +app0, app, ota_0, 0x10000, 0x2F0000, +app1, app, ota_1, 0x300000, 0x2F0000, +spiffs, data, spiffs, 0x5F0000,0x210000, diff --git a/platformio_tasmota32.ini b/platformio_tasmota32.ini index bcf64f578..247275dff 100644 --- a/platformio_tasmota32.ini +++ b/platformio_tasmota32.ini @@ -7,10 +7,9 @@ platform = ${core32.platform} platform_packages = ${core32.platform_packages} build_unflags = ${core32.build_unflags} build_flags = ${core32.build_flags} -board = esp32dev +board = esp32_4M board_build.filesystem = ${common.board_build.filesystem} custom_unpack_dir = ${common.custom_unpack_dir} -board_build.partitions = esp32_partition_app1856k_spiffs320k.csv board_build.f_flash = ${common.board_build.f_flash} board_build.f_cpu = ${common.board_build.f_cpu} monitor_speed = 115200 diff --git a/platformio_tasmota_env32.ini b/platformio_tasmota_env32.ini index 72d7836a2..df2b8dcc6 100644 --- a/platformio_tasmota_env32.ini +++ b/platformio_tasmota_env32.ini @@ -3,7 +3,6 @@ framework = ${common.framework} platform = ${common32.platform} platform_packages = ${common32.platform_packages} board = ${common32.board} -board_build.partitions = ${common32.board_build.partitions} board_build.f_flash = ${common32.board_build.f_flash} board_build.f_cpu = ${common32.board_build.f_cpu} monitor_speed = ${common32.monitor_speed} @@ -32,6 +31,16 @@ lib_ignore = extends = env:tasmota32_base build_flags = ${common32.build_flags} -DFIRMWARE_TASMOTA32 +[env:tasmota32_8M] +extends = env:tasmota32_base +board = esp32_8M +build_flags = ${common32.build_flags} -DFIRMWARE_TASMOTA32 + +[env:tasmota32_16M] +extends = env:tasmota32_base +board = esp32_16M +build_flags = ${common32.build_flags} -DFIRMWARE_TASMOTA32 + [env:tasmota32solo1] extends = env:tasmota32_base platform_packages = tasmota/framework-arduinoespressif32 @ 3.10006.210420 @@ -40,32 +49,22 @@ build_flags = ${common32.build_flags} -DFIRMWARE_TASMOTA32 [env:tasmota32-webcam] extends = env:tasmota32_base -board = esp32cam -board_build.f_cpu = 240000000L +board = esp32-cam board_build.flash_mode = qio -board_build.f_flash = 80000000L build_flags = ${common32.build_flags} -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -lc-psram-workaround -lm-psram-workaround -DFIRMWARE_WEBCAM lib_extra_dirs = lib/libesp32, lib/lib_basic [env:tasmota32-odroidgo] extends = env:tasmota32_base -board = odroid_esp32 -board_build.f_cpu = 240000000L +board = esp32-odroid board_build.flash_mode = qio -board_build.f_flash = 80000000L -upload_speed = 2000000 -board_build.partitions = esp32_partition_app2944k_spiffs10M.csv build_flags = ${common32.build_flags} -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -lc-psram-workaround -lm-psram-workaround -DFIRMWARE_ODROID_GO lib_extra_dirs = lib/libesp32, lib/lib_basic, lib/lib_i2c, lib/lib_rf, lib/lib_div, lib/lib_ssl, lib/lib_display [env:tasmota32-core2] extends = env:tasmota32_base -board = odroid_esp32 -board_build.f_cpu = 240000000L +board = esp32-m5core2 board_build.flash_mode = qio -board_build.f_flash = 80000000L -upload_speed = 2000000 -board_build.partitions = esp32_partition_app2944k_spiffs10M.csv build_flags = ${common32.build_flags} -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -lc-psram-workaround -lm-psram-workaround -DFIRMWARE_M5STACK_CORE2 lib_extra_dirs = lib/libesp32, lib/lib_basic, lib/lib_i2c, lib/lib_rf, lib/lib_div, lib/lib_ssl, lib/lib_display, lib/lib_audio