Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: micropython/micropython
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: adafruit/circuitpython
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing 10,328 changed files with 784,855 additions and 564,526 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
10 changes: 10 additions & 0 deletions .codespell/exclude-file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#define MICROPY_HW_BOARD_NAME "BLOK"
USB_PRODUCT = "BLOK"
uint32_t THI = (*(uint32_t *)FUSES_HOT_TEMP_VAL_INT_ADDR & FUSES_HOT_TEMP_VAL_INT_Msk) >> FUSES_HOT_TEMP_VAL_INT_Pos;
float TH = THI + convert_dec_to_frac(THD);
print(binascii.b2a_base64(b"fo"))
# again, neither will "there" or "wither", since they have "the"
i1Qb$TE"rl
ZEN = "the zen of python beautiful is better than ugly explicit is better than implicit simple is better than complex complex is better than complicated flat is better than nested sparse is better than dense readability counts special cases arent special enough to break the rules although practicality beats purity errors should never pass silently unless explicitly silenced in the face of ambiguity refuse the temptation to guess there should be one and preferably only one obvious way to do it although that way may not be obvious at first unless youre dutch now is better than never although never is often better than right now if the implementation is hard to explain its a bad idea if the implementation is easy to explain it may be a good idea namespaces are one honking great idea lets do more of those"
"arent",
"youre",
29 changes: 29 additions & 0 deletions .codespell/ignore-words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ans
ure
clen
ser
endianess
pris
synopsys
reenable
dout
inout
wel
iput
hsi
astroid
busses
cyphertext
dum
deque
deques
extint
shs
pass-thru
numer
arithmetics
ftbfs
straightaway
ftbs
ftb
curren
10 changes: 10 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# See: https://github.com/codespell-project/codespell#using-a-config-file
[codespell]
# In the event of a false positive, add the problematic word, in all lowercase, to 'ignore-words.txt' (one word per line).
# Or copy & paste the whole problematic line to 'exclude-file.txt'
ignore-words = .codespell/ignore-words.txt
exclude-file = .codespell/exclude-file.txt
check-filenames =
check-hidden =
count =
skip = .cproject,.git,./lib,./locale,ACKNOWLEDGEMENTS
46 changes: 46 additions & 0 deletions .devcontainer/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Build CircuitPython in a Github-Codespace
=========================================

To build CircuitPython within a Github codespace, you need to perform
the following steps.

1. checkout the code to a codespace

- click on the green "<> Code"-button
- select the Codespaces-tab
- choose "+ new with options..." from the "..."-menu
- in the following screen select the branch and then
- select the port instead of "Default project configuration"
(unsupported: ports not using cortex-m or esp-idf)\
![](./codespace_options.png)
- update region as necessary
- finally, click on the green "Create codespace" button

2. Your codespace is created. Cloning the image and the repo is quite fast,
but preparing it for CircuitPython-development takes about 10 minutes.
But this is a one-time task: once created, your codespace exists
until you explicitly delete it or until it times out (default: 30 days).\
(Technical note: due to a bug in codespace creation, the setup is
triggered from `$HOME/.bashrc` and runs in the background).

3. During creation, you can run the command
`tail -f /workspaces/install_build_env.log.active`
to see what is going on. Once finished the log file is available
as `/workspaces/install_build_env.log`.

4. To actually build CircuitPython, open a new terminal and run e.g.

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

This takes about 2m40s. The new terminal is necessary since the
setup of the build environment also changes `$HOME/.bashrc` and
sets important environment variables in that file.

As a normal user, you have 120 CPU-hours and 15GB per month free. Since
the smallest machine has two CPUs, you effectively have 60 hours active
time available.

All scripts are in `circuitpython/.devcontainer` and can also be executed
manually which should usually not be necessary. With small changes, they
should also work on a Linux-PC or laptop.
107 changes: 107 additions & 0 deletions .devcontainer/add_kitware_archive.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/bin/sh
# -----------------------------------------------------------------------------
# This script is from: https://apt.kitware.com/kitware-archive.sh
#
# It installs key and repo for the kitware CMAKE-archive.
#
# Author: Bernhard Bablok
#
# -----------------------------------------------------------------------------

set -eu

help() {
echo "Usage: $0 [--release <ubuntu-release>] [--rc]" > /dev/stderr
}

doing=
rc=
release=
help=
for opt in "$@"
do
case "${doing}" in
release)
release="${opt}"
doing=
;;
"")
case "${opt}" in
--rc)
rc=1
;;
--release)
doing=release
;;
--help)
help=1
;;
esac
;;
esac
done

if [ -n "${doing}" ]
then
echo "--${doing} option given no argument." > /dev/stderr
echo > /dev/stderr
help
exit 1
fi

if [ -n "${help}" ]
then
help
exit
fi

if [ -z "${release}" ]
then
unset UBUNTU_CODENAME
. /etc/os-release

if [ -z "${UBUNTU_CODENAME+x}" ]
then
echo "This is not an Ubuntu system. Aborting." > /dev/stderr
exit 1
fi

release="${UBUNTU_CODENAME}"
fi

case "${release}" in
noble|jammy|focal)
packages=
keyring_packages="ca-certificates gpg wget"
;;
*)
echo "Only Ubuntu Noble (24.04), Jammy (22.04), and Focal (20.04) are supported. Aborting." > /dev/stderr
exit 1
;;
esac

get_keyring=
if [ ! -f /usr/share/doc/kitware-archive-keyring/copyright ]
then
packages="${packages} ${keyring_packages}"
get_keyring=1
fi

# Start the real work
set -x

apt-get update
# shellcheck disable=SC2086
apt-get install -y ${packages}

test -n "${get_keyring}" && (wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - > /usr/share/keyrings/kitware-archive-keyring.gpg)

echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ${release} main" > /etc/apt/sources.list.d/kitware.list
if [ -n "${rc}" ]
then
echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ${release}-rc main" >> /etc/apt/sources.list.d/kitware.list
fi

apt-get update
test -n "${get_keyring}" && rm /usr/share/keyrings/kitware-archive-keyring.gpg
apt-get install -y kitware-archive-keyring
24 changes: 24 additions & 0 deletions .devcontainer/atmel-samd/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/universal
{
"name": "atmel-samd",
"image": "mcr.microsoft.com/devcontainers/universal:2",
"postCreateCommand": ".devcontainer/post_create.sh",
"remoteEnv": { "CP_TOOLCHAIN": "cortex-m",
"CP_PORT": "atmel-samd" }

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

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
Binary file added .devcontainer/codespace_options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions .devcontainer/common_tools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
# -----------------------------------------------------------------------------
# common_tools.sh: install tools and requirements for CircuitPython
#
# This script installs tools common to all builds.
#
# Author: Bernhard Bablok
#
# -----------------------------------------------------------------------------

REPO_ROOT="/workspaces/circuitpython"

echo -e "[common_tools.sh] starting install"
cd "$REPO_ROOT"

# --- repositories and tools ------------------------------------------------

echo -e "[common_tools.sh] adding kitware-archive (for current CMAKE)"
sudo .devcontainer/add_kitware_archive.sh
echo -e "[common_tools.sh] installing current version of CMAKE"
sudo apt-get -y install cmake

echo -e "[common_tools.sh] adding pybricks/ppa"
sudo add-apt-repository -y ppa:pybricks/ppa
echo -e "[common_tools.sh] installing uncrustify and mtools"
sudo apt-get -y install uncrustify mtools

# dosfstools >= 4.2 needed, standard repo only has 4.1
echo -e "[common_tools.sh] downloading and installing dosfstools"
wget https://github.com/dosfstools/dosfstools/releases/download/v4.2/dosfstools-4.2.tar.gz
tar -xzf dosfstools-4.2.tar.gz
(cd dosfstools-4.2/
./configure
make -j $(nproc)
sudo make install
)
rm -fr dosfstools-4.2 dosfstools-4.2.tar.gz

# --- circuitpython setup --------------------------------------------------

# additional python requirements
echo -e "[common_tools.sh] pip-installing requirements"
pip install --upgrade -r requirements-dev.txt
pip install --upgrade -r requirements-doc.txt

# add pre-commit
echo -e "[common_tools.sh] installing pre-commit"
pre-commit install
24 changes: 24 additions & 0 deletions .devcontainer/cortex-m-toolchain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# -----------------------------------------------------------------------------
# cortex-m-toolchain.sh: install toolchain for CircuitPython
#
# Author: Bernhard Bablok
#
# -----------------------------------------------------------------------------

echo -e "[cortex-m-toolchain.sh] starting install"

# --- tooling --------------------------------------------------------------

echo -e "[cortex-m-toolchain.sh] downloading and installing gcc-arm-non-eabi toolchain"
cd /workspaces

wget -qO gcc-arm-none-eabi.tar.xz \
https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz

tar -xJf gcc-arm-none-eabi.tar.xz
ln -s arm-gnu-toolchain-14.2.Rel1-x86_64-arm-none-eabi gcc-arm-none-eabi
rm -f gcc-arm-none-eabi.tar.xz

echo -e "[cortex-m-toolchain.sh] update PATH in environment"
echo -e "\nexport PATH=/workspaces/gcc-arm-none-eabi/bin:$PATH" >> $HOME/.bashrc
24 changes: 24 additions & 0 deletions .devcontainer/cxd56/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/universal
{
"name": "cxd56",
"image": "mcr.microsoft.com/devcontainers/universal:2",
"postCreateCommand": ".devcontainer/post_create.sh",
"remoteEnv": { "CP_TOOLCHAIN": "cortex-m",
"CP_PORT": "cxd56" }

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

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
42 changes: 42 additions & 0 deletions .devcontainer/esp-idf-toolchain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
# -----------------------------------------------------------------------------
# esp-idf-toolchain.sh: install toolchain for CircuitPython
#
# Author: Bernhard Bablok
#
# -----------------------------------------------------------------------------
REPO_ROOT="/workspaces/circuitpython"

echo -e "[esp-idf-toolchain.sh] starting install"

# --- tooling --------------------------------------------------------------

echo -e "[esp-idf-toolchain.sh] fetch packages"
sudo apt-get update
sudo apt-get -y install ninja-build cmake libusb-1.0-0

# --- esp-idf --------------------------------------------------------------

echo -e "[esp-idf-toolchain.sh] installing esp-idf"
cd "$REPO_ROOT/ports/espressif"
esp-idf/install.sh
source esp-idf/export.sh

# --- re-install our packages in venv created by export.sh -----------------

echo -e "[esp-idf-toolchain.sh] updating python-packages"
cd "$REPO_ROOT"
pip3 install --upgrade -r requirements-dev.txt
pip3 install --upgrade -r requirements-doc.txt

# --- and again install esp-idf (needs other versions) ----------------------

echo -e "[esp-idf-toolchain.sh] installing esp-idf (2nd iteration)"
cd "$REPO_ROOT/ports/espressif"
esp-idf/install.sh

# --- update $HOME/.bashrc --------------------------------------------------

echo -e "[esp-idf-toolchain.sh] update environment in .bashrc"

echo -e "\nsource $REPO_ROOT/ports/espressif/esp-idf/export.sh &> /dev/null\n" >> "$HOME"/.bashrc
24 changes: 24 additions & 0 deletions .devcontainer/espressif/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/universal
{
"name": "espressif",
"image": "mcr.microsoft.com/devcontainers/universal:2",
"postCreateCommand": ".devcontainer/post_create.sh",
"remoteEnv": { "CP_TOOLCHAIN": "esp-idf",
"CP_PORT": "espressif" }

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

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
Loading