11name : UF2 Generate and Release
2+
23on :
3- workflow_dispatch :
44 push :
5+ branches : [ ttdbv3 ]
6+ workflow_dispatch : # Allows manual triggering
7+
58jobs :
6- create-release :
9+ build-micropython :
710 env :
8- RPOS_UF2FILE : RPI_PICO-20241025-v1.24.0.uf2
9- TT_RUNS_SUPPORTED : " unknown tt04 tt05 tt06 tt07 tt08"
10- runs-on : ubuntu-24.04
11+ TT_RUNS_SUPPORTED : " unknown tt08"
12+ runs-on : ubuntu-latest
1113 steps :
14+ - name : Checkout MicroPython repository
15+ uses : actions/checkout@v4
16+ with :
17+ repository : micropython/micropython
18+ path : micropython
19+ submodules : recursive # Initialize submodules
1220
13- - name : checkout repo
14- uses : actions/checkout@v4
15- with :
16- submodules : recursive
17- path : sdk
18-
19- - name : Download stock MicroPython UF2
20- run : wget -O /tmp/rp2-pico.uf2 "https://micropython.org/resources/firmware/$RPOS_UF2FILE"
21-
22- - name : Set up Python
23- uses : actions/setup-python@v5
24- with :
25- python-version : ' 3.10'
26- cache : ' pip'
21+ - name : Checkout custom board definition
22+ uses : actions/checkout@v4
23+ with :
24+ repository : psychogenic/tinytapeout_rp2350b
25+ path : tt_rp2350_board
2726
28- - name : Move ucocotb
29- run : |
30- cp -r $GITHUB_WORKSPACE/sdk/microcotb/src/microcotb $GITHUB_WORKSPACE/sdk/src
31-
32- - name : Get shuttle indices
33- run : |
34- mkdir $GITHUB_WORKSPACE/sdk/src/shuttles
35- for chip in $TT_RUNS_SUPPORTED; do wget -O $GITHUB_WORKSPACE/sdk/src/shuttles/$chip.json "https://index.tinytapeout.com/$chip.json?fields=repo,address,commit,clock_hz,title,danger_level"; done
36- - name : Prepare shuttle bin files
37- run : |
38- cp -R $GITHUB_WORKSPACE/sdk/src $GITHUB_WORKSPACE/sdk/convwork
39- RUNPATH="$GITHUB_WORKSPACE/sdk/convwork:$PYTHONPATH"
40- echo "Path is $RUNPATH"
41- for chip in $TT_RUNS_SUPPORTED; do PYTHONPATH=$RUNPATH python3 $GITHUB_WORKSPACE/sdk/bin/serialize_shuttle.py $GITHUB_WORKSPACE/sdk/src/shuttles/$chip.json; done
42-
43- - name : Run PyTests
44- run : |
45- pip install pytest
46- RUNPATH="$GITHUB_WORKSPACE/sdk/convwork:$PYTHONPATH"
47- cd $GITHUB_WORKSPACE/sdk/test
48- for chip in $TT_RUNS_SUPPORTED; do PYTHONPATH=$RUNPATH pytest --shuttle $chip --shuttlepath $GITHUB_WORKSPACE/sdk/src/shuttles test_serialized_shuttle.py; done
27+ - name : Checkout SDK repository (current repo)
28+ uses : actions/checkout@v4
29+ with :
30+ path : sdk_repo
31+ submodules : recursive # Initialize submodules
32+
33+ - name : Create custom modules directories for freezing
34+ run : |
35+ mkdir -p micropython/ports/rp2/modules/ttboard
36+ mkdir -p micropython/ports/rp2/modules/microcotb
4937
50- - name : Build the final UF2
51- run : |
52- pip install uf2utils
53- touch $GITHUB_WORKSPACE/sdk/src/release_${{ github.ref_name }}
54- python -m uf2utils.examples.custom_pico --fs_root $GITHUB_WORKSPACE/sdk/src --upython /tmp/rp2-pico.uf2 --out /tmp/tt-demo-rp2040-${{ github.ref_name }}.uf2
55-
56- - name : Upload Artifact
57- uses : actions/upload-artifact@v4
58- with :
59- name : tt-demo-board-firmware
60- path : /tmp/tt-demo-rp2040-${{ github.ref_name }}.uf2
61-
62- - name : Upload Release
63- uses : ncipollo/release-action@v1
64- if : startsWith(github.ref, 'refs/tags/')
65- with :
66- artifacts : " /tmp/tt-demo-rp2040-${{ github.ref_name }}.uf2"
67- token : ${{ secrets.GITHUB_TOKEN }}
68- generateReleaseNotes : true
38+ - name : Copy SDK modules to freeze
39+ run : |
40+ cp -r sdk_repo/src/ttboard/* micropython/ports/rp2/modules/ttboard/
41+ cp -r sdk_repo/microcotb/src/microcotb/* micropython/ports/rp2/modules/microcotb/
6942
70- simulate :
71- runs-on : ubuntu-24.04
72- needs : create-release
73- steps :
74- - name : Checkout
75- uses : actions/checkout@v4
43+ - name : Copy custom board definition
44+ run : |
45+ cp -r tt_rp2350_board/ micropython/ports/rp2/boards/
7646
77- - name : Download UF2
78- uses : actions/download-artifact@v4
47+ - name : Prepare FS root
48+ working-directory : sdk_repo
49+ run : |
50+ mkdir fsroot
51+ mkdir fsroot/shuttles
52+ cp src/main.py fsroot
53+ cp src/config.ini fsroot
54+ cp -r src/examples fsroot
55+ cp -r bitstreams fsroot
56+
57+ - name : Set up Python
58+ uses : actions/setup-python@v5
7959 with :
80- name : tt-demo-board-firmware
81- path : /tmp
60+ python-version : ' 3.10'
61+ cache : ' pip'
62+
63+
64+ - name : Get shuttle indices
65+ working-directory : sdk_repo
66+ run : |
67+ for chip in $TT_RUNS_SUPPORTED; do wget -O fsroot/shuttles/$chip.json "https://index.tinytapeout.com/$chip.json?fields=repo,address,commit,clock_hz,title,danger_level"; done
68+ - name : Prepare shuttle bin files
69+ working-directory : sdk_repo
70+ run : |
71+ cp -R src convwork
72+ cp -R microcotb/src/microcotb convwork/
73+ RUNPATH="$GITHUB_WORKSPACE/sdk_repo/convwork:$PYTHONPATH"
74+ echo "Path is $RUNPATH"
75+ for chip in $TT_RUNS_SUPPORTED; do PYTHONPATH=$RUNPATH python3 $GITHUB_WORKSPACE/sdk_repo/bin/serialize_shuttle.py $GITHUB_WORKSPACE/sdk_repo/fsroot/shuttles/$chip.json; done
8276
83- - name : Copy UF2 to workspace
77+ - name : Install dependencies and toolchain
78+ run : |
79+ sudo apt update
80+ sudo apt install -y build-essential git cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib
81+ pip install uf2utils
82+ - name : Build mpy-cross compiler
83+ working-directory : ./micropython
84+ run : make -C mpy-cross
85+
86+ - name : Create custom manifest.py for freezing SDK modules
8487 run : |
85- cp /tmp/tt-demo-rp2040-${{ github.ref_name }}.uf2 $GITHUB_WORKSPACE/release.uf2
88+ cat << EOF > micropython/ports/rp2/modules/manifest.py
89+ # Custom manifest to freeze the ttboard SDK modules
90+ # Include the default port manifest first
91+ include("\$(PORT_DIR)/manifest.py")
8692
87- - name : Run a Wokwi CI server
88- uses : wokwi/wokwi-ci-server-action@v1
93+ # Freeze the ttboard package (recursively includes all .py files)
94+ package("ttboard")
95+ package("microcotb")
96+ EOF
8997
90- - name : Test with Wokwi
91- uses : wokwi/wokwi-ci-action@v1
98+ - name : Build firmware for custom board
99+ working-directory : ./micropython/ports/rp2
100+ run : |
101+ make clean
102+ make submodules
103+ make -j$(nproc) BOARD=tt_rp2350_board
104+
105+
106+ - name : Build the final UF2
107+ run : |
108+ touch sdk_repo/fsroot/release_${{ github.ref_name }}
109+ python -m uf2utils.examples.custom_pico --family rp2350-arm-s --block_count 512 --fs_offset 0x10200000 --fs_root sdk_repo/fsroot --upython micropython/ports/rp2/build-tt_rp2350_board/firmware.uf2 --out /tmp/tt-demo-rp2350-${{ github.ref_name }}.uf2
110+
111+ - name : Upload UF2 artifact
112+ uses : actions/upload-artifact@v4
113+ with :
114+ name : tt-demo-rp2350-${{ github.ref_name }}.uf2
115+ path : /tmp/tt-demo-rp2350-${{ github.ref_name }}.uf2
116+
117+ - name : Upload Release
118+ uses : ncipollo/release-action@v1
119+ if : startsWith(github.ref, 'refs/tags/')
92120 with :
93- token : ${{ secrets.WOKWI_CLI_TOKEN }}
94- path : /
95- expect_text : ' boot done: '
121+ artifacts : " /tmp/tt-demo-rp2350- ${{ github.ref_name }}.uf2 "
122+ token : ${{ secrets.GITHUB_TOKEN }}
123+ generateReleaseNotes : true
0 commit comments