diff options
9 files changed, 60 insertions, 66 deletions
diff --git a/ports/esp32/CMakeLists.txt b/ports/esp32/CMakeLists.txt index 3fe083002..d3927cd48 100644 --- a/ports/esp32/CMakeLists.txt +++ b/ports/esp32/CMakeLists.txt @@ -19,6 +19,13 @@ if(NOT EXISTS ${MICROPY_BOARD_DIR}/mpconfigboard.cmake) message(FATAL_ERROR "Invalid MICROPY_BOARD specified: ${MICROPY_BOARD}") endif() +# If a board variant is specified, check that it exists. +if(MICROPY_BOARD_VARIANT) + if(NOT EXISTS ${MICROPY_BOARD_DIR}/mpconfigvariant_${MICROPY_BOARD_VARIANT}.cmake) + message(FATAL_ERROR "Invalid MICROPY_BOARD_VARIANT specified: ${MICROPY_BOARD_VARIANT}") + endif() +endif() + # Define the output sdkconfig so it goes in the build directory. set(SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig) @@ -35,6 +42,11 @@ endif() # - SDKCONFIG_DEFAULTS # - IDF_TARGET include(${MICROPY_BOARD_DIR}/mpconfigboard.cmake) +if(NOT MICROPY_BOARD_VARIANT) + include(${MICROPY_BOARD_DIR}/mpconfigvariant.cmake OPTIONAL) +else() + include(${MICROPY_BOARD_DIR}/mpconfigvariant_${MICROPY_BOARD_VARIANT}.cmake) +endif() # Set the frozen manifest file. Note if MICROPY_FROZEN_MANIFEST is set from the cmake # command line, then it will override the default and any manifest set by the board. diff --git a/ports/esp32/boards/ESP32_GENERIC/mpconfigboard.cmake b/ports/esp32/boards/ESP32_GENERIC/mpconfigboard.cmake index a3e8f616b..9d0077a15 100644 --- a/ports/esp32/boards/ESP32_GENERIC/mpconfigboard.cmake +++ b/ports/esp32/boards/ESP32_GENERIC/mpconfigboard.cmake @@ -3,50 +3,3 @@ set(SDKCONFIG_DEFAULTS ${SDKCONFIG_IDF_VERSION_SPECIFIC} boards/sdkconfig.ble ) - -if(MICROPY_BOARD_VARIANT STREQUAL "D2WD") - set(SDKCONFIG_DEFAULTS - ${SDKCONFIG_DEFAULTS} - boards/ESP32_GENERIC/sdkconfig.d2wd - ) - - list(APPEND MICROPY_DEF_BOARD - MICROPY_HW_MCU_NAME="ESP32-D2WD" - # Disable some options to reduce firmware size. - MICROPY_OPT_COMPUTED_GOTO=0 - MICROPY_PY_NETWORK_LAN=0 - ) -endif() - -if(MICROPY_BOARD_VARIANT STREQUAL "OTA") - set(SDKCONFIG_DEFAULTS - ${SDKCONFIG_DEFAULTS} - boards/ESP32_GENERIC/sdkconfig.ota - ) - - list(APPEND MICROPY_DEF_BOARD - MICROPY_HW_BOARD_NAME="Generic ESP32 module with OTA" - ) -endif() - -if(MICROPY_BOARD_VARIANT STREQUAL "SPIRAM") - set(SDKCONFIG_DEFAULTS - ${SDKCONFIG_DEFAULTS} - boards/sdkconfig.spiram - ) - - list(APPEND MICROPY_DEF_BOARD - MICROPY_HW_BOARD_NAME="Generic ESP32 module with SPIRAM" - ) -endif() - -if(MICROPY_BOARD_VARIANT STREQUAL "UNICORE") - set(SDKCONFIG_DEFAULTS - ${SDKCONFIG_DEFAULTS} - boards/ESP32_GENERIC/sdkconfig.unicore - ) - - list(APPEND MICROPY_DEF_BOARD - MICROPY_HW_MCU_NAME="ESP32-UNICORE" - ) -endif() diff --git a/ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_D2WD.cmake b/ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_D2WD.cmake new file mode 100644 index 000000000..170c214bd --- /dev/null +++ b/ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_D2WD.cmake @@ -0,0 +1,11 @@ +set(SDKCONFIG_DEFAULTS + ${SDKCONFIG_DEFAULTS} + boards/ESP32_GENERIC/sdkconfig.d2wd +) + +list(APPEND MICROPY_DEF_BOARD + MICROPY_HW_MCU_NAME="ESP32-D2WD" + # Disable some options to reduce firmware size. + MICROPY_OPT_COMPUTED_GOTO=0 + MICROPY_PY_NETWORK_LAN=0 +) diff --git a/ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_OTA.cmake b/ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_OTA.cmake new file mode 100644 index 000000000..7f649c36f --- /dev/null +++ b/ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_OTA.cmake @@ -0,0 +1,8 @@ +set(SDKCONFIG_DEFAULTS + ${SDKCONFIG_DEFAULTS} + boards/ESP32_GENERIC/sdkconfig.ota +) + +list(APPEND MICROPY_DEF_BOARD + MICROPY_HW_BOARD_NAME="Generic ESP32 module with OTA" +) diff --git a/ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_SPIRAM.cmake b/ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_SPIRAM.cmake new file mode 100644 index 000000000..11e9c4eda --- /dev/null +++ b/ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_SPIRAM.cmake @@ -0,0 +1,8 @@ +set(SDKCONFIG_DEFAULTS + ${SDKCONFIG_DEFAULTS} + boards/sdkconfig.spiram +) + +list(APPEND MICROPY_DEF_BOARD + MICROPY_HW_BOARD_NAME="Generic ESP32 module with SPIRAM" +) diff --git a/ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_UNICORE.cmake b/ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_UNICORE.cmake new file mode 100644 index 000000000..beed6eb09 --- /dev/null +++ b/ports/esp32/boards/ESP32_GENERIC/mpconfigvariant_UNICORE.cmake @@ -0,0 +1,8 @@ +set(SDKCONFIG_DEFAULTS + ${SDKCONFIG_DEFAULTS} + boards/ESP32_GENERIC/sdkconfig.unicore +) + +list(APPEND MICROPY_DEF_BOARD + MICROPY_HW_MCU_NAME="ESP32-UNICORE" +) diff --git a/ports/esp32/boards/ESP32_GENERIC_S3/mpconfigboard.cmake b/ports/esp32/boards/ESP32_GENERIC_S3/mpconfigboard.cmake index 1f7440353..2bfdad21d 100644 --- a/ports/esp32/boards/ESP32_GENERIC_S3/mpconfigboard.cmake +++ b/ports/esp32/boards/ESP32_GENERIC_S3/mpconfigboard.cmake @@ -8,22 +8,3 @@ set(SDKCONFIG_DEFAULTS boards/sdkconfig.spiram_sx boards/ESP32_GENERIC_S3/sdkconfig.board ) - -if(MICROPY_BOARD_VARIANT STREQUAL "SPIRAM_OCT") - set(SDKCONFIG_DEFAULTS - ${SDKCONFIG_DEFAULTS} - boards/sdkconfig.240mhz - boards/sdkconfig.spiram_oct - ) - - list(APPEND MICROPY_DEF_BOARD - MICROPY_HW_BOARD_NAME="Generic ESP32S3 module with Octal-SPIRAM" - ) -endif() - -if(MICROPY_BOARD_VARIANT STREQUAL "FLASH_4M") - set(SDKCONFIG_DEFAULTS - ${SDKCONFIG_DEFAULTS} - boards/ESP32_GENERIC_S3/sdkconfig.flash_4m - ) -endif() diff --git a/ports/esp32/boards/ESP32_GENERIC_S3/mpconfigvariant_FLASH_4M.cmake b/ports/esp32/boards/ESP32_GENERIC_S3/mpconfigvariant_FLASH_4M.cmake new file mode 100644 index 000000000..e832cdb60 --- /dev/null +++ b/ports/esp32/boards/ESP32_GENERIC_S3/mpconfigvariant_FLASH_4M.cmake @@ -0,0 +1,4 @@ +set(SDKCONFIG_DEFAULTS + ${SDKCONFIG_DEFAULTS} + boards/ESP32_GENERIC_S3/sdkconfig.flash_4m +) diff --git a/ports/esp32/boards/ESP32_GENERIC_S3/mpconfigvariant_SPIRAM_OCT.cmake b/ports/esp32/boards/ESP32_GENERIC_S3/mpconfigvariant_SPIRAM_OCT.cmake new file mode 100644 index 000000000..8b2eda272 --- /dev/null +++ b/ports/esp32/boards/ESP32_GENERIC_S3/mpconfigvariant_SPIRAM_OCT.cmake @@ -0,0 +1,9 @@ +set(SDKCONFIG_DEFAULTS + ${SDKCONFIG_DEFAULTS} + boards/sdkconfig.240mhz + boards/sdkconfig.spiram_oct +) + +list(APPEND MICROPY_DEF_BOARD + MICROPY_HW_BOARD_NAME="Generic ESP32S3 module with Octal-SPIRAM" +) |