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:
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
1
ports/rp2/boards/WEACTSTUDIO/mpconfigvariant.cmake
Normal file
1
ports/rp2/boards/WEACTSTUDIO/mpconfigvariant.cmake
Normal file
@@ -0,0 +1 @@
|
||||
set(PICO_BOARD "weactstudio_16MiB")
|
||||
@@ -0,0 +1 @@
|
||||
set(PICO_BOARD "weactstudio_2MiB")
|
||||
@@ -0,0 +1 @@
|
||||
set(PICO_BOARD "weactstudio_4MiB")
|
||||
@@ -0,0 +1 @@
|
||||
set(PICO_BOARD "weactstudio_8MiB")
|
||||
Reference in New Issue
Block a user