Skip to content

Commit 5a92642

Browse files
authored
Merge branch 'adafruit:main' into settings-toml-pystack
2 parents 66215f7 + bbadc00 commit 5a92642

File tree

79 files changed

+763
-405
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+763
-405
lines changed

.github/actions/deps/external/action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
name: Fetch external deps
22

33
inputs:
4+
action:
5+
required: false
6+
default: restore
7+
type: choice
8+
options:
9+
- cache
10+
- restore
11+
412
platform:
513
required: false
614
default: none
@@ -78,7 +86,7 @@ runs:
7886
if: inputs.platform != 'esp'
7987
uses: ./.github/actions/deps/python
8088
with:
81-
action: ${{ fromJSON('["restore", "cache"]')[github.job == 'scheduler'] }}
89+
action: ${{ inputs.action }}
8290
- name: Install python dependencies
8391
run: pip install -r requirements-dev.txt
8492
shell: bash

.github/actions/upload_aws/action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ runs:
2424
(github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
2525
run: >-
2626
[ -z "$AWS_ACCESS_KEY_ID" ] ||
27-
aws s3 cp ${{ inputs.source }} s3://adafruit-circuit-python/bin/${{ inputs.destination }} --recursive --no-progress --region us-east-1
27+
aws s3 cp ${{ inputs.source }} s3://adafruit-circuit-python/bin/${{ inputs.destination }}
28+
${{ endsWith(inputs.source, '/') && '--recursive' || '' }} --no-progress --region us-east-1
2829
env:
2930
AWS_PAGER: ''
3031
AWS_ACCESS_KEY_ID: ${{ inputs.AWS_ACCESS_KEY_ID }}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Custom board build
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
board:
7+
description: 'Board: Found in ports/*/boards/[board_id]'
8+
required: true
9+
type: string
10+
version:
11+
description: 'Version: Can be a tag or a commit (>=8.1.0)'
12+
required: false
13+
default: latest
14+
type: string
15+
language:
16+
description: 'Language: Found in locale/[language].po'
17+
required: false
18+
default: en_US
19+
type: string
20+
flags:
21+
description: 'Flags: Build flags (e.g. CIRCUITPY_WIFI=1)'
22+
required: false
23+
type: string
24+
debug:
25+
description: 'Make a debug build'
26+
required: false
27+
default: false
28+
type: boolean
29+
30+
run-name: ${{ inputs.board }}-${{ inputs.language }}-${{ inputs.version }}${{ inputs.flags != '' && '-custom' || '' }}${{ inputs.debug && '-debug' || '' }}
31+
32+
jobs:
33+
build:
34+
runs-on: ubuntu-22.04
35+
env:
36+
PLATFORM_atmel-samd: arm
37+
PLATFORM_broadcom: aarch
38+
PLATFORM_cxd56: arm
39+
PLATFORM_espressif: esp
40+
PLATFORM_litex: riscv
41+
PLATFORM_mimxrt10xx: arm
42+
PLATFORM_nrf: arm
43+
PLATFORM_raspberrypi: arm
44+
PLATFORM_stm: arm
45+
steps:
46+
- name: Set up repository
47+
run: |
48+
git clone --filter=tree:0 https://github.com/adafruit/circuitpython.git $GITHUB_WORKSPACE
49+
git checkout ${{ inputs.version == 'latest' && 'HEAD' || inputs.version }}
50+
- name: Set up identifier
51+
if: inputs.debug || inputs.flags != ''
52+
run: |
53+
> custom-build && git add custom-build
54+
- name: Get port
55+
id: get-port
56+
run: |
57+
PORT=$(find ports/*/boards/ -type d -name ${{ inputs.board }} | sed 's/^ports\///g;s/\/boards.*//g')
58+
if [ -z $PORT ]; then (exit 1); else echo >> $GITHUB_OUTPUT "port=$PORT"; fi
59+
- name: Port to platform
60+
run: echo >> $GITHUB_ENV "PLATFORM=${{ env[format('PLATFORM_{0}', steps.get-port.outputs.port)] }}"
61+
- name: Set up python
62+
uses: actions/setup-python@v4
63+
with:
64+
python-version: 3.x
65+
- name: Set up port
66+
if: env.PLATFORM == 'esp'
67+
uses: ./.github/actions/deps/ports/espressif
68+
- name: Set up submodules
69+
id: set-up-submodules
70+
uses: ./.github/actions/deps/submodules
71+
with:
72+
action: cache
73+
target: ${{ inputs.board }}
74+
- name: Set up external
75+
uses: ./.github/actions/deps/external
76+
with:
77+
action: cache
78+
platform: ${{ env.PLATFORM }}
79+
- name: Set up mpy-cross
80+
if: steps.set-up-submodules.outputs.frozen == 'True'
81+
uses: ./.github/actions/mpy_cross
82+
with:
83+
download: false
84+
- name: Versions
85+
run: |
86+
tools/describe
87+
gcc --version
88+
python3 --version
89+
cmake --version || true
90+
ninja --version || true
91+
aarch64-none-elf-gcc --version || true
92+
arm-none-eabi-gcc --version || true
93+
xtensa-esp32-elf-gcc --version || true
94+
riscv32-esp-elf-gcc --version || true
95+
riscv64-unknown-elf-gcc --version || true
96+
mkfs.fat --version || true
97+
- name: Build board
98+
run: make -j2 ${{ inputs.flags }} BOARD=${{ inputs.board }} DEBUG=${{ inputs.debug && '1' || '0' }} TRANSLATION=${{ inputs.language }}
99+
working-directory: ports/${{ steps.get-port.outputs.port }}
100+
- name: Upload artifact
101+
uses: actions/upload-artifact@v3
102+
with:
103+
name: ${{ inputs.board }}-${{ inputs.language }}-${{ inputs.version }}${{ inputs.flags != '' && '-custom' || '' }}${{ inputs.debug && '-debug' || '' }}
104+
path: ports/${{ steps.get-port.outputs.port }}/build-${{ inputs.board }}/firmware.*

.github/workflows/build.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ jobs:
5252
version: true
5353
- name: Set up external
5454
uses: ./.github/actions/deps/external
55+
with:
56+
action: cache
5557
# Disabled: Needs to be updated
5658
# - name: Get last commit with checks
5759
# id: get-last-commit-with-checks
@@ -200,16 +202,11 @@ jobs:
200202
with:
201203
name: docs
202204
path: _build/latex
203-
- name: Zip stubs
204-
if: >-
205-
(github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') ||
206-
(github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
207-
run: zip -9r circuitpython-stubs.zip circuitpython-stubs
208205
- name: Upload to S3
209206
uses: ./.github/actions/upload_aws
210207
with:
211208
source: circuitpython-stubs/dist/*.tar.gz
212-
destination: stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip
209+
destination: stubs/circuitpython-stubs-${{ env.CP_VERSION }}.tar.gz
213210
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
214211
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
215212
- name: Upload stubs to PyPi

README.rst

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,26 @@ Behavior
138138
- Adds a safe mode that does not run user code after a hard crash or brown out. This makes it
139139
possible to fix code that causes nasty crashes by making it available through mass storage after
140140
the crash. A reset (the button) is needed after it's fixed to get back into normal mode.
141+
- Safe mode may be handled programmatically by providing a ``safemode.py``.
142+
``safemode.py`` is run if the board has reset due to entering safe mode, unless the safe mode
143+
initiated by the user by pressing button(s).
144+
USB is not available so nothing can be printed.
145+
``safemode.py`` can determine why the safe mode occurred
146+
using ``supervisor.runtime.safe_mode_reason``, and take appropriate action. For instance,
147+
if a hard crash occurred, ``safemode.py`` may do a ``microcontroller.reset()``
148+
to automatically restart despite the crash.
149+
If the battery is low, but is being charged, ``safemode.py`` may put the board in deep sleep
150+
for a while. Or it may simply reset, and have ``code.py`` check the voltage and do the sleep.
141151
- RGB status LED indicating CircuitPython state.
142152
- One green flash - code completed without error.
143153
- Two red flashes - code ended due to an exception.
144154
- Three yellow flashes - safe mode. May be due to CircuitPython internal error.
145155
- Re-runs ``code.py`` or other main file after file system writes by a workflow. (Disable with
146156
``supervisor.disable_autoreload()``)
147157
- Autoreload is disabled while the REPL is active.
148-
- Main is one of these: ``code.txt``, ``code.py``, ``main.py``,
149-
``main.txt``
150-
- Boot is one of these: ``boot.py``, ``boot.txt``
158+
- ``code.py`` may also be named``code.txt``, ``main.py``, or ``main.txt``.
159+
- ``boot.py`` may also be named ``boot.txt``.
160+
- ``safemode.py`` may also be named ``safemode.txt``.
151161

152162
API
153163
~~~

locale/ID.po

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2441,6 +2441,10 @@ msgid ""
24412441
"You pressed the reset button during boot. Press again to exit safe mode."
24422442
msgstr ""
24432443

2444+
#: supervisor/shared/micropython.c
2445+
msgid "[truncated due to length]"
2446+
msgstr ""
2447+
24442448
#: py/objtype.c
24452449
msgid "__init__() should return None"
24462450
msgstr "__init __() harus mengembalikan None"

0 commit comments

Comments
 (0)