Skip to content

Commit 21857ed

Browse files
authored
Merge pull request #4 from adafruit/main
Pull in the latest main branch from adafruit
2 parents f2bbe5a + 353411a commit 21857ed

File tree

1,814 files changed

+54300
-20772
lines changed

Some content is hidden

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

1,814 files changed

+54300
-20772
lines changed

.devcontainer/Readme.md

+31
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.
+23
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

+59
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

+1-1
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
+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
port:
13+
required: false
14+
default: none
15+
type: string
16+
17+
runs:
18+
using: composite
19+
steps:
20+
# arm
21+
- name: Get arm toolchain
22+
if: >-
23+
inputs.port != 'none' &&
24+
inputs.port != 'litex' &&
25+
inputs.port != 'espressif'
26+
uses: carlosperate/arm-none-eabi-gcc-action@v1
27+
with:
28+
release: '10-2020-q4'
29+
30+
# espressif
31+
- name: Get espressif toolchain
32+
if: inputs.port == 'espressif'
33+
run: sudo apt-get install -y ninja-build
34+
shell: bash
35+
- name: Install IDF tools
36+
if: inputs.port == 'espressif'
37+
run: |
38+
echo "Installing ESP-IDF tools"
39+
$IDF_PATH/tools/idf_tools.py --non-interactive install required
40+
$IDF_PATH/tools/idf_tools.py --non-interactive install cmake
41+
echo "Installing Python environment and packages"
42+
$IDF_PATH/tools/idf_tools.py --non-interactive install-python-env
43+
rm -rf $IDF_TOOLS_PATH/dist
44+
shell: bash
45+
- name: Set environment
46+
if: inputs.port == 'espressif'
47+
run: |
48+
source $IDF_PATH/export.sh
49+
echo >> $GITHUB_ENV "IDF_PYTHON_ENV_PATH=$IDF_PYTHON_ENV_PATH"
50+
echo >> $GITHUB_PATH "$PATH"
51+
shell: bash
52+
53+
# common
54+
- name: Cache python dependencies
55+
if: inputs.port != 'espressif'
56+
uses: ./.github/actions/deps/python
57+
with:
58+
action: ${{ inputs.action }}
59+
- name: Install python dependencies
60+
run: pip install -r requirements-dev.txt
61+
shell: bash

.github/actions/deps/ports/action.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Fetch port deps
2+
3+
inputs:
4+
board:
5+
required: true
6+
type: string
7+
8+
outputs:
9+
port:
10+
value: ${{ steps.board-to-port.outputs.port }}
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Board to port
16+
id: board-to-port
17+
run: |
18+
PORT=$(find ports/*/boards/ -type d -name ${{ inputs.board }} | sed 's/^ports\///g;s/\/boards.*//g')
19+
if [ -z $PORT ]; then (exit 1); else echo >> $GITHUB_OUTPUT "port=$PORT"; fi
20+
shell: bash
21+
22+
- name: Set up broadcom
23+
if: steps.board-to-port.outputs.port == 'broadcom'
24+
uses: ./.github/actions/deps/ports/broadcom
25+
26+
- name: Set up espressif
27+
if: steps.board-to-port.outputs.port == 'espressif'
28+
uses: ./.github/actions/deps/ports/espressif
29+
30+
- name: Set up litex
31+
if: steps.board-to-port.outputs.port == 'litex'
32+
uses: ./.github/actions/deps/ports/litex
33+
34+
- name: Set up nrf
35+
if: steps.board-to-port.outputs.port == 'nrf'
36+
uses: ./.github/actions/deps/ports/nrf
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Fetch broadcom port deps
2+
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Get broadcom toolchain
7+
run: |
8+
wget --no-verbose https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
9+
sudo tar -C /usr --strip-components=1 -xaf gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
10+
sudo apt-get install -y mtools
11+
shell: bash
12+
- name: Install mkfs.fat
13+
run: |
14+
wget https://github.com/dosfstools/dosfstools/releases/download/v4.2/dosfstools-4.2.tar.gz
15+
tar -xaf dosfstools-4.2.tar.gz
16+
cd dosfstools-4.2
17+
./configure
18+
make -j 2
19+
cd src
20+
echo >> $GITHUB_PATH $(pwd)
21+
shell: bash
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Fetch litex port deps
2+
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Get litex toolchain
7+
run: |
8+
wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz
9+
sudo tar -C /usr --strip-components=1 -xaf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz
10+
shell: bash
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Fetch nrf port deps
2+
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Get nrfutil 7+
7+
run: |
8+
wget https://developer.nordicsemi.com/.pc-tools/nrfutil/x64-linux/nrfutil
9+
chmod +x nrfutil
10+
./nrfutil install nrf5sdk-tools
11+
mkdir -p $HOME/.local/bin
12+
mv nrfutil $HOME/.local/bin
13+
echo "$HOME/.local/bin" >> $GITHUB_PATH
14+
shell: bash
15+
- name: Print nrfutil version
16+
run: nrfutil -V
17+
shell: bash
+42
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

0 commit comments

Comments
 (0)