From 4252521227ac94cbc7611c39f359bd36ed656e86 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 21 Oct 2024 12:38:01 +0100 Subject: [PATCH 1/7] CI: Target MicroPython edge. --- .github/workflows/micropython.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index 06417d9..8e31fae 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -7,8 +7,9 @@ on: types: [created] env: - MICROPYTHON_VERSION: v1.23.0 - PIMORONI_PICO_VERSION: v1.23.0-1 + MICROPYTHON_VERSION: master + MICROPYTHON_FLAVOUR: micropython + PIMORONI_PICO_VERSION: ci/micropython-edge WORKFLOW_VERSION: v3 jobs: @@ -30,7 +31,7 @@ jobs: if: steps.cache.outputs.cache-hit != 'true' uses: actions/checkout@v4 with: - repository: micropython/micropython + repository: ${{env.MICROPYTHON_FLAVOUR}}/micropython ref: ${{env.MICROPYTHON_VERSION}} submodules: false # MicroPython submodules are hideously broken path: micropython From 6d86df47fe778deabebcbe2ba00d357f20d89312 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 21 Oct 2024 12:39:42 +0100 Subject: [PATCH 2/7] CI: Bump py_decl and dir2uf2. --- .github/workflows/micropython.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index 8e31fae..be2a3f7 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -111,14 +111,14 @@ jobs: uses: actions/checkout@v4 with: repository: gadgetoid/py_decl - ref: v0.0.1 + ref: v0.0.4 path: py_decl # Check out dir2u2f - uses: actions/checkout@v4 with: repository: gadgetoid/dir2uf2 - ref: v0.0.5 + ref: v0.0.9 path: dir2uf2 # HACK: Patch startup overclock into Pico SDK From 7c7645c6bf40c265b27e3d17a52ee960447f1ee1 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 21 Oct 2024 14:35:03 +0100 Subject: [PATCH 3/7] CI: Drop incompatible patches. --- .github/workflows/micropython.yml | 13 ------ ...76c6ba64c5a3e68de3324556d9979f09303b.patch | 44 ------------------- firmware/startup_overclock.patch | 26 ----------- 3 files changed, 83 deletions(-) delete mode 100644 firmware/932f76c6ba64c5a3e68de3324556d9979f09303b.patch delete mode 100644 firmware/startup_overclock.patch diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index be2a3f7..61c6484 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -121,19 +121,6 @@ jobs: ref: v0.0.9 path: dir2uf2 - # HACK: Patch startup overclock into Pico SDK - - name: "HACK: Startup Overclock Patch" - shell: bash - working-directory: micropython/lib/pico-sdk - run: | - git apply "${{env.FIRMWARE_DIR}}/startup_overclock.patch" - - - name: "HACK: MicroPython out of tree board pins.csv fix" - shell: bash - working-directory: micropython - run: | - git apply "${{env.FIRMWARE_DIR}}/932f76c6ba64c5a3e68de3324556d9979f09303b.patch" - # Install apt packages - name: Install CCache & Compiler shell: bash diff --git a/firmware/932f76c6ba64c5a3e68de3324556d9979f09303b.patch b/firmware/932f76c6ba64c5a3e68de3324556d9979f09303b.patch deleted file mode 100644 index ef01ce8..0000000 --- a/firmware/932f76c6ba64c5a3e68de3324556d9979f09303b.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 932f76c6ba64c5a3e68de3324556d9979f09303b Mon Sep 17 00:00:00 2001 -From: Phil Howard -Date: Tue, 27 Feb 2024 10:19:35 +0000 -Subject: [PATCH] rp2/CMakeLists: Use MICROPY_BOARD_DIR to find pins.csv. - -Assuming that ${MICROPY_PORT_DIR}/boards/${MICROPY_BOARD} is equal to -${MICROPY_BOARD_DIR} is not valid, because the latter could point to a path -outside the main MicroPython repository. - -Replace this path with the canonical ${MICROPY_BOARD_DIR} so that pins.csv -is correctly located when building against out-of-tree board definitions. - -Additionally remove MICROPY_BOARDS_DIR to discourage similar mistakes. - -Signed-off-by: Phil Howard ---- - ports/rp2/CMakeLists.txt | 11 +++++------ - 1 file changed, 5 insertions(+), 6 deletions(-) - -diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt -index f86224a5c067..d3ecee586054 100644 ---- a/ports/rp2/CMakeLists.txt -+++ b/ports/rp2/CMakeLists.txt -@@ -530,15 +530,14 @@ endforeach() - # Include the main MicroPython cmake rules. - include(${MICROPY_DIR}/py/mkrules.cmake) - --set(MICROPY_BOARDS_DIR "${MICROPY_PORT_DIR}/boards") --set(GEN_PINS_AF_CSV "${MICROPY_BOARDS_DIR}/rp2_af.csv") --set(GEN_PINS_PREFIX "${MICROPY_BOARDS_DIR}/rp2_prefix.c") --set(GEN_PINS_MKPINS "${MICROPY_BOARDS_DIR}/make-pins.py") -+set(GEN_PINS_AF_CSV "${MICROPY_PORT_DIR}/boards/rp2_af.csv") -+set(GEN_PINS_PREFIX "${MICROPY_PORT_DIR}/boards/rp2_prefix.c") -+set(GEN_PINS_MKPINS "${MICROPY_PORT_DIR}/boards/make-pins.py") - set(GEN_PINS_SRC "${CMAKE_BINARY_DIR}/pins_${MICROPY_BOARD}.c") - set(GEN_PINS_HDR "${MICROPY_GENHDR_DIR}/pins.h") - --if(EXISTS "${MICROPY_BOARDS_DIR}/${MICROPY_BOARD}/pins.csv") -- set(GEN_PINS_BOARD_CSV "${MICROPY_BOARDS_DIR}/${MICROPY_BOARD}/pins.csv") -+if(EXISTS "${MICROPY_BOARD_DIR}/pins.csv") -+ set(GEN_PINS_BOARD_CSV "${MICROPY_BOARD_DIR}/pins.csv") - set(GEN_PINS_CSV_ARG --board-csv "${GEN_PINS_BOARD_CSV}") - endif() - diff --git a/firmware/startup_overclock.patch b/firmware/startup_overclock.patch deleted file mode 100644 index 5f80bd3..0000000 --- a/firmware/startup_overclock.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/src/rp2_common/pico_standard_link/crt0.S b/src/rp2_common/pico_standard_link/crt0.S -index 7d29f76..3baa997 100644 ---- a/src/rp2_common/pico_standard_link/crt0.S -+++ b/src/rp2_common/pico_standard_link/crt0.S -@@ -11,6 +11,8 @@ - #include "hardware/regs/addressmap.h" - #include "hardware/regs/sio.h" - #include "pico/binary_info/defs.h" -+#include "hardware/regs/resets.h" -+#include "hardware/regs/rosc.h" - - #ifdef NDEBUG - #ifndef COLLAPSE_IRQS -@@ -225,6 +227,12 @@ _reset_handler: - cmp r0, #0 - bne hold_non_core0_in_bootrom - -+ // Increase ROSC frequency to ~48MHz (range 14.4 - 96) -+ // Speeds up memory zero init and preinit phases. -+ ldr r0, =(ROSC_BASE + ROSC_DIV_OFFSET) -+ ldr r1, =0xaa2 -+ str r1, [r0] -+ - // 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 From 330a60b2e9f545844f316c58867ee47b9e4e1fcf Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 16 Sep 2024 19:54:58 +0100 Subject: [PATCH 4/7] Fix Wakeup for RP2350. --- firmware/modules/wakeup/wakeup.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/firmware/modules/wakeup/wakeup.cpp b/firmware/modules/wakeup/wakeup.cpp index d0fe635..fbcbce7 100644 --- a/firmware/modules/wakeup/wakeup.cpp +++ b/firmware/modules/wakeup/wakeup.cpp @@ -12,9 +12,12 @@ struct Wakeup { gpio_set_dir_masked(WAKEUP_PIN_MASK, WAKEUP_PIN_DIR); gpio_put_masked(WAKEUP_PIN_MASK, WAKEUP_PIN_VALUE); + gpio_init_mask(~WAKEUP_PIN_MASK); + gpio_set_dir_in_masked(~WAKEUP_PIN_MASK); wakeup_gpio_state = gpio_get_all(); sleep_ms(5); wakeup_gpio_state |= gpio_get_all(); + gpio_init_mask(~WAKEUP_PIN_MASK); #if WAKEUP_HAS_RTC==1 // Set up RTC I2C pins and send reset command From 2999dccbdce167a190055c218666af8899bdfd74 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Tue, 22 Oct 2024 09:59:34 +0100 Subject: [PATCH 5/7] CI: Bump dir2uf2 to v0.0.10. --- .github/workflows/micropython.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index 61c6484..62f2ea1 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -118,7 +118,7 @@ jobs: - uses: actions/checkout@v4 with: repository: gadgetoid/dir2uf2 - ref: v0.0.9 + ref: v0.0.10 path: dir2uf2 # Install apt packages From b32ac46c2d0bb3a172abdbc539b0a212eddfa0d7 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Wed, 15 Jan 2025 12:17:09 +0000 Subject: [PATCH 6/7] CI: Switch to PicoVector 2 branch. --- .github/workflows/micropython.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index 62f2ea1..9138a93 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -9,8 +9,8 @@ on: env: MICROPYTHON_VERSION: master MICROPYTHON_FLAVOUR: micropython - PIMORONI_PICO_VERSION: ci/micropython-edge - WORKFLOW_VERSION: v3 + PIMORONI_PICO_VERSION: feature/picovector2-and-layers + WORKFLOW_VERSION: v4 jobs: deps: From c89ffa896627b11175e2c342f2e6f3b0dbc22555 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Wed, 15 Jan 2025 13:50:58 +0000 Subject: [PATCH 7/7] Badger 2040W: Update config to use mp_hal_is_pin_reserved. --- firmware/PIMORONI_BADGER2040W/mpconfigboard.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/firmware/PIMORONI_BADGER2040W/mpconfigboard.h b/firmware/PIMORONI_BADGER2040W/mpconfigboard.h index 1c39710..bfea634 100644 --- a/firmware/PIMORONI_BADGER2040W/mpconfigboard.h +++ b/firmware/PIMORONI_BADGER2040W/mpconfigboard.h @@ -18,4 +18,5 @@ #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 +int mp_hal_is_pin_reserved(int n); +#define MICROPY_HW_PIN_RESERVED(i) mp_hal_is_pin_reserved(i) \ No newline at end of file