8000 Merge pull request #4749 from tannewt/merge_1.15 · syntheticfuture/circuitpython@47947dc · GitHub 8000
[go: up one dir, main page]

Skip to content

Commit 47947dc

Browse files
authored
Merge pull request adafruit#4749 from tannewt/merge_1.15
Merge in MicroPython 1.15
2 parents 53eeb72 + 966d25c commit 47947dc

Some content is hidden

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

70 files changed

+1807
-909
lines changed

.git-blame-ignore-revs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# tests/run-tests.py: Reformat with Black.
2+
2a38d7103672580882fb621a5b76e8d26805d593
3+
4+
# all: Update Python code to conform to latest black formatting.
5+
06659077a81b85882254cf0953c33b27614e018e
6+
7+
# tools/uncrustify: Enable more opts to remove space between func and '('.
8+
77ed6f69ac35c1663a5633a8ee1d8a2446542204
9+
10+
# tools/codeformat.py: Include extmod/{btstack,nimble} in code formatting.
11+
026fda605e03113d6e753290d65fed774418bc53
12+
13+
# all: Format code to add space after C++-style comment start.
14+
84fa3312cfa7d2237d4b56952f2cd6e3591210c4
15+
16+
# tests: Format all Python code with black, except tests in basics subdir.
17+
3dc324d3f1312e40d3a8ed87e7244966bb756f26
18+
19+
# all: Remove spaces inside and around parenthesis.
20+
1a3e386c67e03a79eb768cb6e9f6777e002d6660
21+
22+
# all: Remove spaces between nested paren and inside function arg paren.
23+
feb25775851ba0c04b8d1013716f442258879d9c
24+
25+
# all: Reformat C and Python source code with tools/codeformat.py.
26+
69661f3343bedf86e514337cff63d96cc42f8859
27+
28+
# stm32/usbdev: Convert files to unix line endings.
29+
abde0fa2267f9062b28c3c015d7662a550125cc6
30+
31+
# all: Remove trailing spaces, per coding conventions.
32+
761e4c7ff62896c7d8f8c3dfc3cc98a4cc4f2f6f

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,16 @@ jobs:
7373
run: |
7474
make -C ports/unix VARIANT=coverage -j2
7575
- name: Test all
76-
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests -j1
76+
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1
7777
working-directory: tests
7878
- name: Native Tests
79-
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests -j1 --emit native
79+
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --emit native
8080
working-directory: tests
8181
- name: mpy Tests
82-
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests -j1 --mpy-cross-flags='-mcache-lookup-bc' --via-mpy -d basics float micropython
82+
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
8383
working-directory: tests
8484
- name: Native mpy Tests
85-
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests -j1 --mpy-cross-flags='-mcache-lookup-bc' --via-mpy --emit native -d basics float micropython
85+
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
8686
working-directory: tests
8787
- name: Build mpy-cross.static-aarch64
8888
run: make -C mpy-cross -j2 -f Makefile.static-aarch64

docs/library/uasyncio.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ Core functions
4040

4141
Returns the corresponding `Task` object.
4242

43+
.. function:: current_task()
44+
45+
Return the `Task` object associated with the currently running task.
46+
4347
.. function:: run(coro)
4448

4549
Create a new task from the given coroutine and run it until it completes.

extmod/extmod.cmake

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# CMake fragment for MicroPython extmod component
2+
3+
set(MICROPY_EXTMOD_DIR "${MICROPY_DIR}/extmod")
4+
set(MICROPY_OOFATFS_DIR "${MICROPY_DIR}/lib/oofatfs")
5+
6+
set(MICROPY_SOURCE_EXTMOD
7+
${MICROPY_DIR}/lib/embed/abort_.c
8+
${MICROPY_DIR}/lib/utils/printf.c
9+
${MICROPY_EXTMOD_DIR}/machine_i2c.c
10+
${MICROPY_EXTMOD_DIR}/machine_mem.c
11+
${MICROPY_EXTMOD_DIR}/machine_pulse.c
12+
${MICROPY_EXTMOD_DIR}/machine_signal.c
13+
${MICROPY_EXTMOD_DIR}/machine_spi.c
14+
${MICROPY_EXTMOD_DIR}/modbluetooth.c
15+
${MICROPY_EXTMOD_DIR}/modbtree.c
16+
${MICROPY_EXTMOD_DIR}/modframebuf.c
17+
${MICROPY_EXTMOD_DIR}/modonewire.c
18+
${MICROPY_EXTMOD_DIR}/moduasyncio.c
19+
${MICROPY_EXTMOD_DIR}/modubinascii.c
20+
${MICROPY_EXTMOD_DIR}/moducryptolib.c
21+
${MICROPY_EXTMOD_DIR}/moductypes.c
22+
${MICROPY_EXTMOD_DIR}/moduhashlib.c
23+
${MICROPY_EXTMOD_DIR}/moduheapq.c
24+
${MICROPY_EXTMOD_DIR}/modujson.c
25+
${MICROPY_EXTMOD_DIR}/modurandom.c
26+
${MICROPY_EXTMOD_DIR}/modure.c
27+
${MICROPY_EXTMOD_DIR}/moduselect.c
28+
${MICROPY_EXTMOD_DIR}/modussl_axtls.c
29+
${MICROPY_EXTMOD_DIR}/modussl_mbedtls.c
30+
${MICROPY_EXTMOD_DIR}/modutimeq.c
31+
${MICROPY_EXTMOD_DIR}/moduwebsocket.c
32+
${MICROPY_EXTMOD_DIR}/moduzlib.c
33+
${MICROPY_EXTMOD_DIR}/modwebrepl.c
34+
${MICROPY_EXTMOD_DIR}/uos_dupterm.c
35+
${MICROPY_EXTMOD_DIR}/utime_mphal.c
36+
${MICROPY_EXTMOD_DIR}/vfs.c
37+
${MICROPY_EXTMOD_DIR}/vfs_blockdev.c
38+
${MICROPY_EXTMOD_DIR}/vfs_fat.c
39+
${MICROPY_EXTMOD_DIR}/vfs_fat_diskio.c
40+
${MICROPY_EXTMOD_DIR}/vfs_fat_file.c
41+
${MICROPY_EXTMOD_DIR}/vfs_lfs.c
42+
${MICROPY_EXTMOD_DIR}/vfs_posix.c
43+
${MICROPY_EXTMOD_DIR}/vfs_posix_file.c
44+
${MICROPY_EXTMOD_DIR}/vfs_reader.c
45+
${MICROPY_EXTMOD_DIR}/virtpin.c
46+
${MICROPY_EXTMOD_DIR}/nimble/modbluetooth_nimble.c
47+
)
48+
49+
# Library for btree module and associated code
50+
51+
set(MICROPY_LIB_BERKELEY_DIR "${MICROPY_DIR}/lib/berkeley-db-1.xx")
52+
53+
if(EXISTS "${MICROPY_LIB_BERKELEY_DIR}/btree/bt_close.c")
54+
add_library(micropy_extmod_btree OBJECT
55+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_close.c
56+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_conv.c
57+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_debug.c
58+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_delete.c
59+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_get.c
60+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_open.c
61+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_overflow.c
62+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_page.c
63+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_put.c
64+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_search.c
65+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_seq.c
66+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_split.c
67+
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_utils.c
68+
${MICROPY_LIB_BERKELEY_DIR}/mpool/mpool.c
69+
)
70+
71+
target_include_directories(micropy_extmod_btree PRIVATE
72+
${MICROPY_LIB_BERKELEY_DIR}/PORT/include
73+
)
74+
75+
target_compile_definitions(micropy_extmod_btree PRIVATE
76+
__DBINTERFACE_PRIVATE=1
77+
mpool_error=printf
78+
abort=abort_
79+
"virt_fd_t=void*"
80+
)
81+
82+
# The include directories and compile definitions below are needed to build
83+
# modbtree.c and should be added to the main MicroPython target.
84+
85+
list(APPEND MICROPY_INC_CORE
86+
"${MICROPY_LIB_BERKELEY_DIR}/PORT/include"
87+
)
88+
89+
list(APPEND MICROPY_DEF_CORE
90+
__DBINTERFACE_PRIVATE=1
91+
"virt_fd_t=void*"
92+
)
93+
endif()

extmod/moduselect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ STATIC mp_obj_t select_select(size_t n_args, const mp_obj_t *args) {
128128
// poll the objects
129129
mp_uint_t n_ready = poll_map_poll(&poll_map, rwx_len);
130130

131-
if (n_ready > 0 || (timeout != -1 && mp_hal_ticks_ms() - start_tick >= timeout)) {
131+
if (n_ready > 0 || (timeout != (mp_uint_t)-1 && mp_hal_ticks_ms() - start_tick >= timeout)) {
132132
// one or more objects are ready, or we had a timeout
133133
mp_obj_t list_array[3];
134134
list_array[0] = mp_obj_new_list(rwx_len[0], NULL);
@@ -230,7 +230,7 @@ STATIC mp_uint_t poll_poll_internal(uint n_args, const mp_obj_t *args) {
230230
for (;;) {
231231
// poll the objects
232232
n_ready = poll_map_poll(&self->poll_map, NULL);
233-
if (n_ready > 0 || (timeout != -1 && mp_hal_ticks_ms() - start_tick >= timeout)) {
233+
if (n_ready > 0 || (timeout != (mp_uint_t)-1 && mp_hal_ticks_ms() - start_tick >= timeout)) {
234234
break;
235235
}
236236
MICROPY_EVENT_POLL_HOOK

extmod/uasyncio/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"wait_for_ms": "funcs",
1111
"gather": "funcs",
1212
"Event": "event",
13+
"ThreadSafeFlag": "event",
1314
"Lock": "lock",
1415
"open_connection": "stream",
1516
"start_server": "stream",

extmod/uasyncio/core.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ def get_event_loop(runq_len=0, waitq_len=0):
264264
return Loop
265265

266266

267+
def current_task():
268+
return cur_task
269+
270+
267271
def new_event_loop():
268272
global _task_queue, _io_queue
269273
# TaskQueue of Task instances

extmod/uasyncio/event.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ def is_set(self):
1414

1515
def set(self):
1616
# Event becomes set, schedule any tasks waiting on it
17+
# Note: This must not be called from anything except the thread running
18+
# the asyncio loop (i.e. neither hard or soft IRQ, or a different thread).
1719
while self.waiting.peek():
1820
core._task_queue.push_head(self.waiting.pop_head())
1921
self.state = True

extmod/vfs_posix_file.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,11 @@ STATIC mp_uint_t vfs_posix_file_write(mp_obj_t o_in, const void *buf, mp_uint_t
137137

138138
STATIC mp_uint_t vfs_posix_file_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
139139
mp_obj_vfs_posix_file_t *o = MP_OBJ_TO_PTR(o_in);
140-
check_fd_is_open(o);
140+
141+
if (request != MP_STREAM_CLOSE) {
142+
check_fd_is_open(o);
143+
}
144+
141145
switch (request) {
142146
case MP_STREAM_FLUSH: {
143147
int ret;

lib/utils/gchelper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ typedef uintptr_t gc_helper_regs_t[6];
3939
typedef uintptr_t gc_helper_regs_t[4];
4040
#elif defined(__thumb2__) || defined(__thumb__) || defined(__arm__)
4141
typedef uintptr_t gc_helper_regs_t[10];
42+
#elif defined(__aarch64__)
43+
typedef uintptr_t gc_helper_regs_t[11]; // x19-x29
4244
#endif
4345

4446
#endif

0 commit comments

Comments
 (0)
0