Skip to content

Commit b6499e7

Browse files
authored
Merge pull request #764 from pimoroni/ci/smolmodules
Reduce size & workload of MicroPython build cache
2 parents 56dba37 + 7951ef9 commit b6499e7

36 files changed

+393
-44
lines changed

.github/workflows/micropython.yml

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
uses: actions/cache@v3
2020
with:
2121
path: ${{runner.workspace}}
22-
key: workspace-micropython-${{env.MICROPYTHON_VERSION}}-with-libs
22+
key: workspace-micropython-${{env.MICROPYTHON_VERSION}}-nano-specs
2323
restore-keys: |
24-
workspace-micropython-${{env.MICROPYTHON_VERSION}}-with-libs
24+
workspace-micropython-${{env.MICROPYTHON_VERSION}}-nano-specs
2525
2626
# Check out MicroPython
2727
- name: Checkout MicroPython
@@ -41,17 +41,17 @@ jobs:
4141
repository: micropython/micropython-lib
4242
path: micropython-lib
4343

44-
- name: Fetch base MicroPython submodules
44+
- name: Fetch Pico submodules
4545
if: steps.cache.outputs.cache-hit != 'true'
4646
shell: bash
47-
working-directory: micropython
48-
run: git submodule update --init
49-
50-
- name: Fetch Pico SDK submodules
51-
if: steps.cache.outputs.cache-hit != 'true'
52-
shell: bash
53-
working-directory: micropython/lib/pico-sdk
54-
run: git submodule update --init
47+
working-directory: micropython/ports/rp2
48+
run: |
49+
git submodule update --init ../../lib/pico-sdk
50+
git submodule update --init ../../lib/cyw43-driver
51+
git submodule update --init ../../lib/lwip
52+
git submodule update --init ../../lib/mbedtls
53+
git submodule update --init ../../lib/micropython-lib
54+
git submodule update --init ../../lib/tinyusb
5555
5656
- name: Build mpy-cross
5757
if: steps.cache.outputs.cache-hit != 'true'
@@ -78,18 +78,15 @@ jobs:
7878
board: PIMORONI_PICOLIPO_16MB
7979
- name: tufty2040
8080
board: PIMORONI_TUFTY2040
81-
local_board_dir: true
8281
- name: enviro
8382
board: PICO_W_ENVIRO
84-
local_board_dir: true
8583
patch: true
8684
- name: galactic_unicorn
8785
board: PICO_W
8886
- name: cosmic_unicorn
8987
board: PICO_W
9088
- name: inky_frame
9189
board: PICO_W_INKY
92-
local_board_dir: true
9390
patch: true
9491

9592
env:
@@ -131,12 +128,25 @@ jobs:
131128
run: |
132129
echo "MICROPY_GIT_TAG=$MICROPYTHON_VERSION, ${{matrix.name}} ${{github.event.release.tag_name || github.sha}}" >> $GITHUB_ENV
133130
echo "MICROPY_GIT_HASH=$MICROPYTHON_VERSION-${{github.event.release.tag_name || github.sha}}" >> $GITHUB_ENV
131+
132+
- name: "HACK: Clean ports/rp2/modules and ports/rp2/CMakeLists.txt"
133+
shell: bash
134+
working-directory: micropython/ports/rp2
135+
run: |
136+
rm -rf modules
137+
git checkout modules
134138
135-
- name: "HACK: Revert Pico SDK Patch" # Avoid an already-patched MicroPython tree breaking our build
139+
- name: "HACK: Revert Patches" # Avoid an already-patched MicroPython tree breaking our build
136140
shell: bash
137-
working-directory: micropython/lib/pico-sdk
141+
working-directory: micropython
138142
run: |
139-
git checkout .
143+
git checkout lib/pico-sdk
144+
git checkout ports/rp2/CMakeLists.txt
145+
146+
- name: "HACK: CMakeLists.txt Disable C++ Exceptions Patch"
147+
shell: bash
148+
working-directory: micropython
149+
run: git apply $GITHUB_WORKSPACE/pimoroni-pico-${{ github.sha }}/micropython/micropython_nano_specs.patch
140150

141151
- name: "HACK: Pico SDK Patch"
142152
if: matrix.patch == true
@@ -145,20 +155,12 @@ jobs:
145155
run: |
146156
$GITHUB_WORKSPACE/pimoroni-pico-${{ github.sha }}/micropython/board/pico-sdk-patch.sh ${{matrix.board}}
147157
148-
- name: Configure MicroPython (Local Board Dir)
149-
if: matrix.local_board_dir == true
158+
- name: Configure MicroPython
150159
shell: bash
151160
working-directory: micropython/ports/rp2
152161
run: |
153-
cmake -S . -B build-${{matrix.name}} -DPICO_BUILD_DOCS=0 -DUSER_C_MODULES=${{env.USER_C_MODULES}} -DMICROPY_BOARD_DIR=${{env.MICROPY_BOARD_DIR}} -DMICROPY_C_HEAP_SIZE=4096 -DMICROPY_BOARD=${{matrix.board}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
154-
155-
- name: Configure MicroPython (Upstream Board Dir)
156-
if: matrix.local_board_dir != true
157-
shell: bash
158-
working-directory: micropython/ports/rp2
159-
run: |
160-
cmake -S . -B build-${{matrix.name}} -DPICO_BUILD_DOCS=0 -DUSER_C_MODULES=${{env.USER_C_MODULES}} -DMICROPY_C_HEAP_SIZE=4096 -DMICROPY_BOARD=${{matrix.board}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
161-
162+
cmake -S . -B build-${{matrix.name}} -DPICO_BUILD_DOCS=0 -DUSER_C_MODULES=${{env.USER_C_MODULES}} -DMICROPY_BOARD_DIR=${{env.MICROPY_BOARD_DIR}} -DMICROPY_BOARD=${{matrix.board}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
163+
162164
- name: Build MicroPython # Multiple simultaneous jobs trigger https://github.com/pimoroni/pimoroni-pico/issues/761
163165
shell: bash
164166
working-directory: micropython/ports/rp2

micropython/board/PICO/board.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"deploy": [
3+
"../deploy.md"
4+
],
5+
"docs": "",
6+
"features": [
7+
"Breadboard friendly",
8+
"Castellated Pads",
9+
"Micro USB"
10+
],
11+
"id": "rp2-pico",
12+
"images": [
13+
"rp2-pico.jpg"
14+
],
15+
"mcu": "rp2040",
16+
"product": "Pico",
17+
"thumbnail": "",
18+
"url": "https://www.raspberrypi.com/products/raspberry-pi-pico/",
19+
"vendor": "Raspberry Pi"
20+
}

micropython/board/PICO/manifest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include("$(PORT_DIR)/boards/manifest.py")
2+
3+
include("../manifest_pico.py")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# cmake file for Raspberry Pi Pico
2+
3+
# Board specific version of the frozen manifest
4+
set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)
5+
6+
set(MICROPY_C_HEAP_SIZE 4096)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Board and hardware specific configuration
2+
#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico"
3+
#define MICROPY_HW_FLASH_STORAGE_BYTES (1408 * 1024)

micropython/board/PICO/pins.csv

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
GP0,GPIO0
2+
GP1,GPIO1
3+
GP2,GPIO2
4+
GP3,GPIO3
5+
GP4,GPIO4
6+
GP5,GPIO5
7+
GP6,GPIO6
8+
GP7,GPIO7
9+
GP8,GPIO8
10+
GP9,GPIO9
11+
GP10,GPIO10
12+
GP11,GPIO11
13+
GP12,GPIO12
14+
GP13,GPIO13
15+
GP14,GPIO14
16+
GP15,GPIO15
17+
GP16,GPIO16
18+
GP17,GPIO17
19+
GP18,GPIO18
20+
GP19,GPIO19
21+
GP20,GPIO20
22+
GP21,GPIO21
23+
GP22,GPIO22
24+
GP25,GPIO25
25+
GP26,GPIO26
26+
GP27,GPIO27
27+
GP28,GPIO28
28+
LED,GPIO25
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"deploy": [
3+
"../deploy.md"
4+
],
5+
"docs": "",
6+
"features": [
7+
"Breadboard friendly",
8+
"Castellated Pads",
9+
"Micro USB",
10+
"WiFi"
11+
],
12+
"id": "rp2-pico-w",
13+
"images": [
14+
"rp2-pico-w.jpg"
15+
],
16+
"mcu": "rp2040",
17+
"product": "Pico W",
18+
"thumbnail": "",
19+
"url": "https://www.raspberrypi.com/products/raspberry-pi-pico/",
20+
"vendor": "Raspberry Pi"
21+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include("$(PORT_DIR)/boards/manifest.py")
2+
3+
require("bundle-networking")
4+
5+
include("../manifest_picow.py")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# cmake file for Raspberry Pi Pico W
2+
set(MICROPY_PY_LWIP ON)
3+
set(MICROPY_PY_NETWORK_CYW43 ON)
4+
5+
# Board specific version of the frozen manifest
6+
set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)
7+
8+
set(MICROPY_C_HEAP_SIZE 4096)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Board and hardware specific configuration
2+
#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico W"
3+
4+
// todo: We need something to check our binary size
5+
#define MICROPY_HW_FLASH_STORAGE_BYTES (848 * 1024)
6+
7+
// Enable networking.
8+
#define MICROPY_PY_NETWORK 1
9+
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "PicoW"
10+
11+
// CYW43 driver configuration.
12+
#define CYW43_USE_SPI (1)
13+
#define CYW43_LWIP (1)
14+
#define CYW43_GPIO (1)
15+
#define CYW43_SPI_PIO (1)
16+
17+
// For debugging mbedtls - also set
18+
// Debug level (0-4) 1=warning, 2=info, 3=debug, 4=verbose
19+
// #define MODUSSL_MBEDTLS_DEBUG_LEVEL 1
20+
21+
#define MICROPY_HW_PIN_EXT_COUNT CYW43_WL_GPIO_COUNT
22+
23+
#define MICROPY_HW_PIN_RESERVED(i) ((i) == CYW43_PIN_WL_HOST_WAKE || (i) == CYW43_PIN_WL_REG_ON)

0 commit comments

Comments
 (0)