Skip to content

Commit 76aea3d

Browse files
author
ure
committed
Merge branch 'rfguru' of github.com:Guru-RF/circuitpython into rfguru
2 parents 21fba25 + 751fbf0 commit 76aea3d

File tree

493 files changed

+2590
-2008
lines changed

Some content is hidden

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

493 files changed

+2590
-2008
lines changed

.devcontainer/Readme.md

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,46 @@
1-
Build CircuitPython in a Github-Devcontainer
2-
============================================
1+
Build CircuitPython in a Github-Codespace
2+
=========================================
33

4-
To build CircuitPython within a Github-Devcontainer, you need to perform
4+
To build CircuitPython within a Github codespace, you need to perform
55
the following steps.
66

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.
7+
1. checkout the code to a codespace
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 the port instead of "Default project configuration"
14+
(unsupported: ports not using cortex-m or esp-idf)\
15+
![](./codespace_options.png)
16+
- update region as necessary
17+
- finally, click on the green "Create codespace" button
18+
19+
2. Your codespace is created. Cloning the image and the repo is quite fast,
20+
but preparing it for CircuitPython-development takes about 10 minutes.
21+
But this is a one-time task: once created, your codespace exists
22+
until you explicitly delete it or until it times out (default: 30 days).\
23+
(Technical note: due to a bug in codespace creation, the setup is
24+
triggered from `$HOME/.bashrc` and runs in the background).
2125

2226
3. During creation, you can run the command
23-
`tail -f /workspaces/.codespaces/.persistedshare/creation.log`
24-
to see what is going on.
27+
`tail -f /workspaces/install_build_env.log.active`
28+
to see what is going on. Once finished the log file is available
29+
as `/workspaces/install_build_env.log`.
2530

26-
4. To actually build CircuitPython, run
31+
4. To actually build CircuitPython, open a new terminal and run e.g.
2732

2833
cd ports/raspberrypi
2934
make -j $(nproc) BOARD=whatever TRANSLATION=xx_XX
3035

31-
This takes about 2m40s.
36+
This takes about 2m40s. The new terminal is necessary since the
37+
setup of the build environment also changes `$HOME/.bashrc` and
38+
sets important environment variables in that file.
39+
40+
As a normal user, you have 120 CPU-hours and 15GB per month free. Since
41+
the smallest machine has two CPUs, you effectively have 60 hours active
42+
time available.
43+
44+
All scripts are in `circuitpython/.devcontainer` and can also be executed
45+
manually which should usually not be necessary. With small changes, they
46+
should also work on a Linux-PC or laptop.

.devcontainer/cortex-m/devcontainer.json renamed to .devcontainer/atmel-samd/devcontainer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
22
// README at: https://github.com/devcontainers/templates/tree/main/src/universal
33
{
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}" }
4+
"name": "atmel-samd",
5+
"image": "mcr.microsoft.com/devcontainers/universal:2",
6+
"postCreateCommand": ".devcontainer/post_create.sh",
7+
"remoteEnv": { "CP_TOOLCHAIN": "cortex-m",
8+
"CP_PORT": "atmel-samd" }
89

910
// Features to add to the dev container. More info: https://containers.dev/features.
1011
// "features": {},

.devcontainer/codespace_options.png

76.2 KB
Loading

.devcontainer/common_tools.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
# -----------------------------------------------------------------------------
3+
# common_tools.sh: install tools and requirements for CircuitPython
4+
#
5+
# This script installs tools common to all builds.
6+
#
7+
# Author: Bernhard Bablok
8+
#
9+
# -----------------------------------------------------------------------------
10+
11+
REPO_ROOT="/workspaces/circuitpython"
12+
13+
echo -e "[common_tools.sh] starting install"
14+
cd "$REPO_ROOT"
15+
16+
# --- repositories and tools ------------------------------------------------
17+
18+
echo -e "[common_tools.sh] adding pybricks/ppa"
19+
sudo add-apt-repository -y ppa:pybricks/ppa
20+
echo -e "[common_tools.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 "[common_tools.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+
)
32+
rm -fr dosfstools-4.2 dosfstools-4.2.tar.gz
33+
34+
# --- circuitpython setup --------------------------------------------------
35+
36+
# additional python requirements
37+
echo -e "[common_tools.sh] pip-installing requirements"
38+
pip install --upgrade -r requirements-dev.txt
39+
pip install --upgrade -r requirements-doc.txt
40+
41+
# add pre-commit
42+
echo -e "[common_tools.sh] installing pre-commit"
43+
pre-commit install

.devcontainer/cortex-m-toolchain.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# -----------------------------------------------------------------------------
3+
# cortex-m-toolchain.sh: install toolchain for CircuitPython
4+
#
5+
# Author: Bernhard Bablok
6+
#
7+
# -----------------------------------------------------------------------------
8+
9+
echo -e "[cortex-m-toolchain.sh] starting install"
10+
11+
# --- tooling --------------------------------------------------------------
12+
13+
echo -e "[cortex-m-toolchain.sh] downloading and installing gcc-arm-non-eabi toolchain"
14+
cd /workspaces
15+
16+
wget -qO gcc-arm-none-eabi.tar.xz \
17+
https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz
18+
19+
tar -xJf gcc-arm-none-eabi.tar.xz
20+
ln -s arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi gcc-arm-none-eabi
21+
rm -f gcc-arm-none-eabi.tar.xz
22+
23+
echo -e "[cortex-m-toolchain.sh] update PATH in environment"
24+
echo -e "\nexport PATH=/workspaces/gcc-arm-none-eabi/bin:$PATH" >> $HOME/.bashrc

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

Lines changed: 0 additions & 59 deletions
This file was deleted.

.devcontainer/cxd56/devcontainer.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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": "cxd56",
5+
"image": "mcr.microsoft.com/devcontainers/universal:2",
6+
"postCreateCommand": ".devcontainer/post_create.sh",
7+
"remoteEnv": { "CP_TOOLCHAIN": "cortex-m",
8+
"CP_PORT": "cxd56" }
9+
10+
// Features to add to the dev container. More info: https://containers.dev/features.
11+
// "features": {},
12+
13+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
14+
// "forwardPorts": [],
15+
16+
// Use 'postCreateCommand' to run commands after the container is created.
17+
// "postCreateCommand": "uname -a",
18+
19+
// Configure tool-specific properties.
20+
// "customizations": {},
21+
22+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
23+
// "remoteUser": "root"
24+
}

.devcontainer/esp-idf-toolchain.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
# -----------------------------------------------------------------------------
3+
# esp-idf-toolchain.sh: install toolchain for CircuitPython
4+
#
5+
# Author: Bernhard Bablok
6+
#
7+
# -----------------------------------------------------------------------------
8+
REPO_ROOT="/workspaces/circuitpython"
9+
10+
echo -e "[esp-idf-toolchain.sh] starting install"
11+
12+
# --- tooling --------------------------------------------------------------
13+
14+
echo -e "[esp-idf-toolchain.sh] fetch packages"
15+
sudo apt-get update
16+
sudo apt-get -y install ninja-build cmake libusb-1.0-0
17+
18+
# --- esp-idf --------------------------------------------------------------
19+
20+
echo -e "[esp-idf-toolchain.sh] installing esp-idf"
21+
cd "$REPO_ROOT/ports/espressif"
22+
esp-idf/install.sh
23+
source esp-idf/export.sh
24+
25+
# --- re-install our packages in venv created by export.sh -----------------
26+
27+
echo -e "[esp-idf-toolchain.sh] updating python-packages"
28+
cd "$REPO_ROOT"
29+
pip3 install --upgrade -r requirements-dev.txt
30+
pip3 install --upgrade -r requirements-doc.txt
31+
32+
# --- and again install esp-idf (needs other versions) ----------------------
33+
34+
echo -e "[esp-idf-toolchain.sh] installing esp-idf (2nd iteration)"
35+
cd "$REPO_ROOT/ports/espressif"
36+
esp-idf/install.sh
37+
38+
# --- update $HOME/.bashrc --------------------------------------------------
39+
40+
echo -e "[esp-idf-toolchain.sh] update environment in .bashrc"
41+
42+
echo -e "\nsource $REPO_ROOT/ports/espressif/esp-idf/export.sh &> /dev/null\n" >> "$HOME"/.bashrc
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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": "espressif",
5+
"image": "mcr.microsoft.com/devcontainers/universal:2",
6+
"postCreateCommand": ".devcontainer/post_create.sh",
7+
"remoteEnv": { "CP_TOOLCHAIN": "esp-idf",
8+
"CP_PORT": "espressif" }
9+
10+
// Features to add to the dev container. More info: https://containers.dev/features.
11+
// "features": {},
12+
13+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
14+
// "forwardPorts": [],
15+
16+
// Use 'postCreateCommand' to run commands after the container is created.
17+
// "postCreateCommand": "uname -a",
18+
19+
// Configure tool-specific properties.
20+
// "customizations": {},
21+
22+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
23+
// "remoteUser": "root"
24+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
# -----------------------------------------------------------------------------
3+
# fetch-port-submodules.sh: fetch port specific submodules
4+
#
5+
# Author: Bernhard Bablok
6+
#
7+
# -----------------------------------------------------------------------------
8+
9+
REPO_ROOT="/workspaces/circuitpython"
10+
cd "$REPO_ROOT"
11+
12+
if [ -z "$CP_PORT" ]; then
13+
echo -e "[fetch-port-submodules.sh] CP_PORT not set. Cannot fetch submodules!"
14+
exit 3
15+
fi
16+
17+
cd "ports/$CP_PORT"
18+
echo -e "[fetch-port-submodules.sh] fetching necessary submodules"
19+
make fetch-port-submodules

0 commit comments

Comments
 (0)