From deefd4d016562896aa8ff7c8e21baccf163fc098 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Tue, 26 Nov 2024 22:25:59 +0000 Subject: [PATCH] CI: Sync RPi stock boards with upstream. Replace our experimental configs with the board config(s) from the (as yet unmerged) Pico 2 W changes branch. --- .github/workflows/micropython.yml | 7 +-- micropython/board/RPI_PICO2/board.json | 19 ------ .../board/RPI_PICO2/manifest-wireless.py | 8 --- .../board/RPI_PICO2/mpconfigboard.cmake | 13 ++-- micropython/board/RPI_PICO2/mpconfigboard.h | 62 +++++-------------- .../RPI_PICO2/mpconfigvariant_WIRELESS.cmake | 40 ------------ micropython/board/RPI_PICO2_W/manifest.py | 8 +++ .../board/RPI_PICO2_W/mpconfigboard.cmake | 11 ++++ micropython/board/RPI_PICO2_W/mpconfigboard.h | 7 +++ micropython/board/RPI_PICO2_W/pins.csv | 30 +++++++++ 10 files changed, 83 insertions(+), 122 deletions(-) delete mode 100644 micropython/board/RPI_PICO2/board.json delete mode 100644 micropython/board/RPI_PICO2/manifest-wireless.py delete mode 100644 micropython/board/RPI_PICO2/mpconfigvariant_WIRELESS.cmake create mode 100644 micropython/board/RPI_PICO2_W/manifest.py create mode 100644 micropython/board/RPI_PICO2_W/mpconfigboard.cmake create mode 100644 micropython/board/RPI_PICO2_W/mpconfigboard.h create mode 100644 micropython/board/RPI_PICO2_W/pins.csv diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index 62b35f8..8a95ee0 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -19,11 +19,10 @@ jobs: strategy: matrix: include: - - name: pico2_rp2350 + - name: pico2 board: RPI_PICO2 - - name: pico2_rp2350_wireless - board: RPI_PICO2 - variant: WIRELESS + - name: pico2_w + board: RPI_PICO2_W - name: pico2b_rp2350 board: RPI_PICO2B - name: plasma2350 diff --git a/micropython/board/RPI_PICO2/board.json b/micropython/board/RPI_PICO2/board.json deleted file mode 100644 index d27a82f..0000000 --- a/micropython/board/RPI_PICO2/board.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "deploy": [ - "../deploy.md" - ], - "docs": "", - "features": [ - "Dual-core", - "External Flash", - "USB" - ], - "images": [ - "rp2-picos.jpg" - ], - "mcu": "rp2350", - "product": "Pico2", - "thumbnail": "", - "url": "https://www.raspberrypi.com/products/raspberry-pi-pico2/", - "vendor": "Raspberry Pi" -} diff --git a/micropython/board/RPI_PICO2/manifest-wireless.py b/micropython/board/RPI_PICO2/manifest-wireless.py deleted file mode 100644 index b34f473..0000000 --- a/micropython/board/RPI_PICO2/manifest-wireless.py +++ /dev/null @@ -1,8 +0,0 @@ -require("bundle-networking") - -# Bluetooth -require("aioble") - -include("manifest.py") - -freeze("$(BOARD_DIR)/../../modules_py", "lte.py") \ No newline at end of file diff --git a/micropython/board/RPI_PICO2/mpconfigboard.cmake b/micropython/board/RPI_PICO2/mpconfigboard.cmake index 6b4a7cc..a869fd0 100644 --- a/micropython/board/RPI_PICO2/mpconfigboard.cmake +++ b/micropython/board/RPI_PICO2/mpconfigboard.cmake @@ -1,8 +1,11 @@ -# cmake file for Raspberry Pi Pico +# cmake file for Raspberry Pi Pico2 set(PICO_BOARD "pico2") -set(PICO_PLATFORM "rp2350") -# Board specific version of the frozen manifest -set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py) +# To change the gpio count for QFN-80 +# set(PICO_NUM_GPIOS 48) -set(MICROPY_C_HEAP_SIZE 4096) +if (PICO_CYW43_SUPPORTED) + include(enable_cyw43.cmake) + set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py) + set(PICO_PINS_CSV_NAME pins_cyw43.csv) +endif() \ No newline at end of file diff --git a/micropython/board/RPI_PICO2/mpconfigboard.h b/micropython/board/RPI_PICO2/mpconfigboard.h index 95385ba..15b6dd3 100644 --- a/micropython/board/RPI_PICO2/mpconfigboard.h +++ b/micropython/board/RPI_PICO2/mpconfigboard.h @@ -1,52 +1,22 @@ // Board and hardware specific configuration -#define MICROPY_HW_FLASH_STORAGE_BYTES (PICO_FLASH_SIZE_BYTES - (2 * 1024 * 1024)) +#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico2" +#define MICROPY_HW_FLASH_STORAGE_BYTES (PICO_FLASH_SIZE_BYTES - 1024 * 1024) -// Set up networking. -#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "Pico2" +#if MICROPY_PY_NETWORK_CYW43 +#include "enable_cyw43.h" -#if defined(MICROPY_PY_NETWORK_CYW43) +// Enable the ability to pass cyw43 pins into WiFi, Bluetooth and Pin constructors +#define CYW43_PIN_WL_DYNAMIC 1 +#define CYW43_PIO_CLOCK_DIV_DYNAMIC 1 -// CYW43 driver configuration. -#define CYW43_USE_SPI (1) -#define CYW43_LWIP (1) -#define CYW43_GPIO (1) -#define CYW43_SPI_PIO (1) - -#define MICROPY_HW_PIN_EXT_COUNT CYW43_WL_GPIO_COUNT - -#if defined(CYW43_PIN_WL_DYNAMIC) - -#define CYW43_PIO_CLOCK_DIV_DYNAMIC (1) - -// CYW43 default pin configuration -#define CYW43_DEFAULT_PIN_WL_HOST_WAKE 24u -#define CYW43_DEFAULT_PIN_WL_REG_ON 23u -#define CYW43_DEFAULT_PIN_WL_DATA_OUT CYW43_DEFAULT_PIN_WL_HOST_WAKE -#define CYW43_DEFAULT_PIN_WL_DATA_IN CYW43_DEFAULT_PIN_WL_HOST_WAKE -#define CYW43_DEFAULT_PIN_WL_CLOCK 29u -#define CYW43_DEFAULT_PIN_WL_CS 25u - -// Slow down the wireless clock, since we'll be running -// comms through wiring spaghetti! -#define CYW43_PIO_CLOCK_DIV_INT 50 -#define CYW43_PIO_CLOCK_DIV_FRAC 0 -#define CYW43_SPI_PROGRAM_NAME spi_gap0_sample1 - -#endif - -#endif - -// Might be defined in mpconfigvariant_PPP.cmake -// This is not checked by mpconfigport.h so we must set up networking below -#if defined(MICROPY_PY_NETWORK_PPP_LWIP) - -// Nothing to do here? - -#endif - -// If a variant is not used, define a fallback board name -#ifndef MICROPY_HW_BOARD_NAME - -#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico 2" +// Set the default pins to gpios 2-5 +#define CYW43_DEFAULT_PIN_WL_REG_ON 2 +#define CYW43_DEFAULT_PIN_WL_CS 3 +#define CYW43_DEFAULT_PIN_WL_DATA_OUT 4 +#define CYW43_DEFAULT_PIN_WL_DATA_IN 4 +#define CYW43_DEFAULT_PIN_WL_HOST_WAKE 4 +#define CYW43_DEFAULT_PIN_WL_CLOCK 5 +// Default pio clock +#define CYW43_PIO_CLOCK_DIV_INT 3 #endif \ No newline at end of file diff --git a/micropython/board/RPI_PICO2/mpconfigvariant_WIRELESS.cmake b/micropython/board/RPI_PICO2/mpconfigvariant_WIRELESS.cmake deleted file mode 100644 index 8493a5c..0000000 --- a/micropython/board/RPI_PICO2/mpconfigvariant_WIRELESS.cmake +++ /dev/null @@ -1,40 +0,0 @@ -# Override the MicroPython board name -# And set basic options which are expanded upon in mpconfigboard.h -list(APPEND MICROPY_DEF_BOARD - "MICROPY_HW_BOARD_NAME=\"Raspberry Pi Pico 2 (LTE + WiFi)\"" - "MICROPY_PY_NETWORK=1" - "CYW43_PIN_WL_DYNAMIC=1" - "MICROPY_PY_NETWORK_PPP_LWIP=1" -) - -# Links micropy_lib_lwip and sets MICROPY_PY_LWIP = 1 -# Picked up and expanded upon in mpconfigboard.h -set(MICROPY_PY_LWIP ON) - -# Links cyw43-driver and sets: -# MICROPY_PY_NETWORK_CYW43 = 1, -# MICROPY_PY_SOCKET_DEFAULT_TIMEOUT_MS = 30000 -set(MICROPY_PY_NETWORK_CYW43 ON) - -# Adds mpbthciport.c -# And sets: -# MICROPY_PY_BLUETOOTH = 1, -# MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS = 1, -# MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE = 1 -set(MICROPY_PY_BLUETOOTH ON) - -# Links pico_btstack_hci_transport_cyw43 -# And sets: -# MICROPY_BLUETOOTH_BTSTACK = 1, -# MICROPY_BLUETOOTH_BTSTACK_CONFIG_FILE = -set(MICROPY_BLUETOOTH_BTSTACK ON) - -# Sets: -# CYW43_ENABLE_BLUETOOTH = 1, -# MICROPY_PY_BLUETOOTH_CYW43 = 1 -set(MICROPY_PY_BLUETOOTH_CYW43 ON) - -set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest-wireless.py) - -set(PICO_BOARD "pico2_w") -set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR}) diff --git a/micropython/board/RPI_PICO2_W/manifest.py b/micropython/board/RPI_PICO2_W/manifest.py new file mode 100644 index 0000000..77dc9fd --- /dev/null +++ b/micropython/board/RPI_PICO2_W/manifest.py @@ -0,0 +1,8 @@ +include("$(PORT_DIR)/boards/manifest.py") + +require("bundle-networking") + +# Bluetooth +require("aioble") + +include("../manifest_pico2.py") \ No newline at end of file diff --git a/micropython/board/RPI_PICO2_W/mpconfigboard.cmake b/micropython/board/RPI_PICO2_W/mpconfigboard.cmake new file mode 100644 index 0000000..49d92f5 --- /dev/null +++ b/micropython/board/RPI_PICO2_W/mpconfigboard.cmake @@ -0,0 +1,11 @@ +# cmake file for Raspberry Pi Pico 2 W + +set(PICO_BOARD "pico2_w") + +# To change the gpio count for QFN-80 +# set(PICO_NUM_GPIOS 48) + +include(enable_cyw43.cmake) + +# Board specific version of the frozen manifest +set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py) \ No newline at end of file diff --git a/micropython/board/RPI_PICO2_W/mpconfigboard.h b/micropython/board/RPI_PICO2_W/mpconfigboard.h new file mode 100644 index 0000000..3183d14 --- /dev/null +++ b/micropython/board/RPI_PICO2_W/mpconfigboard.h @@ -0,0 +1,7 @@ +// Board and hardware specific configuration +#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico 2 W" +#define MICROPY_HW_FLASH_STORAGE_BYTES (PICO_FLASH_SIZE_BYTES - 1024 * 1024) + +#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "Pico2W" + +#include "enable_cyw43.h" \ No newline at end of file diff --git a/micropython/board/RPI_PICO2_W/pins.csv b/micropython/board/RPI_PICO2_W/pins.csv new file mode 100644 index 0000000..012bc7c --- /dev/null +++ b/micropython/board/RPI_PICO2_W/pins.csv @@ -0,0 +1,30 @@ +GP0,GPIO0 +GP1,GPIO1 +GP2,GPIO2 +GP3,GPIO3 +GP4,GPIO4 +GP5,GPIO5 +GP6,GPIO6 +GP7,GPIO7 +GP8,GPIO8 +GP9,GPIO9 +GP10,GPIO10 +GP11,GPIO11 +GP12,GPIO12 +GP13,GPIO13 +GP14,GPIO14 +GP15,GPIO15 +GP16,GPIO16 +GP17,GPIO17 +GP18,GPIO18 +GP19,GPIO19 +GP20,GPIO20 +GP21,GPIO21 +GP22,GPIO22 +GP26,GPIO26 +GP27,GPIO27 +GP28,GPIO28 +WL_GPIO0,EXT_GPIO0 +WL_GPIO1,EXT_GPIO1 +WL_GPIO2,EXT_GPIO2 +LED,EXT_GPIO0 \ No newline at end of file