Skip to content

Commit f7be434

Browse files
committed
Merge remote-tracking branch 'origin/main' into floppy
2 parents 07e710b + 359d8e5 commit f7be434

File tree

660 files changed

+14238
-4075
lines changed

Some content is hidden

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

660 files changed

+14238
-4075
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ jobs:
4242
run: python tools/ci_fetch_deps.py test ${{ github.sha }}
4343
- name: CircuitPython version
4444
run: |
45-
git describe --dirty --tags || git log --parents HEAD~4..
46-
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
45+
tools/describe || git log --parents HEAD~4..
46+
echo >>$GITHUB_ENV CP_VERSION=$(tools/describe)
4747
- name: Install dependencies
4848
run: |
4949
sudo apt-get update
@@ -72,10 +72,23 @@ jobs:
7272
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --emit native
7373
working-directory: tests
7474
- name: mpy Tests
75-
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --mpy-cross-flags='-mcache-lookup-bc' --via-mpy -d basics float micropython
75+
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --via-mpy -d basics float micropython
7676
working-directory: tests
7777
- name: Native mpy Tests
78-
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --mpy-cross-flags='-mcache-lookup-bc' --via-mpy --emit native -d basics float micropython
78+
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --via-mpy --emit native -d basics float micropython
79+
working-directory: tests
80+
- name: Build native modules
81+
run: |
82+
make -C examples/natmod/features1
83+
make -C examples/natmod/features2
84+
make -C examples/natmod/btree
85+
make -C examples/natmod/framebuf
86+
make -C examples/natmod/uheapq
87+
make -C examples/natmod/urandom
88+
make -C examples/natmod/ure
89+
make -C examples/natmod/uzlib
90+
- name: Test native modules
91+
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-natmodtests.py extmod/{btree*,framebuf*,uheapq*,ure*,uzlib*}.py
7992
working-directory: tests
8093
- name: Build mpy-cross.static-aarch64
8194
run: make -C mpy-cross -j2 -f Makefile.static-aarch64
@@ -148,8 +161,8 @@ jobs:
148161
run: python tools/ci_fetch_deps.py mpy-cross-mac ${{ github.sha }}
149162
- name: CircuitPython version
150163
run: |
151-
git describe --dirty --tags
152-
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
164+
tools/describe || git log --parents HEAD~4..
165+
echo >>$GITHUB_ENV CP_VERSION=$(tools/describe)
153166
- name: Install dependencies
154167
run: |
155168
brew install gettext
@@ -204,8 +217,8 @@ jobs:
204217
run: python tools/ci_fetch_deps.py docs ${{ github.sha }}
205218
- name: CircuitPython version
206219
run: |
207-
git describe --dirty --tags
208-
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
220+
tools/describe || git log --parents HEAD~4..
221+
echo >>$GITHUB_ENV CP_VERSION=$(tools/describe)
209222
- name: Set up Python 3
210223
uses: actions/setup-python@v2
211224
with:
@@ -379,13 +392,15 @@ jobs:
379392
- name: Get CP deps
380393
run: python tools/ci_fetch_deps.py ${{ matrix.board }} ${{ github.sha }}
381394
- name: CircuitPython version
382-
run: git describe --dirty --tags
395+
run: |
396+
tools/describe || git log --parents HEAD~4..
397+
echo >>$GITHUB_ENV CP_VERSION=$(tools/describe)
383398
- uses: actions/cache@v2
384399
name: Fetch IDF tool cache
385400
id: idf-cache
386401
with:
387402
path: ${{ github.workspace }}/.idf_tools
388-
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/espressif/esp-idf/HEAD') }}-20210923
403+
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/espressif/esp-idf/HEAD') }}-20220404
389404
- name: Clone IDF submodules
390405
run: |
391406
(cd $IDF_PATH && git submodule update --init)

.github/workflows/create_website_pr.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ jobs:
3434
gcc --version
3535
python3 --version
3636
- name: CircuitPython version
37-
run: git describe --dirty --tags
37+
run: |
38+
tools/describe || git log --parents HEAD~4..
39+
echo >>$GITHUB_ENV CP_VERSION=$(tools/describe)
3840
- name: Website
3941
run: python3 build_board_info.py
4042
working-directory: tools

.github/workflows/ports_windows.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ on:
55
pull_request:
66
paths:
77
- '.github/workflows/*.yml'
8-
- 'tools/**'
9-
- 'py/**'
108
- 'extmod/**'
119
- 'lib/**'
10+
- 'mpy-cross/**'
1211
- 'ports/unix/**'
1312
- 'ports/windows/**'
13+
- 'py/**'
14+
- 'requirements*.txt'
15+
- 'tools/**'
1416

1517
concurrency:
1618
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -64,7 +66,7 @@ jobs:
6466
pip install wheel
6567
# requirements_dev.txt doesn't install on windows. (with msys2 python)
6668
# instead, pick a subset for what we want to do
67-
pip install cascadetoml jinja2 typer intelhex
69+
pip install cascadetoml jinja2 typer click intelhex
6870
# check that installed packages work....?
6971
which python; python --version; python -c "import cascadetoml"
7072
which python3; python3 --version; python3 -c "import cascadetoml"
@@ -77,8 +79,8 @@ jobs:
7779
run: python tools/ci_fetch_deps.py windows ${{ github.sha }}
7880
- name: CircuitPython version
7981
run: |
80-
git describe --dirty --tags
81-
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
82+
tools/describe || git log --parents HEAD~4..
83+
echo >>$GITHUB_ENV CP_VERSION=$(tools/describe)
8284
8385
- name: build mpy-cross
8486
run: make -j2 -C mpy-cross

.gitmodules

Lines changed: 89 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@
116116
[submodule "frozen/Adafruit_CircuitPython_Requests"]
117117
path = frozen/Adafruit_CircuitPython_Requests
118118
url = https://github.com/adafruit/Adafruit_CircuitPython_Requests
119-
[submodule "ports/stm/st_driver"]
120-
path = ports/stm/st_driver
121-
url = https://github.com/hathach/st_driver.git
122119
[submodule "lib/protomatter"]
123120
path = lib/protomatter
124121
url = https://github.com/adafruit/Adafruit_Protomatter
@@ -148,8 +145,8 @@
148145
url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git
149146
[submodule "ports/espressif/esp-idf"]
150147
path = ports/espressif/esp-idf
151-
url = https://github.com/adafruit/esp-idf.git
152-
branch = circuitpython-v4.4
148+
url = https://github.com/espressif/esp-idf.git
149+
branch = release/v4.4
153150
[submodule "ports/espressif/certificates/nina-fw"]
154151
path = ports/espressif/certificates/nina-fw
155152
url = https://github.com/adafruit/nina-fw.git
@@ -202,3 +199,90 @@
202199
[submodule "lib/adafruit_floppy"]
203200
path = lib/adafruit_floppy
204201
url = https://github.com/adafruit/Adafruit_Floppy
202+
[submodule "ports/stm/st_driver/cmsis_device_f4"]
203+
path = ports/stm/st_driver/cmsis_device_f4
204+
url = https://github.com/STMicroelectronics/cmsis_device_f4.git
205+
[submodule "ports/stm/st_driver/cmsis_device_f0"]
206+
path = ports/stm/st_driver/cmsis_device_f0
207+
url = https://github.com/STMicroelectronics/cmsis_device_f0.git
208+
[submodule "ports/stm/st_driver/stm32f0xx_hal_driver"]
209+
path = ports/stm/st_driver/stm32f0xx_hal_driver
210+
url = https://github.com/STMicroelectronics/stm32f0xx_hal_driver.git
211+
[submodule "ports/stm/st_driver/cmsis_device_f1"]
212+
path = ports/stm/st_driver/cmsis_device_f1
213+
url = https://github.com/STMicroelectronics/cmsis_device_f1.git
214+
[submodule "ports/stm/st_driver/stm32f1xx_hal_driver"]
215+
path = ports/stm/st_driver/stm32f1xx_hal_driver
216+
url = https://github.com/STMicroelectronics/stm32f1xx_hal_driver.git
217+
[submodule "ports/stm/st_driver/cmsis_device_f2"]
218+
path = ports/stm/st_driver/cmsis_device_f2
219+
url = https://github.com/STMicroelectronics/cmsis_device_f2.git
220+
[submodule "ports/stm/st_driver/stm32f2xx_hal_driver"]
221+
path = ports/stm/st_driver/stm32f2xx_hal_driver
222+
url = https://github.com/STMicroelectronics/stm32f2xx_hal_driver.git
223+
[submodule "ports/stm/st_driver/cmsis_device_f3"]
224+
path = ports/stm/st_driver/cmsis_device_f3
225+
url = https://github.com/STMicroelectronics/cmsis_device_f3.git
226+
[submodule "ports/stm/st_driver/stm32f3xx_hal_driver"]
227+
path = ports/stm/st_driver/stm32f3xx_hal_driver
228+
url = https://github.com/STMicroelectronics/stm32f3xx_hal_driver.git
229+
[submodule "ports/stm/st_driver/cmsis_device_f7"]
230+
path = ports/stm/st_driver/cmsis_device_f7
231+
url = https://github.com/STMicroelectronics/cmsis_device_f7.git
232+
[submodule "ports/stm/st_driver/stm32f7xx_hal_driver"]
233+
path = ports/stm/st_driver/stm32f7xx_hal_driver
234+
url = https://github.com/STMicroelectronics/stm32f7xx_hal_driver.git
235+
[submodule "ports/stm/st_driver/cmsis_device_h7"]
236+
path = ports/stm/st_driver/cmsis_device_h7
237+
url = https://github.com/STMicroelectronics/cmsis_device_h7.git
238+
[submodule "ports/stm/st_driver/stm32h7xx_hal_driver"]
239+
path = ports/stm/st_driver/stm32h7xx_hal_driver
240+
url = https://github.com/STMicroelectronics/stm32h7xx_hal_driver.git
241+
[submodule "ports/stm/st_driver/cmsis_device_l0"]
242+
path = ports/stm/st_driver/cmsis_device_l0
243+
url = https://github.com/STMicroelectronics/cmsis_device_l0.git
244+
[submodule "ports/stm/st_driver/stm32l0xx_hal_driver"]
245+
path = ports/stm/st_driver/stm32l0xx_hal_driver
246+
url = https://github.com/STMicroelectronics/stm32l0xx_hal_driver.git
247+
[submodule "ports/stm/st_driver/cmsis_device_l1"]
248+
path = ports/stm/st_driver/cmsis_device_l1
249+
url = https://github.com/STMicroelectronics/cmsis_device_l1.git
250+
[submodule "ports/stm/st_driver/stm32l1xx_hal_driver"]
251+
path = ports/stm/st_driver/stm32l1xx_hal_driver
252+
url = https://github.com/STMicroelectronics/stm32l1xx_hal_driver.git
253+
[submodule "ports/stm/st_driver/cmsis_device_l4"]
254+
path = ports/stm/st_driver/cmsis_device_l4
255+
url = https://github.com/STMicroelectronics/cmsis_device_l4.git
256+
[submodule "ports/stm/st_driver/stm32l4xx_hal_driver"]
257+
path = ports/stm/st_driver/stm32l4xx_hal_driver
258+
url = https://github.com/STMicroelectronics/stm32l4xx_hal_driver.git
259+
[submodule "ports/stm/st_driver/cmsis_device_g0"]
260+
path = ports/stm/st_driver/cmsis_device_g0
261+
url = https://github.com/STMicroelectronics/cmsis_device_g0.git
262+
[submodule "ports/stm/st_driver/stm32g0xx_hal_driver"]
263+
path = ports/stm/st_driver/stm32g0xx_hal_driver
264+
url = https://github.com/STMicroelectronics/stm32g0xx_hal_driver.git
265+
[submodule "ports/stm/st_driver/cmsis_device_g4"]
266+
path = ports/stm/st_driver/cmsis_device_g4
267+
url = https://github.com/STMicroelectronics/cmsis_device_g4.git
268+
[submodule "ports/stm/st_driver/stm32g4xx_hal_driver"]
269+
path = ports/stm/st_driver/stm32g4xx_hal_driver
270+
url = https://github.com/STMicroelectronics/stm32g4xx_hal_driver.git
271+
[submodule "ports/stm/st_driver/cmsis_device_l5"]
272+
path = ports/stm/st_driver/cmsis_device_l5
273+
url = https://github.com/STMicroelectronics/cmsis_device_l5.git
274+
[submodule "ports/stm/st_driver/stm32l5xx_hal_driver"]
275+
path = ports/stm/st_driver/stm32l5xx_hal_driver
276+
url = https://github.com/STMicroelectronics/stm32l5xx_hal_driver.git
277+
[submodule "ports/stm/st_driver/CMSIS_5"]
278+
path = ports/stm/st_driver/CMSIS_5
279+
url = https://github.com/ARM-software/CMSIS_5.git
280+
[submodule "ports/stm/st_driver/stm32f4xx_hal_driver"]
281+
path = ports/stm/st_driver/stm32f4xx_hal_driver
282+
url = https://github.com/adafruit/stm32f4xx_hal_driver.git
283+
[submodule "frozen/Adafruit_CircuitPython_PortalBase"]
284+
path = frozen/Adafruit_CircuitPython_PortalBase
285+
url = https://github.com/adafruit/Adafruit_CircuitPython_PortalBase.git
286+
[submodule "frozen/Adafruit_CircuitPython_FakeRequests"]
287+
path = frozen/Adafruit_CircuitPython_FakeRequests
288+
url = https://github.com/adafruit/Adafruit_CircuitPython_FakeRequests.git

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2013-2021 Damien P. George
3+
Copyright (c) 2013-2022 Damien P. George
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@
2424
import sys
2525
import urllib.parse
2626
import time
27+
import pathlib
2728
from collections import defaultdict
2829

2930
from sphinx.transforms import SphinxTransform
3031
from docutils import nodes
3132
from sphinx import addnodes
3233

34+
tools_describe = str(pathlib.Path(__file__).parent / "tools/describe")
35+
3336
# If extensions (or modules to document with autodoc) are in another directory,
3437
# add these directories to sys.path here. If the directory is relative to the
3538
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -129,7 +132,7 @@ def autoapi_prepare_jinja_env(jinja_env):
129132

130133
final_version = ""
131134
git_describe = subprocess.run(
132-
["git", "describe", "--dirty", "--tags"],
135+
[tools_describe],
133136
stdout=subprocess.PIPE,
134137
stderr=subprocess.STDOUT,
135138
encoding="utf-8"

docs/library/binascii.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,9 @@ Functions
3636
Encode binary data in base64 format, as in `RFC 3548
3737
<https://tools.ietf.org/html/rfc3548.html>`_. Returns the encoded data
3838
followed by a newline character, as a bytes object.
39+
40+
.. function:: crc32(data, value=0, /)
41+
42+
Compute CRC-32, the 32-bit checksum of the bytes in *data* starting with an
43+
initial CRC of *value*. The default initial CRC is 0. The algorithm is
44+
consistent with the ZIP file checksum.

docs/library/framebuf.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ For example::
2121
import framebuf
2222

2323
# FrameBuffer needs 2 bytes for every RGB565 pixel
24-
fbuf = framebuf.FrameBuffer(bytearray(10 * 100 * 2), 10, 100, framebuf.RGB565)
24+
fbuf = framebuf.FrameBuffer(bytearray(100 * 10 * 2), 100, 10, framebuf.RGB565)
2525

2626
fbuf.fill(0)
2727
fbuf.text('MicroPython!', 0, 0, 0xffff)
28-
fbuf.hline(0, 10, 96, 0xffff)
28+
fbuf.hline(0, 9, 96, 0xffff)
2929

3030
Constructors
3131
------------

docs/library/sys.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ Constants
8080

8181
A mutable list of directories to search for imported modules.
8282

83+
.. admonition:: Difference to CPython
84+
:class: attention
85+
86+
On MicroPython, an entry with the value ``".frozen"`` will indicate that import
87+
should search :term:`frozen modules <frozen module>` at that point in the search.
88+
If no frozen module is found then search will *not* look for a directory called
89+
``.frozen``, instead it will continue with the next entry in ``sys.path``.
90+
8391
.. data:: platform
8492

8593
The platform that CircuitPython is running on. For OS/RTOS ports, this is

examples/natmod/btree/btree_c.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ void *memmove(void *dest, const void *src, size_t n) {
1818
}
1919

2020
void *malloc(size_t n) {
21-
void *ptr = m_malloc(n);
21+
void *ptr = m_malloc(n, false);
2222
return ptr;
2323
}
2424
void *realloc(void *ptr, size_t n) {
2525
mp_printf(&mp_plat_print, "UNDEF %d\n", __LINE__);
2626
return NULL;
2727
}
2828
void *calloc(size_t n, size_t m) {
29-
void *ptr = m_malloc(n * m);
29+
void *ptr = m_malloc(n * m, false);
3030
// memory already cleared by conservative GC
3131
return ptr;
3232
}
@@ -51,7 +51,7 @@ int *__errno (void)
5151

5252
ssize_t mp_stream_posix_write(void *stream, const void *buf, size_t len) {
5353
mp_obj_base_t* o = stream;
54-
const mp_stream_p_t *stream_p = o->type->protocol;
54+
const mp_stream_p_t *stream_p = o->type->ext[0].protocol;
5555
mp_uint_t out_sz = stream_p->write(MP_OBJ_FROM_PTR(stream), buf, len, &native_errno);
5656
if (out_sz == MP_STREAM_ERROR) {
5757
return -1;
@@ -62,7 +62,7 @@ ssize_t mp_stream_posix_write(void *stream, const void *buf, size_t len) {
6262

6363
ssize_t mp_stream_posix_read(void *stream, void *buf, size_t len) {
6464
mp_obj_base_t* o = stream;
65-
const mp_stream_p_t *stream_p = o->type->protocol;
65+
const mp_stream_p_t *stream_p = o->type->ext[0].protocol;
6666
mp_uint_t out_sz = stream_p->read(MP_OBJ_FROM_PTR(stream), buf, len, &native_errno);
6767
if (out_sz == MP_STREAM_ERROR) {
6868
return -1;
@@ -73,7 +73,7 @@ ssize_t mp_stream_posix_read(void *stream, void *buf, size_t len) {
7373

7474
off_t mp_stream_posix_lseek(void *stream, off_t offset, int whence) {
7575
const mp_obj_base_t* o = stream;
76-
const mp_stream_p_t *stream_p = o->type->protocol;
76+
const mp_stream_p_t *stream_p = o->type->ext[0].protocol;
7777
struct mp_stream_seek_t seek_s;
7878
seek_s.offset = offset;
7979
seek_s.whence = whence;
@@ -86,15 +86,15 @@ off_t mp_stream_posix_lseek(void *stream, off_t offset, int whence) {
8686

8787
int mp_stream_posix_fsync(void *stream) {
8888
mp_obj_base_t* o = stream;
89-
const mp_stream_p_t *stream_p = o->type->protocol;
89+
const mp_stream_p_t *stream_p = o->type->ext[0].protocol;
9090
mp_uint_t res = stream_p->ioctl(MP_OBJ_FROM_PTR(stream), MP_STREAM_FLUSH, 0, &native_errno);
9191
if (res == MP_STREAM_ERROR) {
9292
return -1;
9393
}
9494
return res;
9595
}
9696

97-
mp_obj_type_t btree_type;
97+
mp_obj_full_type_t btree_type;
9898

9999
#include "extmod/modbtree.c"
100100

@@ -123,12 +123,13 @@ mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *a
123123
MP_DYNRUNTIME_INIT_ENTRY
124124

125125
btree_type.base.type = (void*)&mp_fun_table.type_type;
126+
btree_type.flags = MP_TYPE_FLAG_EXTENDED;
126127
btree_type.name = MP_QSTR_btree;
127128
btree_type.print = btree_print;
128-
btree_type.getiter = btree_getiter;
129-
btree_type.iternext = btree_iternext;
130-
btree_type.binary_op = btree_binary_op;
131-
btree_type.subscr = btree_subscr;
129+
btree_type.ext[0].getiter = btree_getiter;
130+
btree_type.ext[0].iternext = btree_iternext;
131+
btree_type.ext[0].binary_op = btree_binary_op;
132+
btree_type.ext[0].subscr = btree_subscr;
132133
btree_locals_dict_table[0] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_close), MP_OBJ_FROM_PTR(&btree_close_obj) };
133134
btree_locals_dict_table[1] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_flush), MP_OBJ_FROM_PTR(&btree_flush_obj) };
134135
btree_locals_dict_table[2] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_get), MP_OBJ_FROM_PTR(&btree_get_obj) };

0 commit comments

Comments
 (0)