Skip to content

Commit 3feaf6a

Browse files
authored
Merge branch 'adafruit:main' into main
2 parents 1fe7d29 + 9c0165f commit 3feaf6a

File tree

690 files changed

+18886
-10530
lines changed

Some content is hidden

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

690 files changed

+18886
-10530
lines changed

.devcontainer/Readme.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Build CircuitPython in a Github-Devcontainer
2+
============================================
3+
4+
To build CircuitPython within a Github-Devcontainer, you need to perform
5+
the following steps.
6+
7+
1. checkout the code to a devcontainer
8+
9+
- click on the green "<> Code"-button
10+
- select the Codespaces-tab
11+
- choose "+ new with options..." from the "..."-menu
12+
- in the following screen select the branch and then
13+
- select ".devcontainer/cortex-m/devcontainer.json" instead
14+
of "Default Codespaces configuration"
15+
- update region as necessary
16+
- finally, click on the green "Create codespace" button
17+
18+
2. Your codespace is created. Cloning the images is quite fast, but
19+
preparing it for CircuitPython-development takes about 10 minutes.
20+
Note that this is a one-time task.
21+
22+
3. During creation, you can run the command
23+
`tail -f /workspaces/.codespaces/.persistedshare/creation.log`
24+
to see what is going on.
25+
26+
4. To actually build CircuitPython, run
27+
28+
cd ports/raspberrypi
29+
make -j $(nproc) BOARD=whatever TRANSLATION=xx_XX
30+
31+
This takes about 2m40s.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/universal
3+
{
4+
"name": "CircuitPython Cortex-M Build-Environment (base: Default Linux Universal)",
5+
"image": "mcr.microsoft.com/devcontainers/universal:2-linux",
6+
"postCreateCommand": ".devcontainer/cortex-m/on-create.sh",
7+
"remoteEnv": { "PATH": "/workspaces/gcc-arm-none-eabi/bin:${containerEnv:PATH}" }
8+
9+
// Features to add to the dev container. More info: https://containers.dev/features.
10+
// "features": {},
11+
12+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
13+
// "forwardPorts": [],
14+
15+
// Use 'postCreateCommand' to run commands after the container is created.
16+
// "postCreateCommand": "uname -a",
17+
18+
// Configure tool-specific properties.
19+
// "customizations": {},
20+
21+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
22+
// "remoteUser": "root"
23+
}

.devcontainer/cortex-m/on-create.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
# -----------------------------------------------------------------------------
3+
# on-create.sh: postCreateCommand-hook for devcontainer.json (Cortex-M build)
4+
#
5+
# Author: Bernhard Bablok
6+
#
7+
# -----------------------------------------------------------------------------
8+
9+
echo -e "[on-create.sh] downloading and installing gcc-arm-non-eabi toolchain"
10+
cd /workspaces
11+
wget -qO gcc-arm-none-eabi.tar.bz2 https://adafru.it/Pid
12+
tar -xjf gcc-arm-none-eabi.tar.bz2
13+
ln -s gcc-arm-none-eabi-10-2020-q4-major gcc-arm-none-eabi
14+
rm -f /workspaces/gcc-arm-none-eabi.tar.bz2
15+
export PATH=/workspaces/gcc-arm-none-eabi/bin:$PATH
16+
17+
# add repository and install tools
18+
echo -e "[on-create.sh] adding pybricks/ppa"
19+
sudo add-apt-repository -y ppa:pybricks/ppa
20+
echo -e "[on-create.sh] installing uncrustify and mtools"
21+
sudo apt-get -y install uncrustify mtools
22+
23+
# dosfstools >= 4.2 needed, standard repo only has 4.1
24+
echo -e "[on-create.sh] downloading and installing dosfstools"
25+
wget https://github.com/dosfstools/dosfstools/releases/download/v4.2/dosfstools-4.2.tar.gz
26+
tar -xzf dosfstools-4.2.tar.gz
27+
cd dosfstools-4.2/
28+
./configure
29+
make -j $(nproc)
30+
sudo make install
31+
cd /workspaces
32+
rm -fr /workspaces/dosfstools-4.2 /workspaces/dosfstools-4.2.tar.gz
33+
34+
# prepare source-code tree
35+
cd /workspaces/circuitpython/
36+
echo -e "[on-create.sh] fetching submodules"
37+
make fetch-submodules
38+
echo -e "[on-create.sh] fetching tags"
39+
git fetch --tags --recurse-submodules=no --shallow-since="2021-07-01" https://github.com/adafruit/circuitpython HEAD
40+
41+
# additional python requirements
42+
echo -e "[on-create.sh] pip-installing requirements"
43+
pip install --upgrade -r requirements-dev.txt
44+
pip install --upgrade -r requirements-doc.txt
45+
46+
# add pre-commit
47+
echo -e "[on-create.sh] installing pre-commit"
48+
pre-commit install
49+
50+
# create cross-compiler
51+
echo -e "[on-create.sh] building mpy-cross"
52+
make -j $(nproc) -C mpy-cross # time: about 36 sec
53+
54+
# that's it!
55+
echo -e "[on-create.sh] setup complete"
56+
57+
#commands to actually build CP:
58+
#cd ports/raspberrypi
59+
#time make -j $(nproc) BOARD=pimoroni_tufty2040 TRANSLATION=de_DE

.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
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Fetch external deps
2+
3+
inputs:
4+
action:
5+
required: false
6+
default: restore
7+
type: choice
8+
options:
9+
- cache
10+
- restore
11+
12+
platform:
13+
required: false
14+
default: none
15+
type: choice
16+
options:
17+
- arm
18+
- aarch
19+
- esp
20+
- riscv
21+
- none
22+
23+
runs:
24+
using: composite
25+
steps:
26+
# aarch
27+
- name: Get aarch toolchain
28+
if: inputs.platform == 'aarch'
29+
run: |
30+
wget --no-verbose https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
31+
sudo tar -C /usr --strip-components=1 -xaf gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
32+
sudo apt-get install -y mtools
33+
shell: bash
34+
- name: Install mkfs.fat
35+
if: inputs.platform == 'aarch'
36+
run: |
37+
wget https://github.com/dosfstools/dosfstools/releases/download/v4.2/dosfstools-4.2.tar.gz
38+
tar -xaf dosfstools-4.2.tar.gz
39+
cd dosfstools-4.2
40+
./configure
41+
make -j 2
42+
cd src
43+
echo >> $GITHUB_PATH $(pwd)
44+
shell: bash
45+
46+
# arm
47+
- name: Get arm toolchain
48+
if: inputs.platform == 'aarch' || inputs.platform == 'arm'
49+
uses: carlosperate/arm-none-eabi-gcc-action@v1
50+
with:
51+
release: '10-2020-q4'
52+
53+
# esp
54+
- name: Get esp toolchain
55+
if: inputs.platform == 'esp'
56+
run: sudo apt-get install -y ninja-build
57+
shell: bash
58+
- name: Install IDF tools
59+
if: inputs.platform == 'esp'
60+
run: |
61+
echo "Installing ESP-IDF tools"
62+
$IDF_PATH/tools/idf_tools.py --non-interactive install required
63+
$IDF_PATH/tools/idf_tools.py --non-interactive install cmake
64+
echo "Installing Python environment and packages"
65+
$IDF_PATH/tools/idf_tools.py --non-interactive install-python-env
66+
rm -rf $IDF_TOOLS_PATH/dist
67+
shell: bash
68+
- name: Set environment
69+
if: inputs.platform == 'esp'
70+
run: |
71+
source $IDF_PATH/export.sh
72+
echo >> $GITHUB_ENV "IDF_PYTHON_ENV_PATH=$IDF_PYTHON_ENV_PATH"
73+
echo >> $GITHUB_PATH "$PATH"
74+
shell: bash
75+
76+
# riscv
77+
- name: Get riscv toolchain
78+
if: inputs.platform == 'riscv'
79+
run: |
80+
wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz
81+
sudo tar -C /usr --strip-components=1 -xaf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz
82+
shell: bash
83+
84+
# common
85+
- name: Cache python dependencies
86+
if: inputs.platform != 'esp'
87+
uses: ./.github/actions/deps/python
88+
with:
89+
action: ${{ inputs.action }}
90+
- name: Install python dependencies
91+
run: pip install -r requirements-dev.txt
92+
shell: bash
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Fetch espressif port deps
2+
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Set IDF env
7+
run: |
8+
echo >> $GITHUB_ENV "IDF_PATH=$GITHUB_WORKSPACE/ports/espressif/esp-idf"
9+
echo >> $GITHUB_ENV "IDF_TOOLS_PATH=$GITHUB_WORKSPACE/.idf_tools"
10+
shell: bash
11+
12+
- name: Get IDF commit
13+
id: idf-commit
14+
run: |
15+
COMMIT=$(git submodule status ports/espressif/esp-idf | grep -o -P '(?<=^-).*(?= )')
16+
echo "$COMMIT"
17+
echo "commit=$COMMIT" >> $GITHUB_OUTPUT
18+
shell: bash
19+
20+
- name: Cache IDF submodules
21+
uses: actions/cache@v3
22+
with:
23+
path: |
24+
.git/modules/ports/espressif/esp-idf
25+
ports/espressif/esp-idf
26+
key: submodules-idf-${{ steps.idf-commit.outputs.commit }}
27+
28+
- name: Cache IDF tools
29+
uses: actions/cache@v3
30+
with:
31+
path: ${{ env.IDF_TOOLS_PATH }}
32+
key: ${{ runner.os }}-${{ env.pythonLocation }}-tools-idf-${{ steps.idf-commit.outputs.commit }}
33+
34+
- name: Initialize IDF submodules
35+
run: git submodule update --init --depth=1 --recursive $IDF_PATH
36+
shell: bash
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Fetch python deps
2+
3+
inputs:
4+
action:
5+
description: The cache action to use
6+
required: false
7+
default: restore
8+
type: choice
9+
options:
10+
- cache
11+
- restore
12+
13+
runs:
14+
using: composite
15+
steps:
16+
- name: Cache python dependencies
17+
id: cache-python-deps
18+
if: inputs.action == 'cache'
19+
uses: actions/cache@v3
20+
with:
21+
path: .cp_tools
22+
key: ${{ runner.os }}-${{ env.pythonLocation }}-tools-cp-${{ hashFiles('requirements-dev.txt') }}
23+
24+
- name: Restore python dependencies
25+
id: restore-python-deps
26+
if: inputs.action == 'restore'
27+
uses: actions/cache/restore@v3
28+
with:
29+
path: .cp_tools
30+
key: ${{ runner.os }}-${{ env.pythonLocation }}-tools-cp-${{ hashFiles('requirements-dev.txt') }}
31+
32+
- name: Set up venv
33+
if: inputs.action == 'cache' && !steps.cache-python-deps.outputs.cache-hit
34+
run: python -m venv .cp_tools
35+
shell: bash
36+
37+
- name: Activate venv
38+
if: inputs.action == 'cache' || (inputs.action == 'restore' && steps.restore-python-deps.outputs.cache-hit)
39+
run: |
40+
source .cp_tools/bin/activate
41+
echo >> $GITHUB_PATH "$PATH"
42+
shell: bash
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: 'Fetch Submodules'
2+
3+
inputs:
4+
target:
5+
description: 'The target for ci_fetch_deps'
6+
required: false
7+
type: string
8+
9+
submodules:
10+
description: 'The submodules to cache'
11+
required: false
12+
default: '["extmod/ulab", "lib/", "tools/"]'
13+
type: string
14+
15+
action:
16+
description: 'The cache action to use'
17+
required: false
18+
default: 'restore'
19+
type: choice
20+
options:
21+
- cache
22+
- restore
23+
24+
version:
25+
description: 'Whether to generate CP version'
26+
required: false
27+
default: false
28+
type: boolean
29+
30+
outputs:
31+
frozen:
32+
description: 'Whether frozen submodules were fetched'
33+
value: ${{ steps.cp-deps.outputs.frozen_tags }}
34+
35+
version:
36+
description: 'The CP version'
37+
value: ${{ steps.cp-version.outputs.cp-version }}
38+
39+
runs:
40+
using: "composite"
41+
steps:
42+
- name: Create submodule status
43+
id: create-submodule-status
44+
run: |
45+
git submodule status ${{ join(fromJSON(inputs.submodules), ' ') }} >> submodule_status
46+
echo $(cut -d ' ' -f 2 submodule_status) | echo "submodules=[\"$(sed "s/ /\", \"/g")\"]" >> $GITHUB_OUTPUT
47+
shell: bash
48+
49+
- name: Cache submodules
50+
if: ${{ inputs.action == 'cache' }}
51+
uses: actions/cache@v3
52+
with:
53+
path: ".git/modules/\n${{ join(fromJSON(steps.create-submodule-status.outputs.submodules), '\n') }}"
54+
key: submodules-common-${{ hashFiles('submodule_status') }}
55+
enableCrossOsArchive: true
56+
57+
- name: Restore submodules
58+
if: ${{ inputs.action == 'restore' }}
59+
uses: actions/cache/restore@v3
60+
with:
61+
path: ".git/modules/\n${{ join(fromJSON(steps.create-submodule-status.outputs.submodules), '\n') }}"
62+
key: submodules-common-${{ hashFiles('submodule_status') }}
63+
enableCrossOsArchive: true
64+
65+
- name: Remove submodule status
66+
run: rm submodule_status
67+
shell: bash
68+
69+
- name: CircuitPython dependencies
70+
id: cp-deps
71+
run: python tools/ci_fetch_deps.py ${{ inputs.target || matrix.board || github.job }}
72+
shell: bash
73+
74+
- name: CircuitPython version
75+
id: cp-version
76+
if: ${{ inputs.version == 'true' }}
77+
run: |
78+
echo "::group::Fetch history and tags"
79+
git fetch --no-recurse-submodules --shallow-since="2021-07-01" --tags https://github.com/adafruit/circuitpython HEAD
80+
git fetch --no-recurse-submodules --shallow-since="2021-07-01" origin $GITHUB_SHA
81+
git repack -d
82+
echo "::endgroup::"
83+
CP_VERSION=$(tools/describe)
84+
echo "$CP_VERSION"
85+
echo "CP_VERSION=$CP_VERSION" >> $GITHUB_ENV
86+
echo "cp-version=$CP_VERSION" >> $GITHUB_OUTPUT
87+
shell: bash

0 commit comments

Comments
 (0)