Skip to content

Commit 463c8d0

Browse files
authored
Merge pull request #2 from adafruit/main
Merge main
2 parents 992e97d + 4cc7466 commit 463c8d0

File tree

464 files changed

+14234
-8069
lines changed

Some content is hidden

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

464 files changed

+14234
-8069
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/workflows/build.yml

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- uses: actions/checkout@v3
3434
with:
3535
submodules: false
36-
fetch-depth: 1
36+
fetch-depth: 0
3737
- name: Set up Python 3
3838
uses: actions/setup-python@v4
3939
with:
@@ -125,20 +125,30 @@ jobs:
125125
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1
126126
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1
127127
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1
128-
- name: "Get changes"
128+
- name: Get last commit with checks
129+
id: get-last-commit-with-checks
130+
if: github.event_name == 'pull_request'
131+
working-directory: tools
132+
env:
133+
REPO: ${{ github.repository }}
134+
PULL: ${{ github.event.number }}
135+
GITHUB_TOKEN: ${{ github.token }}
136+
EXCLUDE_COMMIT: ${{ github.event.after }}
137+
run: python3 -u ci_changes_per_commit.py
138+
- name: Get changes
139+
id: get-changes
129140
if: github.event_name == 'pull_request'
130-
uses: dorny/paths-filter@v2
131-
id: filter
132-
with:
133-
list-files: json
134-
filters: |
135-
changed:
136-
- '**'
137-
- name: "Set matrix"
141+
uses: tj-actions/[email protected]
142+
with:
143+
json: true
144+
sha: ${{ steps.get-last-commit-with-checks.outputs.commit && github.event.after }}
145+
base_sha: ${{ steps.get-last-commit-with-checks.outputs.commit }}
146+
- name: Set matrix
138147
id: set-matrix
139148
working-directory: tools
140149
env:
141-
CHANGED_FILES: ${{ steps.filter.outputs.changed_files }}
150+
CHANGED_FILES: ${{ steps.get-changes.outputs.all_changed_and_modified_files }}
151+
LAST_FAILED_JOBS: ${{ steps.get-last-commit-with-checks.outputs.checkruns }}
142152
run: python3 -u ci_set_matrix.py
143153

144154

@@ -156,7 +166,7 @@ jobs:
156166
- name: Set up Python 3
157167
uses: actions/setup-python@v4
158168
with:
159-
python-version: "3.x"
169+
python-version: "3.10"
160170
- name: Get CP deps
161171
run: python tools/ci_fetch_deps.py mpy-cross-mac ${{ github.sha }}
162172
- name: CircuitPython version
@@ -220,7 +230,7 @@ jobs:
220230
- name: Set up Python 3
221231
uses: actions/setup-python@v4
222232
with:
223-
python-version: "3.x"
233+
python-version: "3.10"
224234
- name: Install dependencies
225235
run: |
226236
sudo apt-get update
@@ -278,7 +288,7 @@ jobs:
278288
- name: Set up Python 3
279289
uses: actions/setup-python@v4
280290
with:
281-
python-version: "3.x"
291+
python-version: "3.10"
282292
- uses: actions/checkout@v3
283293
with:
284294
submodules: false
@@ -331,7 +341,7 @@ jobs:
331341
- name: Set up Python 3
332342
uses: actions/setup-python@v4
333343
with:
334-
python-version: "3.x"
344+
python-version: "3.10"
335345
- uses: actions/checkout@v3
336346
with:
337347
submodules: false
@@ -384,7 +394,7 @@ jobs:
384394
id: py3
385395
uses: actions/setup-python@v4
386396
with:
387-
python-version: "3.x"
397+
python-version: "3.10"
388398
- uses: actions/checkout@v3
389399
with:
390400
submodules: false
@@ -473,7 +483,7 @@ jobs:
473483
- name: Set up Python 3
474484
uses: actions/setup-python@v4
475485
with:
476-
python-version: "3.x"
486+
python-version: "3.10"
477487
- uses: actions/checkout@v3
478488
with:
479489
submodules: false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
!atmel-samd/asf/**/*.a
1010
*.elf
1111
*.bin
12+
!*.toml.bin
1213
*.map
1314
*.hex
1415
*.dis

.gitmodules

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
[submodule "ports/espressif/esp-idf"]
147147
path = ports/espressif/esp-idf
148148
url = https://github.com/adafruit/esp-idf.git
149-
branch = circuitpython8
149+
branch = release/v4.4-circuitpython
150150
[submodule "ports/espressif/certificates/nina-fw"]
151151
path = lib/certificates/nina-fw
152152
url = https://github.com/adafruit/nina-fw.git
@@ -310,12 +310,21 @@
310310
[submodule "ports/espressif/esp32-camera"]
311311
path = ports/espressif/esp32-camera
312312
url = https://github.com/adafruit/esp32-camera/
313+
branch = circuitpython
313314
[submodule "ports/raspberrypi/lib/cyw43-driver"]
314315
path = ports/raspberrypi/lib/cyw43-driver
315-
url = https://github.com/georgerobotics/cyw43-driver.git
316+
url = https://github.com/adafruit/cyw43-driver.git
317+
branch = circuitpython8
316318
[submodule "ports/raspberrypi/lib/lwip"]
317319
path = ports/raspberrypi/lib/lwip
318-
url = https://github.com/lwip-tcpip/lwip.git
320+
url = https://github.com/adafruit/lwip.git
321+
branch = circuitpython8
319322
[submodule "lib/mbedtls"]
320323
path = lib/mbedtls
321324
url = https://github.com/ARMmbed/mbedtls.git
325+
[submodule "frozen/Adafruit_CircuitPython_UC8151D"]
326+
path = frozen/Adafruit_CircuitPython_UC8151D
327+
url = https://github.com/adafruit/Adafruit_CircuitPython_UC8151D
328+
[submodule "frozen/Adafruit_CircuitPython_SSD1680"]
329+
path = frozen/Adafruit_CircuitPython_SSD1680
330+
url = https://github.com/adafruit/Adafruit_CircuitPython_SSD1680

BUILDING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Failing to install these will prevent from properly building.
3535

3636
pip3 install -r requirements-dev.txt
3737

38+
If you run into an error installing minify_html, you may need to install `rust`.
39+
3840
### mpy-cross
3941

4042
As part of the build process, mpy-cross is needed to compile .py files into .mpy files.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ clean:
9090
rm -rf autoapi
9191
rm -rf $(STUBDIR) $(DISTDIR) *.egg-info
9292

93-
html: stubs
93+
html:
9494
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
9595
@echo
9696
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ def autoapi_prepare_jinja_env(jinja_env):
171171
".env",
172172
".venv",
173173
".direnv",
174+
".devcontainer/Readme.md",
174175
"data",
175176
"docs/autoapi",
176177
"docs/README.md",

devices/ble_hci/common-hal/_bleio/Adapter.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
#include "shared-bindings/_bleio/ScanEntry.h"
5050
#include "shared-bindings/time/__init__.h"
5151

52-
#if CIRCUITPY_DOTENV
53-
#include "shared-module/dotenv/__init__.h"
52+
#if CIRCUITPY_OS_GETENV
53+
#include "shared-bindings/os/__init__.h"
5454
#endif
5555

5656
#define MSEC_TO_UNITS(TIME, RESOLUTION) (((TIME) * 1000) / (RESOLUTION))
@@ -284,15 +284,15 @@ char default_ble_name[] = { 'C', 'I', 'R', 'C', 'U', 'I', 'T', 'P', 'Y', 0, 0, 0
284284
STATIC void bleio_adapter_hci_init(bleio_adapter_obj_t *self) {
285285
mp_int_t name_len = 0;
286286

287-
#if CIRCUITPY_DOTENV
288-
char ble_name[32];
289-
name_len = dotenv_get_key("/.env", "CIRCUITPY_BLE_NAME", ble_name, sizeof(ble_name) - 1);
290-
if (name_len > 0) {
291-
self->name = mp_obj_new_str(ble_name, (size_t)name_len);
287+
#if CIRCUITPY_OS_GETENV
288+
mp_obj_t name = common_hal_os_getenv("CIRCUITPY_BLE_NAME", mp_const_none);
289+
if (name != mp_const_none) {
290+
mp_arg_validate_type_string(name, MP_QSTR_CIRCUITPY_BLE_NAME);
291+
self->name = name;
292292
}
293293
#endif
294294

295-
if (name_len <= 0) {
295+
if (!self->name) {
296296
name_len = sizeof(default_ble_name);
297297
bt_addr_t addr;
298298
hci_check_error(hci_read_bd_addr(&addr));

docs/drivers.rst

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

0 commit comments

Comments
 (0)