Skip to content

Commit de5f58a

Browse files
authored
Merge branch 'main' into banglejs2
2 parents 931c7c1 + a8b34bd commit de5f58a

File tree

102 files changed

+5608
-2136
lines changed

Some content is hidden

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

102 files changed

+5608
-2136
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ body:
66
- type: markdown
77
attributes:
88
value: >-
9-
Thanks! for testing out CircuitPython. Now that you have encountered a
9+
Thanks for testing out CircuitPython! Now that you have encountered a
1010
bug... you can file a report for it.
1111
- type: textarea
1212
id: firmware

.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
@@ -94,7 +102,7 @@ runs:
94102
if: inputs.platform != 'esp'
95103
uses: ./.github/actions/deps/python
96104
with:
97-
action: ${{ fromJSON('["restore", "cache"]')[github.job == 'scheduler'] }}
105+
action: ${{ inputs.action }}
98106
- name: Install python dependencies
99107
run: pip install -r requirements-dev.txt
100108
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
@@ -53,6 +53,8 @@ jobs:
5353
version: true
5454
- name: Set up external
5555
uses: ./.github/actions/deps/external
56+
with:
57+
action: cache
5658
# Disabled: Needs to be updated
5759
# - name: Get last commit with checks
5860
# id: get-last-commit-with-checks
@@ -201,16 +203,11 @@ jobs:
201203
with:
202204
name: docs
203205
path: _build/latex
204-
- name: Zip stubs
205-
if: >-
206-
(github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') ||
207-
(github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
208-
run: zip -9r circuitpython-stubs.zip circuitpython-stubs
209206
- name: Upload to S3
210207
uses: ./.github/actions/upload_aws
211208
with:
212209
source: circuitpython-stubs/dist/*.tar.gz
213-
destination: stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip
210+
destination: stubs/circuitpython-stubs-${{ env.CP_VERSION }}.tar.gz
214211
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
215212
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
216213
- name: Upload stubs to PyPi

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,11 @@ clean-nrf:
323323
clean-stm:
324324
$(MAKE) -C ports/stm BOARD=feather_stm32f405_express clean
325325

326+
327+
# This update will fail because the commits we need aren't the latest on the
328+
# branch. We can ignore that though because we fix it with the second command.
329+
# (Only works for git servers that allow sha fetches.)
326330
.PHONY: fetch-submodules
327331
fetch-submodules:
328-
# This update will fail because the commits we need aren't the latest on the
329-
# branch. We can ignore that though because we fix it with the second command.
330-
# (Only works for git servers that allow sha fetches.)
331332
git submodule update --init -N --depth 1 || true
332333
git submodule foreach 'git fetch --tags --depth 1 origin $$sha1 && git checkout -q $$sha1'

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
~~~

0 commit comments

Comments
 (0)