From 883d751f5269b4d2f8a103fd35b41a22b858ca06 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Tue, 28 Mar 2023 20:51:21 +0100 Subject: [PATCH] CI: Switch to MICROPY_BOARD_DIR and simplify fixups. --- .github/workflows/micropython.yml | 13 +- .../badger2040/PIMORONI_BADGER2040/board.json | 17 --- .../PIMORONI_BADGER2040/mpconfigboard.cmake | 1 - .../PIMORONI_BADGER2040/mpconfigboard.h | 3 - micropython/_board/badger2040/fixup.sh | 6 - .../_board/badger2040/pimoroni_badger2040.h | 116 --------------- .../_board/badger2040/wakeup_gpio.patch | 138 ------------------ .../PIMORONI_BADGER2040W/board.json | 17 --- .../PIMORONI_BADGER2040W/mpconfigboard.cmake | 8 - .../PIMORONI_BADGER2040W/mpconfigboard.h | 20 --- .../badger2040w/PIMORONI_BADGER2040W/pins.csv | 30 ---- micropython/_board/badger2040w/fixup.sh | 6 - .../_board/badger2040w/pimoroni_badger2040w.h | 137 ----------------- .../_board/badger2040w/wakeup_gpio.patch | 138 ------------------ micropython/_board/board-fixup.sh | 21 --- .../picow_enviro/PICO_W_ENVIRO/manifest.py | 6 - micropython/_board/picow_enviro/fixup.sh | 6 - .../_board/picow_enviro/pico_w_enviro.h | 102 ------------- .../picow_inky_frame/PICO_W_INKY/manifest.py | 7 - micropython/_board/picow_inky_frame/fixup.sh | 6 - .../_board/picow_inky_frame/pico_w_inky.h | 102 ------------- .../_board/tufty2040/pimoroni_tufty2040.h | 68 --------- .../PICO_W_ENVIRO/board.json | 0 micropython/board/PICO_W_ENVIRO/manifest.py | 6 + .../PICO_W_ENVIRO/mpconfigboard.cmake | 0 .../PICO_W_ENVIRO/mpconfigboard.h | 0 .../PICO_W_ENVIRO/pico_sdk.patch} | 0 .../PICO_W_ENVIRO/pins.csv | 0 .../PICO_W_INKY/board.json | 0 .../PICO_W_INKY}/manifest.py | 2 +- .../PICO_W_INKY/mpconfigboard.cmake | 0 .../PICO_W_INKY/mpconfigboard.h | 0 .../PICO_W_INKY/pico_sdk.patch} | 0 .../PICO_W_INKY/pins.csv | 0 .../PIMORONI_TUFTY2040/board.json | 0 .../PIMORONI_TUFTY2040/mpconfigboard.cmake | 0 .../PIMORONI_TUFTY2040/mpconfigboard.h | 0 micropython/board/pico-sdk-patch.sh | 10 ++ .../modules/micropython-picow_enviro.cmake | 2 + .../micropython-picow_inky_frame.cmake | 2 + .../modules/micropython-tufty2040.cmake | 2 + 41 files changed, 31 insertions(+), 961 deletions(-) delete mode 100644 micropython/_board/badger2040/PIMORONI_BADGER2040/board.json delete mode 100644 micropython/_board/badger2040/PIMORONI_BADGER2040/mpconfigboard.cmake delete mode 100644 micropython/_board/badger2040/PIMORONI_BADGER2040/mpconfigboard.h delete mode 100644 micropython/_board/badger2040/fixup.sh delete mode 100644 micropython/_board/badger2040/pimoroni_badger2040.h delete mode 100644 micropython/_board/badger2040/wakeup_gpio.patch delete mode 100644 micropython/_board/badger2040w/PIMORONI_BADGER2040W/board.json delete mode 100644 micropython/_board/badger2040w/PIMORONI_BADGER2040W/mpconfigboard.cmake delete mode 100644 micropython/_board/badger2040w/PIMORONI_BADGER2040W/mpconfigboard.h delete mode 100644 micropython/_board/badger2040w/PIMORONI_BADGER2040W/pins.csv delete mode 100644 micropython/_board/badger2040w/fixup.sh delete mode 100644 micropython/_board/badger2040w/pimoroni_badger2040w.h delete mode 100644 micropython/_board/badger2040w/wakeup_gpio.patch delete mode 100755 micropython/_board/board-fixup.sh delete mode 100644 micropython/_board/picow_enviro/PICO_W_ENVIRO/manifest.py delete mode 100644 micropython/_board/picow_enviro/fixup.sh delete mode 100644 micropython/_board/picow_enviro/pico_w_enviro.h delete mode 100644 micropython/_board/picow_inky_frame/PICO_W_INKY/manifest.py delete mode 100644 micropython/_board/picow_inky_frame/fixup.sh delete mode 100644 micropython/_board/picow_inky_frame/pico_w_inky.h delete mode 100644 micropython/_board/tufty2040/pimoroni_tufty2040.h rename micropython/{_board/picow_enviro => board}/PICO_W_ENVIRO/board.json (100%) create mode 100644 micropython/board/PICO_W_ENVIRO/manifest.py rename micropython/{_board/picow_enviro => board}/PICO_W_ENVIRO/mpconfigboard.cmake (100%) rename micropython/{_board/picow_enviro => board}/PICO_W_ENVIRO/mpconfigboard.h (100%) rename micropython/{_board/picow_enviro/wakeup_gpio.patch => board/PICO_W_ENVIRO/pico_sdk.patch} (100%) rename micropython/{_board/picow_enviro => board}/PICO_W_ENVIRO/pins.csv (100%) rename micropython/{_board/picow_inky_frame => board}/PICO_W_INKY/board.json (100%) rename micropython/{_board/badger2040w/PIMORONI_BADGER2040W => board/PICO_W_INKY}/manifest.py (56%) rename micropython/{_board/picow_inky_frame => board}/PICO_W_INKY/mpconfigboard.cmake (100%) rename micropython/{_board/picow_inky_frame => board}/PICO_W_INKY/mpconfigboard.h (100%) rename micropython/{_board/picow_inky_frame/wakeup_gpio.patch => board/PICO_W_INKY/pico_sdk.patch} (100%) rename micropython/{_board/picow_inky_frame => board}/PICO_W_INKY/pins.csv (100%) rename micropython/{_board/tufty2040 => board}/PIMORONI_TUFTY2040/board.json (100%) rename micropython/{_board/tufty2040 => board}/PIMORONI_TUFTY2040/mpconfigboard.cmake (100%) rename micropython/{_board/tufty2040 => board}/PIMORONI_TUFTY2040/mpconfigboard.h (100%) create mode 100755 micropython/board/pico-sdk-patch.sh diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index e1963f8e..5edbf2e5 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -75,17 +75,19 @@ jobs: - name: picolipo_16mb board: PIMORONI_PICOLIPO_16MB - name: tufty2040 - board: PIMORONI_TUFTY2040 + board: PICO - name: picow board: PICO_W - name: picow_enviro - board: PICO_W_ENVIRO + board: PICO_W + patch: true - name: picow_galactic_unicorn board: PICO_W - name: picow_cosmic_unicorn board: PICO_W - name: picow_inky_frame - board: PICO_W_INKY + board: PICO_W + patch: true env: # MicroPython version will be contained in github.event.release.tag_name for releases @@ -119,11 +121,12 @@ jobs: submodules: true path: pimoroni-pico-${{ github.sha }} - - name: "HACK: MicroPython Board Fixups" + - name: "HACK: Pico SDK Patch" + if: matrix.patch == true shell: bash working-directory: micropython/ports/rp2 run: | - ../../../pimoroni-pico-${GITHUB_SHA}/micropython/_board/board-fixup.sh ${{matrix.name}} ${{matrix.board}} ../../../pimoroni-pico-${GITHUB_SHA}/micropython/_board + ../../../pimoroni-pico-${GITHUB_SHA}/micropython/board/pico-sdk-patch.sh ${{matrix.board}} - name: Configure MicroPython shell: bash diff --git a/micropython/_board/badger2040/PIMORONI_BADGER2040/board.json b/micropython/_board/badger2040/PIMORONI_BADGER2040/board.json deleted file mode 100644 index 0acf4b6b..00000000 --- a/micropython/_board/badger2040/PIMORONI_BADGER2040/board.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "deploy": [ - "../deploy.md" - ], - "docs": "", - "features": [ - "296*128 e-Ink", - "Buttons" - ], - "images": [ - ], - "mcu": "rp2040", - "product": "Badger2040 (2MiB)", - "thumbnail": "", - "url": "https://shop.pimoroni.com/products/badger-2040", - "vendor": "Pimoroni" -} diff --git a/micropython/_board/badger2040/PIMORONI_BADGER2040/mpconfigboard.cmake b/micropython/_board/badger2040/PIMORONI_BADGER2040/mpconfigboard.cmake deleted file mode 100644 index f9699b9f..00000000 --- a/micropython/_board/badger2040/PIMORONI_BADGER2040/mpconfigboard.cmake +++ /dev/null @@ -1 +0,0 @@ -# cmake file for Pimoroni Badger 2040 diff --git a/micropython/_board/badger2040/PIMORONI_BADGER2040/mpconfigboard.h b/micropython/_board/badger2040/PIMORONI_BADGER2040/mpconfigboard.h deleted file mode 100644 index fef77142..00000000 --- a/micropython/_board/badger2040/PIMORONI_BADGER2040/mpconfigboard.h +++ /dev/null @@ -1,3 +0,0 @@ -// This is a hack! Need to replace with upstream board definition. -#define MICROPY_HW_BOARD_NAME "Pimoroni Badger2040 2MB" -#define MICROPY_HW_FLASH_STORAGE_BYTES (1024 * 1024) diff --git a/micropython/_board/badger2040/fixup.sh b/micropython/_board/badger2040/fixup.sh deleted file mode 100644 index 6acb551d..00000000 --- a/micropython/_board/badger2040/fixup.sh +++ /dev/null @@ -1,6 +0,0 @@ -SRC_DIR=$1 -DST_DIR=$2 - -echo "Applying wakeup_gpio.patch" -cd "$DST_DIR/../../lib/pico-sdk" -git apply "$SRC_DIR/wakeup_gpio.patch" \ No newline at end of file diff --git a/micropython/_board/badger2040/pimoroni_badger2040.h b/micropython/_board/badger2040/pimoroni_badger2040.h deleted file mode 100644 index 27a62655..00000000 --- a/micropython/_board/badger2040/pimoroni_badger2040.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -// ----------------------------------------------------- -// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO -// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES -// ----------------------------------------------------- - -#ifndef _BOARDS_PIMORONI_BADGER2040_H -#define _BOARDS_PIMORONI_BADGER2040_H - -// For board detection -#define PIMORONI_BADGER2040 - -// --- BOARD SPECIFIC --- -#define BADGER2040_UART 0 -#define BADGER2040_TX_PIN 0 -#define BADGER2040_RX_PIN 1 - -#define BADGER2040_I2C 0 -#define BADGER2040_INT_PIN 3 -#define BADGER2040_SDA_PIN 4 -#define BADGER2040_SCL_PIN 5 - -#define BADGER2040_3V3_EN_PIN 10 - -#define BADGER2040_SW_DOWN_PIN 11 -#define BADGER2040_SW_A_PIN 12 -#define BADGER2040_SW_B_PIN 13 -#define BADGER2040_SW_C_PIN 14 -#define BADGER2040_SW_UP_PIN 15 - -#define BADGER2040_INKY_SPI 0 -#define BADGER2040_INKY_MISO_PIN 16 -#define BADGER2040_INKY_CSN_PIN 17 -#define BADGER2040_INKY_SCK_PIN 18 -#define BADGER2040_INKY_MOSI_PIN 19 -#define BADGER2040_INKY_DC_PIN 20 -#define BADGER2040_INKY_RESET_PIN 21 -#define BADGER2040_INKY_BUSY_PIN 26 - -#define BADGER2040_USER_SW_PIN 23 -#define BADGER2040_USER_LED_PIN 25 - -#define BADGER2040_VBUS_DETECT_PIN 24 -#define BADGER2040_VREF_POWER_PIN 27 -#define BADGER2040_1V2_REF_PIN 28 -#define BADGER2040_BAT_SENSE_PIN 29 - -// --- UART --- -#ifndef PICO_DEFAULT_UART -#define PICO_DEFAULT_UART BADGER2040_UART -#endif - -#ifndef PICO_DEFAULT_UART_TX_PIN -#define PICO_DEFAULT_UART_TX_PIN BADGER2040_TX_PIN -#endif - -#ifndef PICO_DEFAULT_UART_RX_PIN -#define PICO_DEFAULT_UART_RX_PIN BADGER2040_RX_PIN -#endif - -// --- LED --- -#ifndef PICO_DEFAULT_LED_PIN -#define PICO_DEFAULT_LED_PIN BADGER2040_USER_LED_PIN -#endif -// no PICO_DEFAULT_WS2812_PIN - -// --- I2C --- -#ifndef PICO_DEFAULT_I2C -#define PICO_DEFAULT_I2C BADGER2040_I2C -#endif -#ifndef PICO_DEFAULT_I2C_SDA_PIN -#define PICO_DEFAULT_I2C_SDA_PIN BADGER2040_SDA_PIN -#endif -#ifndef PICO_DEFAULT_I2C_SCL_PIN -#define PICO_DEFAULT_I2C_SCL_PIN BADGER2040_SCL_PIN -#endif - -// --- SPI --- -#ifndef PICO_DEFAULT_SPI -#define PICO_DEFAULT_SPI BADGER2040_INKY_SPI -#endif -#ifndef PICO_DEFAULT_SPI_SCK_PIN -#define PICO_DEFAULT_SPI_SCK_PIN BADGER2040_INKY_SCK_PIN -#endif -#ifndef PICO_DEFAULT_SPI_TX_PIN -#define PICO_DEFAULT_SPI_TX_PIN BADGER2040_INKY_MOSI_PIN -#endif -#ifndef PICO_DEFAULT_SPI_RX_PIN -#define PICO_DEFAULT_SPI_RX_PIN BADGER2040_INKY_MISO_PIN -#endif -#ifndef PICO_DEFAULT_SPI_CSN_PIN -#define PICO_DEFAULT_SPI_CSN_PIN BADGER2040_INKY_CSN_PIN -#endif - -// --- FLASH --- -#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1 - -#ifndef PICO_FLASH_SPI_CLKDIV -#define PICO_FLASH_SPI_CLKDIV 2 -#endif - -#ifndef PICO_FLASH_SIZE_BYTES -#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024) -#endif - -// All boards have B1 RP2040 -#ifndef PICO_RP2040_B0_SUPPORTED -#define PICO_RP2040_B0_SUPPORTED 0 -#endif - -#endif \ No newline at end of file diff --git a/micropython/_board/badger2040/wakeup_gpio.patch b/micropython/_board/badger2040/wakeup_gpio.patch deleted file mode 100644 index 3cad91b0..00000000 --- a/micropython/_board/badger2040/wakeup_gpio.patch +++ /dev/null @@ -1,138 +0,0 @@ -diff --git a/src/rp2_common/pico_runtime/runtime.c b/src/rp2_common/pico_runtime/runtime.c -index f9018d0..ae8c479 100644 ---- a/src/rp2_common/pico_runtime/runtime.c -+++ b/src/rp2_common/pico_runtime/runtime.c -@@ -20,6 +20,7 @@ - #include "hardware/clocks.h" - #include "hardware/irq.h" - #include "hardware/resets.h" -+#include "hardware/gpio.h" - - #include "pico/mutex.h" - #include "pico/time.h" -@@ -35,6 +36,21 @@ - #include "pico/bootrom.h" - #endif - -+// Pins to toggle on wakeup -+#ifndef PICO_WAKEUP_PIN_MASK -+#define PICO_WAKEUP_PIN_MASK ((0b1 << 10) | (0b1 << 25)) -+#endif -+ -+// Direction -+#ifndef PICO_WAKEUP_PIN_DIR -+#define PICO_WAKEUP_PIN_DIR ((0b1 << 10) | (0b1 << 25)) -+#endif -+ -+// Value -+#ifndef PICO_WAKEUP_PIN_VALUE -+#define PICO_WAKEUP_PIN_VALUE ((0b1 << 10) | (0b1 << 25)) -+#endif -+ - extern char __StackLimit; /* Set by linker. */ - - uint32_t __attribute__((section(".ram_vector_table"))) ram_vector_table[48]; -@@ -64,7 +80,13 @@ void runtime_install_stack_guard(void *stack_bottom) { - | 0x10000000; // XN = disable instruction fetch; no other bits means no permissions - } - --void runtime_init(void) { -+void runtime_user_init(void) { -+ gpio_init_mask(PICO_WAKEUP_PIN_MASK); -+ gpio_set_dir_masked(PICO_WAKEUP_PIN_MASK, PICO_WAKEUP_PIN_DIR); -+ gpio_put_masked(PICO_WAKEUP_PIN_MASK, PICO_WAKEUP_PIN_VALUE); -+} -+ -+void runtime_reset_peripherals(void) { - // Reset all peripherals to put system into a known state, - // - except for QSPI pads and the XIP IO bank, as this is fatal if running from flash - // - and the PLLs, as this is fatal if clock muxing has not been reset on this boot -@@ -89,7 +111,9 @@ void runtime_init(void) { - RESETS_RESET_UART1_BITS | - RESETS_RESET_USBCTRL_BITS - )); -+} - -+void runtime_init(void) { - // pre-init runs really early since we need it even for memcpy and divide! - // (basically anything in aeabi that uses bootrom) - -diff --git a/src/rp2_common/pico_standard_link/crt0.S b/src/rp2_common/pico_standard_link/crt0.S -index d061108..e48d870 100644 ---- a/src/rp2_common/pico_standard_link/crt0.S -+++ b/src/rp2_common/pico_standard_link/crt0.S -@@ -10,6 +10,8 @@ - #include "hardware/regs/sio.h" - #include "pico/asm_helper.S" - #include "pico/binary_info/defs.h" -+#include "hardware/regs/resets.h" -+#include "hardware/regs/rosc.h" - - #ifdef NDEBUG - #ifndef COLLAPSE_IRQS -@@ -226,6 +228,23 @@ _reset_handler: - cmp r0, #0 - bne hold_non_core0_in_bootrom - -+ // Increase ROSC frequency to ~48MHz (range 14.4 - 96) -+ // Startup drops from ~160ms to ~32ms on Pico W MicroPython -+ ldr r0, =(ROSC_BASE + ROSC_DIV_OFFSET) -+ ldr r1, =0xaa2 -+ str r1, [r0] -+ -+ ldr r1, =runtime_reset_peripherals -+ blx r1 -+ -+ ldr r1, =runtime_user_init -+ blx r1 -+ -+ // Read GPIO state for front buttons and store -+ movs r3, 0xd0 // Load 0xd0 into r3 -+ lsls r3, r3, 24 // Shift left 24 to get 0xd0000000 -+ ldr r6, [r3, 4] // Load GPIO state (0xd0000004) into r6 -+ - // In a NO_FLASH binary, don't perform .data copy, since it's loaded - // in-place by the SRAM load. Still need to clear .bss - #if !PICO_NO_FLASH -@@ -252,6 +271,10 @@ bss_fill_test: - cmp r1, r2 - bne bss_fill_loop - -+ // runtime_wakeup_gpio_state gets zero init above -+ ldr r2, =runtime_wakeup_gpio_state // Load output var addr into r2 -+ str r6, [r2] // Store r6 to r2 -+ - platform_entry: // symbol for stack traces - // Use 32-bit jumps, in case these symbols are moved out of branch range - // (e.g. if main is in SRAM and crt0 in flash) -@@ -311,6 +334,19 @@ data_cpy_table: - runtime_init: - bx lr - -+.weak runtime_user_init -+.type runtime_user_init,%function -+.thumb_func -+runtime_user_init: -+ bx lr -+ -+.weak runtime_reset_peripherals -+.type runtime_reset_peripherals,%function -+.thumb_func -+runtime_reset_peripherals: -+ bx lr -+ -+ - // ---------------------------------------------------------------------------- - // If core 1 somehow gets into crt0 due to a spectacular VTOR mishap, we need to - // catch it and send back to the sleep-and-launch code in the bootrom. Shouldn't -@@ -335,3 +371,9 @@ hold_non_core0_in_bootrom: - .align 2 - .equ HeapSize, PICO_HEAP_SIZE - .space HeapSize -+ -+.section .data._reset_handler -+.global runtime_wakeup_gpio_state -+.align 4 -+runtime_wakeup_gpio_state: -+.word 0x00000000 -\ No newline at end of file diff --git a/micropython/_board/badger2040w/PIMORONI_BADGER2040W/board.json b/micropython/_board/badger2040w/PIMORONI_BADGER2040W/board.json deleted file mode 100644 index d5d4332e..00000000 --- a/micropython/_board/badger2040w/PIMORONI_BADGER2040W/board.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "deploy": [ - "../deploy.md" - ], - "docs": "", - "features": [ - "296*128 e-Ink", - "Buttons" - ], - "images": [ - ], - "mcu": "rp2040", - "product": "Badger2040 W (2MiB)", - "thumbnail": "", - "url": "https://shop.pimoroni.com/products/badger-2040w", - "vendor": "Pimoroni" -} diff --git a/micropython/_board/badger2040w/PIMORONI_BADGER2040W/mpconfigboard.cmake b/micropython/_board/badger2040w/PIMORONI_BADGER2040W/mpconfigboard.cmake deleted file mode 100644 index d0b32b91..00000000 --- a/micropython/_board/badger2040w/PIMORONI_BADGER2040W/mpconfigboard.cmake +++ /dev/null @@ -1,8 +0,0 @@ -# cmake file for Pimoroni Badger 2040W -set(MICROPY_BOARD PICO_W) - -set(MICROPY_PY_LWIP ON) -set(MICROPY_PY_NETWORK_CYW43 ON) - -# Board specific version of the frozen manifest -set(MICROPY_FROZEN_MANIFEST ${CMAKE_SOURCE_DIR}/boards/PIMORONI_BADGER2040W/manifest.py) \ No newline at end of file diff --git a/micropython/_board/badger2040w/PIMORONI_BADGER2040W/mpconfigboard.h b/micropython/_board/badger2040w/PIMORONI_BADGER2040W/mpconfigboard.h deleted file mode 100644 index 89594311..00000000 --- a/micropython/_board/badger2040w/PIMORONI_BADGER2040W/mpconfigboard.h +++ /dev/null @@ -1,20 +0,0 @@ -// This is a hack! Need to replace with upstream board definition. -#define MICROPY_HW_BOARD_NAME "Pimoroni Badger2040W 2MB" -#define MICROPY_HW_FLASH_STORAGE_BYTES (848 * 1024) - -// Enable networking. -#define MICROPY_PY_NETWORK 1 - -// CYW43 driver configuration. -#define CYW43_USE_SPI (1) -#define CYW43_LWIP (1) -#define CYW43_GPIO (1) -#define CYW43_SPI_PIO (1) - -// For debugging mbedtls - also set -// Debug level (0-4) 1=warning, 2=info, 3=debug, 4=verbose -// #define MODUSSL_MBEDTLS_DEBUG_LEVEL 1 - -#define MICROPY_HW_PIN_EXT_COUNT CYW43_WL_GPIO_COUNT - -#define MICROPY_HW_PIN_RESERVED(i) ((i) == CYW43_PIN_WL_HOST_WAKE || (i) == CYW43_PIN_WL_REG_ON) \ No newline at end of file diff --git a/micropython/_board/badger2040w/PIMORONI_BADGER2040W/pins.csv b/micropython/_board/badger2040w/PIMORONI_BADGER2040W/pins.csv deleted file mode 100644 index 012bc7c7..00000000 --- a/micropython/_board/badger2040w/PIMORONI_BADGER2040W/pins.csv +++ /dev/null @@ -1,30 +0,0 @@ -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 diff --git a/micropython/_board/badger2040w/fixup.sh b/micropython/_board/badger2040w/fixup.sh deleted file mode 100644 index 6acb551d..00000000 --- a/micropython/_board/badger2040w/fixup.sh +++ /dev/null @@ -1,6 +0,0 @@ -SRC_DIR=$1 -DST_DIR=$2 - -echo "Applying wakeup_gpio.patch" -cd "$DST_DIR/../../lib/pico-sdk" -git apply "$SRC_DIR/wakeup_gpio.patch" \ No newline at end of file diff --git a/micropython/_board/badger2040w/pimoroni_badger2040w.h b/micropython/_board/badger2040w/pimoroni_badger2040w.h deleted file mode 100644 index 88610e7b..00000000 --- a/micropython/_board/badger2040w/pimoroni_badger2040w.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -// ----------------------------------------------------- -// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO -// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES -// ----------------------------------------------------- - -#ifndef _BOARDS_PIMORONI_BADGER2040_H -#define _BOARDS_PIMORONI_BADGER2040_H - -// For board detection -#define RASPBERRYPI_PICO_W -#define PIMORONI_BADGER2040 -#define PIMORONI_BADGER2040W - -// --- BOARD SPECIFIC --- -#define BADGER2040_UART 0 -#define BADGER2040_TX_PIN 0 -#define BADGER2040_RX_PIN 1 - -#define BADGER2040_I2C 0 -#define BADGER2040_INT_PIN 3 -#define BADGER2040_SDA_PIN 4 -#define BADGER2040_SCL_PIN 5 - -#define BADGER2040_3V3_EN_PIN 10 - -#define BADGER2040_SW_DOWN_PIN 11 -#define BADGER2040_SW_A_PIN 12 -#define BADGER2040_SW_B_PIN 13 -#define BADGER2040_SW_C_PIN 14 -#define BADGER2040_SW_UP_PIN 15 - -#define BADGER2040_INKY_SPI 0 -#define BADGER2040_INKY_MISO_PIN 16 -#define BADGER2040_INKY_CSN_PIN 17 -#define BADGER2040_INKY_SCK_PIN 18 -#define BADGER2040_INKY_MOSI_PIN 19 -#define BADGER2040_INKY_DC_PIN 20 -#define BADGER2040_INKY_RESET_PIN 21 -#define BADGER2040_INKY_BUSY_PIN 26 - -#define BADGER2040_USER_SW_PIN 23 -#define BADGER2040_USER_LED_PIN 25 - -#define BADGER2040_VBUS_DETECT_PIN 24 -#define BADGER2040_VREF_POWER_PIN 27 -#define BADGER2040_1V2_REF_PIN 28 -#define BADGER2040_BAT_SENSE_PIN 29 - -// --- UART --- -#ifndef PICO_DEFAULT_UART -#define PICO_DEFAULT_UART BADGER2040_UART -#endif - -#ifndef PICO_DEFAULT_UART_TX_PIN -#define PICO_DEFAULT_UART_TX_PIN BADGER2040_TX_PIN -#endif - -#ifndef PICO_DEFAULT_UART_RX_PIN -#define PICO_DEFAULT_UART_RX_PIN BADGER2040_RX_PIN -#endif - -// --- LED --- -#ifndef PICO_DEFAULT_LED_PIN -#define PICO_DEFAULT_LED_PIN BADGER2040_USER_LED_PIN -#endif -// no PICO_DEFAULT_WS2812_PIN - -// --- I2C --- -#ifndef PICO_DEFAULT_I2C -#define PICO_DEFAULT_I2C BADGER2040_I2C -#endif -#ifndef PICO_DEFAULT_I2C_SDA_PIN -#define PICO_DEFAULT_I2C_SDA_PIN BADGER2040_SDA_PIN -#endif -#ifndef PICO_DEFAULT_I2C_SCL_PIN -#define PICO_DEFAULT_I2C_SCL_PIN BADGER2040_SCL_PIN -#endif - -// --- SPI --- -#ifndef PICO_DEFAULT_SPI -#define PICO_DEFAULT_SPI BADGER2040_INKY_SPI -#endif -#ifndef PICO_DEFAULT_SPI_SCK_PIN -#define PICO_DEFAULT_SPI_SCK_PIN BADGER2040_INKY_SCK_PIN -#endif -#ifndef PICO_DEFAULT_SPI_TX_PIN -#define PICO_DEFAULT_SPI_TX_PIN BADGER2040_INKY_MOSI_PIN -#endif -#ifndef PICO_DEFAULT_SPI_RX_PIN -#define PICO_DEFAULT_SPI_RX_PIN BADGER2040_INKY_MISO_PIN -#endif -#ifndef PICO_DEFAULT_SPI_CSN_PIN -#define PICO_DEFAULT_SPI_CSN_PIN BADGER2040_INKY_CSN_PIN -#endif - -// --- FLASH --- -#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1 - -#ifndef PICO_FLASH_SPI_CLKDIV -#define PICO_FLASH_SPI_CLKDIV 2 -#endif - -#ifndef PICO_FLASH_SIZE_BYTES -#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024) -#endif - -#ifndef PICO_RP2040_B0_SUPPORTED -#define PICO_RP2040_B0_SUPPORTED 0 -#endif - -#ifndef PICO_RP2040_B1_SUPPORTED -#define PICO_RP2040_B1_SUPPORTED 0 -#endif - -#ifndef CYW43_PIN_WL_HOST_WAKE -#define CYW43_PIN_WL_HOST_WAKE 24 -#endif - -#ifndef CYW43_PIN_WL_REG_ON -#define CYW43_PIN_WL_REG_ON 23 -#endif - -#ifndef CYW43_WL_GPIO_COUNT -#define CYW43_WL_GPIO_COUNT 3 -#endif - -#ifndef CYW43_WL_GPIO_LED_PIN -#define CYW43_WL_GPIO_LED_PIN 0 -#endif - -#endif \ No newline at end of file diff --git a/micropython/_board/badger2040w/wakeup_gpio.patch b/micropython/_board/badger2040w/wakeup_gpio.patch deleted file mode 100644 index 4eee2880..00000000 --- a/micropython/_board/badger2040w/wakeup_gpio.patch +++ /dev/null @@ -1,138 +0,0 @@ -diff --git a/src/rp2_common/pico_runtime/runtime.c b/src/rp2_common/pico_runtime/runtime.c -index f9018d0..ae8c479 100644 ---- a/src/rp2_common/pico_runtime/runtime.c -+++ b/src/rp2_common/pico_runtime/runtime.c -@@ -20,6 +20,7 @@ - #include "hardware/clocks.h" - #include "hardware/irq.h" - #include "hardware/resets.h" -+#include "hardware/gpio.h" - - #include "pico/mutex.h" - #include "pico/time.h" -@@ -35,6 +36,21 @@ - #include "pico/bootrom.h" - #endif - -+// Pins to toggle on wakeup -+#ifndef PICO_WAKEUP_PIN_MASK -+#define PICO_WAKEUP_PIN_MASK ((0b1 << 10) | (0b1 << 22)) -+#endif -+ -+// Direction -+#ifndef PICO_WAKEUP_PIN_DIR -+#define PICO_WAKEUP_PIN_DIR ((0b1 << 10) | (0b1 << 22)) -+#endif -+ -+// Value -+#ifndef PICO_WAKEUP_PIN_VALUE -+#define PICO_WAKEUP_PIN_VALUE ((0b1 << 10) | (0b1 << 22)) -+#endif -+ - extern char __StackLimit; /* Set by linker. */ - - uint32_t __attribute__((section(".ram_vector_table"))) ram_vector_table[48]; -@@ -64,7 +80,13 @@ void runtime_install_stack_guard(void *stack_bottom) { - | 0x10000000; // XN = disable instruction fetch; no other bits means no permissions - } - --void runtime_init(void) { -+void runtime_user_init(void) { -+ gpio_init_mask(PICO_WAKEUP_PIN_MASK); -+ gpio_set_dir_masked(PICO_WAKEUP_PIN_MASK, PICO_WAKEUP_PIN_DIR); -+ gpio_put_masked(PICO_WAKEUP_PIN_MASK, PICO_WAKEUP_PIN_VALUE); -+} -+ -+void runtime_reset_peripherals(void) { - // Reset all peripherals to put system into a known state, - // - except for QSPI pads and the XIP IO bank, as this is fatal if running from flash - // - and the PLLs, as this is fatal if clock muxing has not been reset on this boot -@@ -89,7 +111,9 @@ void runtime_init(void) { - RESETS_RESET_UART1_BITS | - RESETS_RESET_USBCTRL_BITS - )); -+} - -+void runtime_init(void) { - // pre-init runs really early since we need it even for memcpy and divide! - // (basically anything in aeabi that uses bootrom) - -diff --git a/src/rp2_common/pico_standard_link/crt0.S b/src/rp2_common/pico_standard_link/crt0.S -index d061108..e48d870 100644 ---- a/src/rp2_common/pico_standard_link/crt0.S -+++ b/src/rp2_common/pico_standard_link/crt0.S -@@ -10,6 +10,8 @@ - #include "hardware/regs/sio.h" - #include "pico/asm_helper.S" - #include "pico/binary_info/defs.h" -+#include "hardware/regs/resets.h" -+#include "hardware/regs/rosc.h" - - #ifdef NDEBUG - #ifndef COLLAPSE_IRQS -@@ -226,6 +228,23 @@ _reset_handler: - cmp r0, #0 - bne hold_non_core0_in_bootrom - -+ // Increase ROSC frequency to ~48MHz (range 14.4 - 96) -+ // Startup drops from ~160ms to ~32ms on Pico W MicroPython -+ ldr r0, =(ROSC_BASE + ROSC_DIV_OFFSET) -+ ldr r1, =0xaa2 -+ str r1, [r0] -+ -+ ldr r1, =runtime_reset_peripherals -+ blx r1 -+ -+ ldr r1, =runtime_user_init -+ blx r1 -+ -+ // Read GPIO state for front buttons and store -+ movs r3, 0xd0 // Load 0xd0 into r3 -+ lsls r3, r3, 24 // Shift left 24 to get 0xd0000000 -+ ldr r6, [r3, 4] // Load GPIO state (0xd0000004) into r6 -+ - // In a NO_FLASH binary, don't perform .data copy, since it's loaded - // in-place by the SRAM load. Still need to clear .bss - #if !PICO_NO_FLASH -@@ -252,6 +271,10 @@ bss_fill_test: - cmp r1, r2 - bne bss_fill_loop - -+ // runtime_wakeup_gpio_state gets zero init above -+ ldr r2, =runtime_wakeup_gpio_state // Load output var addr into r2 -+ str r6, [r2] // Store r6 to r2 -+ - platform_entry: // symbol for stack traces - // Use 32-bit jumps, in case these symbols are moved out of branch range - // (e.g. if main is in SRAM and crt0 in flash) -@@ -311,6 +334,19 @@ data_cpy_table: - runtime_init: - bx lr - -+.weak runtime_user_init -+.type runtime_user_init,%function -+.thumb_func -+runtime_user_init: -+ bx lr -+ -+.weak runtime_reset_peripherals -+.type runtime_reset_peripherals,%function -+.thumb_func -+runtime_reset_peripherals: -+ bx lr -+ -+ - // ---------------------------------------------------------------------------- - // If core 1 somehow gets into crt0 due to a spectacular VTOR mishap, we need to - // catch it and send back to the sleep-and-launch code in the bootrom. Shouldn't -@@ -335,3 +371,9 @@ hold_non_core0_in_bootrom: - .align 2 - .equ HeapSize, PICO_HEAP_SIZE - .space HeapSize -+ -+.section .data._reset_handler -+.global runtime_wakeup_gpio_state -+.align 4 -+runtime_wakeup_gpio_state: -+.word 0x00000000 -\ No newline at end of file diff --git a/micropython/_board/board-fixup.sh b/micropython/_board/board-fixup.sh deleted file mode 100755 index def0254e..00000000 --- a/micropython/_board/board-fixup.sh +++ /dev/null @@ -1,21 +0,0 @@ -NAME=$1 -BOARD=$2 -FIXUP_DIR=$3 -MPY_DIR=`pwd` - -echo "Fixup: $NAME $BOARD $MPY_DIR" - -if [[ ! -f "$MPY_DIR/../../lib/pico-sdk/src/boards/include/boards/pimoroni_$NAME.h" ]] && [[ -f "$FIXUP_DIR/$NAME/pimoroni_$NAME.h" ]]; then - echo "Missing Pico SDK board .h. Copying: $FIXUP_DIR/$NAME/pimoroni_$NAME.h to $MPY_DIR/../../lib/pico-sdk/src/boards/include/boards/pimoroni_$NAME.h" - cp "$FIXUP_DIR/$NAME/pimoroni_$NAME.h" "$MPY_DIR/../../lib/pico-sdk/src/boards/include/boards/pimoroni_$NAME.h" -fi - -if [[ ! -d "$MPY_DIR/boards/$BOARD" ]] && [[ -d "$FIXUP_DIR/$NAME/$BOARD/" ]]; then - echo "Missing board dir. Copying: $FIXUP_DIR/$NAME/$BOARD/ to $MPY_DIR/boards/" - cp -r "$FIXUP_DIR/$NAME/$BOARD/" "$MPY_DIR/boards/" -fi - -if [[ -f "$FIXUP_DIR/$NAME/fixup.sh" ]]; then - echo "Running custom fixup.sh" - bash "$FIXUP_DIR/$NAME/fixup.sh" "$FIXUP_DIR/$NAME" "$MPY_DIR" -fi diff --git a/micropython/_board/picow_enviro/PICO_W_ENVIRO/manifest.py b/micropython/_board/picow_enviro/PICO_W_ENVIRO/manifest.py deleted file mode 100644 index c957ba5f..00000000 --- a/micropython/_board/picow_enviro/PICO_W_ENVIRO/manifest.py +++ /dev/null @@ -1,6 +0,0 @@ -include("../manifest.py") - -require("mip") -require("ntptime") -require("urequests") -require("umqtt.simple") \ No newline at end of file diff --git a/micropython/_board/picow_enviro/fixup.sh b/micropython/_board/picow_enviro/fixup.sh deleted file mode 100644 index 6acb551d..00000000 --- a/micropython/_board/picow_enviro/fixup.sh +++ /dev/null @@ -1,6 +0,0 @@ -SRC_DIR=$1 -DST_DIR=$2 - -echo "Applying wakeup_gpio.patch" -cd "$DST_DIR/../../lib/pico-sdk" -git apply "$SRC_DIR/wakeup_gpio.patch" \ No newline at end of file diff --git a/micropython/_board/picow_enviro/pico_w_enviro.h b/micropython/_board/picow_enviro/pico_w_enviro.h deleted file mode 100644 index b4a8bd7a..00000000 --- a/micropython/_board/picow_enviro/pico_w_enviro.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2022 Raspberry Pi (Trading) Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -// ----------------------------------------------------- -// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO -// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES -// ----------------------------------------------------- - -// This header may be included by other board headers as "boards/pico.h" - -#ifndef _BOARDS_PICO_W_H -#define _BOARDS_PICO_W_H - -// For board detection -#define RASPBERRYPI_PICO_W - -// --- UART --- -#ifndef PICO_DEFAULT_UART -#define PICO_DEFAULT_UART 0 -#endif -#ifndef PICO_DEFAULT_UART_TX_PIN -#define PICO_DEFAULT_UART_TX_PIN 0 -#endif -#ifndef PICO_DEFAULT_UART_RX_PIN -#define PICO_DEFAULT_UART_RX_PIN 1 -#endif - -// --- LED --- -// no PICO_DEFAULT_LED_PIN - LED is on Wireless chip -// no PICO_DEFAULT_WS2812_PIN - -// --- I2C --- -#ifndef PICO_DEFAULT_I2C -#define PICO_DEFAULT_I2C 0 -#endif -#ifndef PICO_DEFAULT_I2C_SDA_PIN -#define PICO_DEFAULT_I2C_SDA_PIN 4 -#endif -#ifndef PICO_DEFAULT_I2C_SCL_PIN -#define PICO_DEFAULT_I2C_SCL_PIN 5 -#endif - -// --- SPI --- -#ifndef PICO_DEFAULT_SPI -#define PICO_DEFAULT_SPI 0 -#endif -#ifndef PICO_DEFAULT_SPI_SCK_PIN -#define PICO_DEFAULT_SPI_SCK_PIN 18 -#endif -#ifndef PICO_DEFAULT_SPI_TX_PIN -#define PICO_DEFAULT_SPI_TX_PIN 19 -#endif -#ifndef PICO_DEFAULT_SPI_RX_PIN -#define PICO_DEFAULT_SPI_RX_PIN 16 -#endif -#ifndef PICO_DEFAULT_SPI_CSN_PIN -#define PICO_DEFAULT_SPI_CSN_PIN 17 -#endif - -// --- FLASH --- - -#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1 - -#ifndef PICO_FLASH_SPI_CLKDIV -#define PICO_FLASH_SPI_CLKDIV 2 -#endif - -#ifndef PICO_FLASH_SIZE_BYTES -#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024) -#endif - -// note the SMSP mode pin is on WL_GPIO1 -// #define PICO_SMPS_MODE_PIN - -#ifndef PICO_RP2040_B0_SUPPORTED -#define PICO_RP2040_B0_SUPPORTED 0 -#endif - -#ifndef PICO_RP2040_B1_SUPPORTED -#define PICO_RP2040_B1_SUPPORTED 0 -#endif - -#ifndef CYW43_PIN_WL_HOST_WAKE -#define CYW43_PIN_WL_HOST_WAKE 24 -#endif - -#ifndef CYW43_PIN_WL_REG_ON -#define CYW43_PIN_WL_REG_ON 23 -#endif - -#ifndef CYW43_WL_GPIO_COUNT -#define CYW43_WL_GPIO_COUNT 3 -#endif - -#ifndef CYW43_WL_GPIO_LED_PIN -#define CYW43_WL_GPIO_LED_PIN 0 -#endif - -#endif diff --git a/micropython/_board/picow_inky_frame/PICO_W_INKY/manifest.py b/micropython/_board/picow_inky_frame/PICO_W_INKY/manifest.py deleted file mode 100644 index b446b0a0..00000000 --- a/micropython/_board/picow_inky_frame/PICO_W_INKY/manifest.py +++ /dev/null @@ -1,7 +0,0 @@ -include("../manifest.py") - -require("mip") -require("ntptime") -require("urequests") -require("urllib.urequest") -require("umqtt.simple") \ No newline at end of file diff --git a/micropython/_board/picow_inky_frame/fixup.sh b/micropython/_board/picow_inky_frame/fixup.sh deleted file mode 100644 index 6acb551d..00000000 --- a/micropython/_board/picow_inky_frame/fixup.sh +++ /dev/null @@ -1,6 +0,0 @@ -SRC_DIR=$1 -DST_DIR=$2 - -echo "Applying wakeup_gpio.patch" -cd "$DST_DIR/../../lib/pico-sdk" -git apply "$SRC_DIR/wakeup_gpio.patch" \ No newline at end of file diff --git a/micropython/_board/picow_inky_frame/pico_w_inky.h b/micropython/_board/picow_inky_frame/pico_w_inky.h deleted file mode 100644 index b4a8bd7a..00000000 --- a/micropython/_board/picow_inky_frame/pico_w_inky.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2022 Raspberry Pi (Trading) Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -// ----------------------------------------------------- -// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO -// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES -// ----------------------------------------------------- - -// This header may be included by other board headers as "boards/pico.h" - -#ifndef _BOARDS_PICO_W_H -#define _BOARDS_PICO_W_H - -// For board detection -#define RASPBERRYPI_PICO_W - -// --- UART --- -#ifndef PICO_DEFAULT_UART -#define PICO_DEFAULT_UART 0 -#endif -#ifndef PICO_DEFAULT_UART_TX_PIN -#define PICO_DEFAULT_UART_TX_PIN 0 -#endif -#ifndef PICO_DEFAULT_UART_RX_PIN -#define PICO_DEFAULT_UART_RX_PIN 1 -#endif - -// --- LED --- -// no PICO_DEFAULT_LED_PIN - LED is on Wireless chip -// no PICO_DEFAULT_WS2812_PIN - -// --- I2C --- -#ifndef PICO_DEFAULT_I2C -#define PICO_DEFAULT_I2C 0 -#endif -#ifndef PICO_DEFAULT_I2C_SDA_PIN -#define PICO_DEFAULT_I2C_SDA_PIN 4 -#endif -#ifndef PICO_DEFAULT_I2C_SCL_PIN -#define PICO_DEFAULT_I2C_SCL_PIN 5 -#endif - -// --- SPI --- -#ifndef PICO_DEFAULT_SPI -#define PICO_DEFAULT_SPI 0 -#endif -#ifndef PICO_DEFAULT_SPI_SCK_PIN -#define PICO_DEFAULT_SPI_SCK_PIN 18 -#endif -#ifndef PICO_DEFAULT_SPI_TX_PIN -#define PICO_DEFAULT_SPI_TX_PIN 19 -#endif -#ifndef PICO_DEFAULT_SPI_RX_PIN -#define PICO_DEFAULT_SPI_RX_PIN 16 -#endif -#ifndef PICO_DEFAULT_SPI_CSN_PIN -#define PICO_DEFAULT_SPI_CSN_PIN 17 -#endif - -// --- FLASH --- - -#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1 - -#ifndef PICO_FLASH_SPI_CLKDIV -#define PICO_FLASH_SPI_CLKDIV 2 -#endif - -#ifndef PICO_FLASH_SIZE_BYTES -#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024) -#endif - -// note the SMSP mode pin is on WL_GPIO1 -// #define PICO_SMPS_MODE_PIN - -#ifndef PICO_RP2040_B0_SUPPORTED -#define PICO_RP2040_B0_SUPPORTED 0 -#endif - -#ifndef PICO_RP2040_B1_SUPPORTED -#define PICO_RP2040_B1_SUPPORTED 0 -#endif - -#ifndef CYW43_PIN_WL_HOST_WAKE -#define CYW43_PIN_WL_HOST_WAKE 24 -#endif - -#ifndef CYW43_PIN_WL_REG_ON -#define CYW43_PIN_WL_REG_ON 23 -#endif - -#ifndef CYW43_WL_GPIO_COUNT -#define CYW43_WL_GPIO_COUNT 3 -#endif - -#ifndef CYW43_WL_GPIO_LED_PIN -#define CYW43_WL_GPIO_LED_PIN 0 -#endif - -#endif diff --git a/micropython/_board/tufty2040/pimoroni_tufty2040.h b/micropython/_board/tufty2040/pimoroni_tufty2040.h deleted file mode 100644 index 28a6a24f..00000000 --- a/micropython/_board/tufty2040/pimoroni_tufty2040.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -// ----------------------------------------------------- -// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO -// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES -// ----------------------------------------------------- - -#ifndef _BOARDS_PIMORONI_TUFTY_2040_H -#define _BOARDS_PIMORONI_TUFTY_2040_H - -// For board detection -#define PIMORONI_TUFTY_2040 - -// --- LED --- -#ifndef PICO_DEFAULT_LED_PIN -#define PICO_DEFAULT_LED_PIN 25 -#endif -// no PICO_DEFAULT_WS2812_PIN - -// --- I2C --- -#ifndef PICO_DEFAULT_I2C -#define PICO_DEFAULT_I2C 0 -#endif -#ifndef PICO_DEFAULT_I2C_SDA_PIN -#define PICO_DEFAULT_I2C_SDA_PIN 4 -#endif -#ifndef PICO_DEFAULT_I2C_SCL_PIN -#define PICO_DEFAULT_I2C_SCL_PIN 5 -#endif - -// --- SPI --- -#ifndef PICO_DEFAULT_SPI -#define PICO_DEFAULT_SPI 0 -#endif -#ifndef PICO_DEFAULT_SPI_SCK_PIN -#define PICO_DEFAULT_SPI_SCK_PIN 18 -#endif -#ifndef PICO_DEFAULT_SPI_TX_PIN -#define PICO_DEFAULT_SPI_TX_PIN 19 -#endif -#ifndef PICO_DEFAULT_SPI_RX_PIN -#define PICO_DEFAULT_SPI_RX_PIN 16 -#endif -#ifndef PICO_DEFAULT_SPI_CSN_PIN -#define PICO_DEFAULT_SPI_CSN_PIN 17 -#endif - -// --- FLASH --- -#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1 - -#ifndef PICO_FLASH_SPI_CLKDIV -#define PICO_FLASH_SPI_CLKDIV 2 -#endif - -#ifndef PICO_FLASH_SIZE_BYTES -#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024) -#endif - -// All boards have B1 RP2040 -#ifndef PICO_RP2040_B0_SUPPORTED -#define PICO_RP2040_B0_SUPPORTED 0 -#endif - -#endif diff --git a/micropython/_board/picow_enviro/PICO_W_ENVIRO/board.json b/micropython/board/PICO_W_ENVIRO/board.json similarity index 100% rename from micropython/_board/picow_enviro/PICO_W_ENVIRO/board.json rename to micropython/board/PICO_W_ENVIRO/board.json diff --git a/micropython/board/PICO_W_ENVIRO/manifest.py b/micropython/board/PICO_W_ENVIRO/manifest.py new file mode 100644 index 00000000..d81af38e --- /dev/null +++ b/micropython/board/PICO_W_ENVIRO/manifest.py @@ -0,0 +1,6 @@ +include("$(PORT_DIR)/boards/manifest.py") + +require("mip") +require("ntptime") +require("urequests") +require("umqtt.simple") \ No newline at end of file diff --git a/micropython/_board/picow_enviro/PICO_W_ENVIRO/mpconfigboard.cmake b/micropython/board/PICO_W_ENVIRO/mpconfigboard.cmake similarity index 100% rename from micropython/_board/picow_enviro/PICO_W_ENVIRO/mpconfigboard.cmake rename to micropython/board/PICO_W_ENVIRO/mpconfigboard.cmake diff --git a/micropython/_board/picow_enviro/PICO_W_ENVIRO/mpconfigboard.h b/micropython/board/PICO_W_ENVIRO/mpconfigboard.h similarity index 100% rename from micropython/_board/picow_enviro/PICO_W_ENVIRO/mpconfigboard.h rename to micropython/board/PICO_W_ENVIRO/mpconfigboard.h diff --git a/micropython/_board/picow_enviro/wakeup_gpio.patch b/micropython/board/PICO_W_ENVIRO/pico_sdk.patch similarity index 100% rename from micropython/_board/picow_enviro/wakeup_gpio.patch rename to micropython/board/PICO_W_ENVIRO/pico_sdk.patch diff --git a/micropython/_board/picow_enviro/PICO_W_ENVIRO/pins.csv b/micropython/board/PICO_W_ENVIRO/pins.csv similarity index 100% rename from micropython/_board/picow_enviro/PICO_W_ENVIRO/pins.csv rename to micropython/board/PICO_W_ENVIRO/pins.csv diff --git a/micropython/_board/picow_inky_frame/PICO_W_INKY/board.json b/micropython/board/PICO_W_INKY/board.json similarity index 100% rename from micropython/_board/picow_inky_frame/PICO_W_INKY/board.json rename to micropython/board/PICO_W_INKY/board.json diff --git a/micropython/_board/badger2040w/PIMORONI_BADGER2040W/manifest.py b/micropython/board/PICO_W_INKY/manifest.py similarity index 56% rename from micropython/_board/badger2040w/PIMORONI_BADGER2040W/manifest.py rename to micropython/board/PICO_W_INKY/manifest.py index b446b0a0..bcd56662 100644 --- a/micropython/_board/badger2040w/PIMORONI_BADGER2040W/manifest.py +++ b/micropython/board/PICO_W_INKY/manifest.py @@ -1,4 +1,4 @@ -include("../manifest.py") +include("$(PORT_DIR)/boards/manifest.py") require("mip") require("ntptime") diff --git a/micropython/_board/picow_inky_frame/PICO_W_INKY/mpconfigboard.cmake b/micropython/board/PICO_W_INKY/mpconfigboard.cmake similarity index 100% rename from micropython/_board/picow_inky_frame/PICO_W_INKY/mpconfigboard.cmake rename to micropython/board/PICO_W_INKY/mpconfigboard.cmake diff --git a/micropython/_board/picow_inky_frame/PICO_W_INKY/mpconfigboard.h b/micropython/board/PICO_W_INKY/mpconfigboard.h similarity index 100% rename from micropython/_board/picow_inky_frame/PICO_W_INKY/mpconfigboard.h rename to micropython/board/PICO_W_INKY/mpconfigboard.h diff --git a/micropython/_board/picow_inky_frame/wakeup_gpio.patch b/micropython/board/PICO_W_INKY/pico_sdk.patch similarity index 100% rename from micropython/_board/picow_inky_frame/wakeup_gpio.patch rename to micropython/board/PICO_W_INKY/pico_sdk.patch diff --git a/micropython/_board/picow_inky_frame/PICO_W_INKY/pins.csv b/micropython/board/PICO_W_INKY/pins.csv similarity index 100% rename from micropython/_board/picow_inky_frame/PICO_W_INKY/pins.csv rename to micropython/board/PICO_W_INKY/pins.csv diff --git a/micropython/_board/tufty2040/PIMORONI_TUFTY2040/board.json b/micropython/board/PIMORONI_TUFTY2040/board.json similarity index 100% rename from micropython/_board/tufty2040/PIMORONI_TUFTY2040/board.json rename to micropython/board/PIMORONI_TUFTY2040/board.json diff --git a/micropython/_board/tufty2040/PIMORONI_TUFTY2040/mpconfigboard.cmake b/micropython/board/PIMORONI_TUFTY2040/mpconfigboard.cmake similarity index 100% rename from micropython/_board/tufty2040/PIMORONI_TUFTY2040/mpconfigboard.cmake rename to micropython/board/PIMORONI_TUFTY2040/mpconfigboard.cmake diff --git a/micropython/_board/tufty2040/PIMORONI_TUFTY2040/mpconfigboard.h b/micropython/board/PIMORONI_TUFTY2040/mpconfigboard.h similarity index 100% rename from micropython/_board/tufty2040/PIMORONI_TUFTY2040/mpconfigboard.h rename to micropython/board/PIMORONI_TUFTY2040/mpconfigboard.h diff --git a/micropython/board/pico-sdk-patch.sh b/micropython/board/pico-sdk-patch.sh new file mode 100755 index 00000000..eb2ea42e --- /dev/null +++ b/micropython/board/pico-sdk-patch.sh @@ -0,0 +1,10 @@ +BOARD=$1 +FIXUP_DIR="$(dirname -- "$(readlink -f "${BASH_SOURCE}")")" + +MPY_DIR=`pwd` + +if [[ -f "$FIXUP_DIR/$BOARD/pico_sdk.patch" ]]; then + echo "Applying pico_sdk.patch" + cd $MPY_DIR/lib/pico-sdk + git apply "$FIXUP_DIR/$BOARD/pico_sdk.patch" +fi \ No newline at end of file diff --git a/micropython/modules/micropython-picow_enviro.cmake b/micropython/modules/micropython-picow_enviro.cmake index cd5f00c6..f57f8ab3 100644 --- a/micropython/modules/micropython-picow_enviro.cmake +++ b/micropython/modules/micropython-picow_enviro.cmake @@ -7,6 +7,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../") set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) +set(MICROPY_BOARD_DIR "${CMAKE_CURRENT_LIST_DIR}/../board/PICO_W_ENVIRO") + # Essential include(pimoroni_i2c/micropython) include(pimoroni_bus/micropython) diff --git a/micropython/modules/micropython-picow_inky_frame.cmake b/micropython/modules/micropython-picow_inky_frame.cmake index 64810a5a..76f6e846 100644 --- a/micropython/modules/micropython-picow_inky_frame.cmake +++ b/micropython/modules/micropython-picow_inky_frame.cmake @@ -7,6 +7,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../") set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) +set(MICROPY_BOARD_DIR "${CMAKE_CURRENT_LIST_DIR}/../board/PICO_W_INKY") + # Essential include(pimoroni_i2c/micropython) include(pimoroni_bus/micropython) diff --git a/micropython/modules/micropython-tufty2040.cmake b/micropython/modules/micropython-tufty2040.cmake index 5b4fe1cc..88a803d9 100644 --- a/micropython/modules/micropython-tufty2040.cmake +++ b/micropython/modules/micropython-tufty2040.cmake @@ -7,6 +7,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../") set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) +set(MICROPY_BOARD_DIR "${CMAKE_CURRENT_LIST_DIR}/../board/PIMORONI_TUFTY2040") + # Essential include(pimoroni_i2c/micropython) include(pimoroni_bus/micropython)