rp2: Rework board variant support to require mpconfigvariant file.

Following how the board variants now work in the esp32 port.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2024-06-24 12:37:13 +10:00
parent 81b1bfcfef
commit 5dff78f38e
6 changed files with 16 additions and 16 deletions

View File

@@ -38,10 +38,22 @@ 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()
set(MICROPY_USER_FROZEN_MANIFEST ${MICROPY_FROZEN_MANIFEST})
# Include board config, it may override MICROPY_FROZEN_MANIFEST
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 PICO_BOARD if it's not already set (allow a board to override it).
if(NOT PICO_BOARD)

View File

@@ -6,19 +6,3 @@ list(APPEND PICO_BOARD_HEADER_DIRS ${MICROPY_BOARD_DIR})
# Freeze board.py
set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)
# Select the 16MB variant as the default
set(PICO_BOARD "weactstudio_16MiB")
# Provide different variants for the downloads page
if(MICROPY_BOARD_VARIANT STREQUAL "FLASH_2M")
set(PICO_BOARD "weactstudio_2MiB")
endif()
if(MICROPY_BOARD_VARIANT STREQUAL "FLASH_4M")
set(PICO_BOARD "weactstudio_4MiB")
endif()
if(MICROPY_BOARD_VARIANT STREQUAL "FLASH_8M")
set(PICO_BOARD "weactstudio_8MiB")
endif()

View File

@@ -0,0 +1 @@
set(PICO_BOARD "weactstudio_16MiB")

View File

@@ -0,0 +1 @@
set(PICO_BOARD "weactstudio_2MiB")

View File

@@ -0,0 +1 @@
set(PICO_BOARD "weactstudio_4MiB")

View File

@@ -0,0 +1 @@
set(PICO_BOARD "weactstudio_8MiB")