diff options
-rw-r--r-- | ports/rp2/CMakeLists.txt | 25 | ||||
-rw-r--r-- | ports/rp2/Makefile | 6 | ||||
-rw-r--r-- | ports/rp2/boards/ADAFRUIT_FEATHER_RP2040/mpconfigboard.cmake | 1 | ||||
-rw-r--r-- | ports/rp2/boards/ADAFRUIT_FEATHER_RP2040/mpconfigboard.h | 3 | ||||
-rw-r--r-- | ports/rp2/boards/PICO/mpconfigboard.cmake | 1 | ||||
-rw-r--r-- | ports/rp2/boards/PICO/mpconfigboard.h | 3 | ||||
-rw-r--r-- | ports/rp2/mpconfigport.h | 3 |
7 files changed, 39 insertions, 3 deletions
diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt index 100a83409..bd3eb7438 100644 --- a/ports/rp2/CMakeLists.txt +++ b/ports/rp2/CMakeLists.txt @@ -17,6 +17,30 @@ endif() # Use the local tinyusb instead of the one in pico-sdk set(PICO_TINYUSB_PATH ${MICROPY_DIR}/lib/tinyusb) +# Set the location of this port's directory. +set(MICROPY_PORT_DIR ${CMAKE_SOURCE_DIR}) + +# Set the board if it's not already set. +if(NOT MICROPY_BOARD) + set(MICROPY_BOARD PICO) +endif() + +# Set the PICO_BOARD if it's not already set. +if(NOT PICO_BOARD) + string(TOLOWER ${MICROPY_BOARD} PICO_BOARD) +endif() + +# Set the board directory and check that it exists. +if(NOT MICROPY_BOARD_DIR) + set(MICROPY_BOARD_DIR ${MICROPY_PORT_DIR}/boards/${MICROPY_BOARD}) +endif() +if(NOT EXISTS ${MICROPY_BOARD_DIR}/mpconfigboard.cmake) + message(FATAL_ERROR "Invalid MICROPY_BOARD specified: ${MICROPY_BOARD}") +endif() + +# Include board config +include(${MICROPY_BOARD_DIR}/mpconfigboard.cmake) + # Include component cmake fragments include(${MICROPY_DIR}/py/py.cmake) include(${MICROPY_DIR}/extmod/extmod.cmake) @@ -150,6 +174,7 @@ target_link_libraries(${MICROPY_TARGET} usermod) target_include_directories(${MICROPY_TARGET} PRIVATE ${MICROPY_INC_CORE} ${MICROPY_INC_USERMOD} + ${MICROPY_BOARD_DIR} "${PROJECT_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" ) diff --git a/ports/rp2/Makefile b/ports/rp2/Makefile index 3358c4cca..246f29dd0 100644 --- a/ports/rp2/Makefile +++ b/ports/rp2/Makefile @@ -2,11 +2,13 @@ # # This is a simple wrapper around cmake -BUILD = build +BOARD ?= PICO + +BUILD ?= build-$(BOARD) $(VERBOSE)MAKESILENT = -s -CMAKE_ARGS = +CMAKE_ARGS = -DMICROPY_BOARD=$(BOARD) ifdef USER_C_MODULES CMAKE_ARGS += -DUSER_C_MODULES=${USER_C_MODULES} diff --git a/ports/rp2/boards/ADAFRUIT_FEATHER_RP2040/mpconfigboard.cmake b/ports/rp2/boards/ADAFRUIT_FEATHER_RP2040/mpconfigboard.cmake new file mode 100644 index 000000000..877efa6ab --- /dev/null +++ b/ports/rp2/boards/ADAFRUIT_FEATHER_RP2040/mpconfigboard.cmake @@ -0,0 +1 @@ +# cmake file for Adafruit Feather RP2040 diff --git a/ports/rp2/boards/ADAFRUIT_FEATHER_RP2040/mpconfigboard.h b/ports/rp2/boards/ADAFRUIT_FEATHER_RP2040/mpconfigboard.h new file mode 100644 index 000000000..5068d3554 --- /dev/null +++ b/ports/rp2/boards/ADAFRUIT_FEATHER_RP2040/mpconfigboard.h @@ -0,0 +1,3 @@ +// Board and hardware specific configuration +#define MICROPY_HW_BOARD_NAME "Adafruit Feather RP2040" +#define MICROPY_HW_FLASH_STORAGE_BYTES (3072 * 1024) diff --git a/ports/rp2/boards/PICO/mpconfigboard.cmake b/ports/rp2/boards/PICO/mpconfigboard.cmake new file mode 100644 index 000000000..3a40ca287 --- /dev/null +++ b/ports/rp2/boards/PICO/mpconfigboard.cmake @@ -0,0 +1 @@ +# cmake file for Raspberry Pi Pico diff --git a/ports/rp2/boards/PICO/mpconfigboard.h b/ports/rp2/boards/PICO/mpconfigboard.h new file mode 100644 index 000000000..e6623374d --- /dev/null +++ b/ports/rp2/boards/PICO/mpconfigboard.h @@ -0,0 +1,3 @@ +// Board and hardware specific configuration +#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico" +#define MICROPY_HW_FLASH_STORAGE_BYTES (1408 * 1024) diff --git a/ports/rp2/mpconfigport.h b/ports/rp2/mpconfigport.h index 6c82d1862..218cd7275 100644 --- a/ports/rp2/mpconfigport.h +++ b/ports/rp2/mpconfigport.h @@ -31,8 +31,9 @@ #include "hardware/sync.h" #include "pico/binary_info.h" +#include "mpconfigboard.h" + // Board and hardware specific configuration -#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico" #define MICROPY_HW_MCU_NAME "RP2040" #define MICROPY_HW_ENABLE_UART_REPL (0) // useful if there is no USB #define MICROPY_HW_ENABLE_USBDEV (1) |