Skip to content

Merge in MicroPython 1.15 #4749

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 175 commits into from
May 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
175 commits
Select commit Hold shift + click to select a range
7f7b4f2
rp2/machine_adc: Only initialise the ADC periph if not already enabled.
dpgeorge Feb 3, 2021
5fdf351
py/gc: Don't include mpconfig.h and misc.h in gc.h.
xiaoxiang781216 Jan 11, 2021
7c44354
ports: Remove def of MP_PLAT_PRINT_STRN if it's the same as the default.
dpgeorge Feb 4, 2021
8a41ee1
py: Remove BITS_PER_WORD definition.
dpgeorge Feb 4, 2021
7e956fa
py: Rename BITS_PER_BYTE to MP_BITS_PER_BYTE.
dpgeorge Feb 4, 2021
ad4656b
all: Rename BYTES_PER_WORD to MP_BYTES_PER_OBJ_WORD.
dpgeorge Feb 4, 2021
c891190
py: Rename WORD_MSBIT_HIGH to MP_OBJ_WORD_MSBIT_HIGH.
dpgeorge Feb 4, 2021
1f800ca
rp2/micropy_rules.cmake: Fix makemoduledefs vpath to work with abs path.
dpgeorge Feb 4, 2021
9dedcf1
py/gc: Change include of stdint.h to stddef.h.
dpgeorge Feb 5, 2021
0a59938
py/mpz: Fix overflow of borrow in mpn_div.
dpgeorge Feb 4, 2021
c7aaee2
esp8266/modules: Fix fs_corrupted() to use start_sec not START_SEC.
dpgeorge Feb 8, 2021
26b4ef4
extmod/vfs_posix_file: Allow closing an already closed file.
dpgeorge Feb 11, 2021
df85e48
tests/extmod/vfs_posix.py: Add more tests for VfsPosix class.
dpgeorge Feb 11, 2021
7815dd2
unix/mpbtstackport_common: Implement mp_bluetooth_hci_active.
dpgeorge Feb 10, 2021
7535f67
extmod/btstack: Add HCI trace debugging option in btstack_hci_uart.
dpgeorge Feb 10, 2021
24a8a40
extmod/btstack: Add stub functions for passkey, l2cap bindings.
dpgeorge Feb 10, 2021
50615fe
extmod/btstack: Enable SYNC_EVENTS, PAIRING_BONDING by default.
dpgeorge Feb 10, 2021
9b7d8b8
lib/tinyusb: Update to version 0.8.0.
dpgeorge Feb 3, 2021
035d161
ports: Update to build with new tinyusb.
dpgeorge Feb 8, 2021
c9260dd
rp2: Use local tinyusb instead of the one in pico-sdk.
dpgeorge Feb 3, 2021
f31c6b4
mimxrt: Fix USB CDC handling so it works reliably.
dpgeorge Feb 12, 2021
ede6b86
samd/mphalport: Fix USB CDC tx handling to work reliably.
dpgeorge Feb 12, 2021
701fdca
nrf/drivers/usb: Add USBD_IRQHandler which calls tud_int_handler.
dpgeorge Feb 13, 2021
d128999
tools: Add filesystem action examples to pyboard.py help.
pi-bjl Feb 12, 2021
7ed9954
extmod/uasyncio: Add asyncio.current_task().
jimmo Feb 12, 2021
d2a34c6
stm32/uart: Add uart_set_baudrate function.
dpgeorge Feb 3, 2021
bffb71f
stm32/mpbthciport: Only init the uart once, then use uart_set_baudrate.
dpgeorge Feb 3, 2021
66098c0
py,extmod: Add core cmake rule files.
dpgeorge Sep 23, 2020
9b90882
esp32: Add support to build using IDF with cmake.
dpgeorge Sep 23, 2020
9c2231f
esp32/esp32_rmt: Don't do unnecessary check for unsigned less than zero.
dpgeorge Oct 6, 2020
97072b7
esp32: Add explicit initialisers to silence compiler warnings.
dpgeorge Oct 28, 2020
9f035d6
esp32: Remove traditional "make" capability.
dpgeorge Feb 13, 2021
26b17fd
esp32/boards: Remove old IDF v3 sdkconfig values.
dpgeorge Feb 13, 2021
da2b5fa
esp32/boards: Enable BLE on all boards.
dpgeorge Feb 13, 2021
aa3d6b6
tools/ci.sh: Change esp32 CI to work with idf.py and IDF v4.0.2.
dpgeorge Feb 13, 2021
e017f27
esp32/README: Update based on new IDF v4 cmake build process.
dpgeorge Feb 14, 2021
d191d88
esp32: Add support to build with ESP-IDF v4.1.1.
dpgeorge Feb 15, 2021
a915002
esp32: Add support to build with ESP-IDF v4.2.
dpgeorge Feb 15, 2021
f12462d
esp32: Remove obsolete IDF v3 code wrapped in MICROPY_ESP_IDF_4.
dpgeorge Feb 15, 2021
771376a
esp32/modsocket: Remove unix socket error code translation.
tve Oct 24, 2020
902da05
esp32: Set MICROPY_USE_INTERNAL_ERRNO=0 to use toolchain's errno.h.
tve Nov 12, 2020
a1a2815
extmod/nimble: Ensure handle is set on read error.
jimmo Feb 12, 2021
fce0bd1
extmod/moduselect: Fix unsigned/signed comparison for timeout!=-1.
jimmo Feb 1, 2021
4c54012
unix/moduselect: Don't allow both posix and non-posix configurations.
jimmo Feb 15, 2021
5e96e89
extmod/uasyncio: Add ThreadSafeFlag.
jimmo Feb 12, 2021
cdf9c86
docs/library/uasyncio.rst: Add docs for ThreadSafeFlag.
jimmo Feb 15, 2021
83d2305
tests/extmod: Add test for ThreadSafeFlag.
jimmo Feb 15, 2021
5660200
tools/makemanifest.py: Allow passing option args to include().
jimmo Feb 12, 2021
2aa5793
zephyr: Update to zephyr v2.5.0.
MaureenHelm Feb 15, 2021
dff6fc6
py: Expand lists in core cmake custom commands.
MaureenHelm Nov 11, 2020
f49a736
zephyr: Disable frozen source modules.
MaureenHelm Oct 18, 2020
51fa133
zephyr: Remove unused build files.
MaureenHelm Aug 28, 2020
f573e73
zephyr: Build MicroPython as a cmake target.
MaureenHelm Oct 11, 2020
56a3689
tools/ci.sh: Update zephyr docker image to v0.11.13.
MaureenHelm Feb 16, 2021
6c4a5d1
zephyr/boards: Add support for the nucleo_h743zi board.
Feb 11, 2021
5cb91af
zephyr/modusocket: Fix parameter in calls to net_context_get_XXX().
Feb 12, 2021
236274f
extmod/nimble/hal/hal_uart: Fix HCI_TRACE format specifiers.
jimmo Feb 12, 2021
4005138
extmod/modbluetooth: Allow NimBLE to use Zephyr static address.
jimmo Feb 12, 2021
2eed978
stm32/mboot: Add unpack-dfu command to mboot_pack_dfu.py tool.
Feb 16, 2021
2c1299b
extmod/modussl: Fix ussl read/recv/send/write errors when non-blocking.
tve Apr 2, 2020
caeec80
stm32/usb: Allow a board to configure USBD_VID and all PIDs.
dpgeorge Feb 17, 2021
9b78f3e
stm32: Make pyb, uos, utime, machine and onewire modules configurable.
dpgeorge Feb 17, 2021
5c92ff5
stm32/boards: Disable onewire module on boards with small flash.
dpgeorge Feb 17, 2021
629fdc3
stm32/mpbthciport: Fix initial baudrate to use provided value.
andrewleech Feb 17, 2021
89cb2c6
stm32/mpbthciport: Use mp_printf instead of printf for error message.
dpgeorge Feb 17, 2021
301fe80
stm32/mpbtstackport: Allow chipset and secondary baudrate to be set.
dpgeorge Feb 17, 2021
cf6a015
extmod/btstack: Use MICROPY_HW_BLE_UART_BAUDRATE for first UART init.
dpgeorge Feb 17, 2021
d4b4589
stm32/mboot: After sig verify, only write firmware-head if latter valid.
dpgeorge Feb 18, 2021
466ad35
esp32/boards: Enable size optimisation for builds.
dpgeorge Feb 18, 2021
143372a
esp32: Add support to build with ESP-IDF v4.3 pre-release.
dpgeorge Feb 18, 2021
c10d431
esp32: Add basic support for Non-Volatile-Storage in esp32 module.
tve Jan 18, 2021
d28dbcd
esp32: Make machine.soft_reset() work in main.py and reset_cause().
tve Jun 4, 2020
a76604a
extmod/modbluetooth: Separate enabling of "client" from "central".
jimmo Feb 19, 2021
1342deb
tests/multi_bluetooth: Add basic performance tests.
jimmo Feb 19, 2021
9d674cf
stm32/uart: Add support for LPUART1 on L0, L4, H7 and WB MCUs.
chrismas9 Feb 17, 2021
03a64f2
stm32/boards/NUCLEO_WB55: Enable LPUART1 on PA2/PA3.
dpgeorge Feb 21, 2021
d334d78
tools/verifygitlog.py: Show required format regexp in error message.
titouanc Jan 31, 2021
d867d20
py/mkrules.cmake: Rename QSTR_DEFS variables to QSTRDEFS.
dpgeorge Feb 21, 2021
2adf20c
py/mkrules.cmake: Add MICROPY_QSTRDEFS_PORT to qstr build process.
dpgeorge Feb 21, 2021
75db0b9
esp32: Define MICROPY_QSTRDEFS_PORT to include special qstrs.
dpgeorge Feb 21, 2021
53f5bb0
rp2,stm32: Enable MICROPY_PY_UBINASCII_CRC32 to get ubinascii.crc32().
dpgeorge Feb 22, 2021
cdaec0d
tools/pydfu.py: Support DFU files with elements of zero size.
dpgeorge Feb 23, 2021
680ce45
stm32/rfcore: Allow BLE settings to be changed by a board.
dpgeorge Mar 2, 2021
59a129f
stm32/storage: Prevent attempts to read/write invalid block addresses.
pi-anl Mar 4, 2021
35c602d
stm32/make-stmconst.py: Allow "[]" chars when parsing source comments.
H-Grobben Mar 5, 2021
85ea4ac
stm32/main: Fix passing state.reset_mode to init_flash_fs.
braiden Feb 15, 2021
0facd89
stm32/powerctrl: Save and restore EWUP state when configuring standby.
peterhinch Sep 27, 2020
79c186f
stm32/spi: Fix baudrate calculation for H7 series.
rf-eng Aug 22, 2020
c33c749
stm32/boardctrl: Add MICROPY_BOARD_STARTUP hook.
dpgeorge Mar 10, 2021
7d73b9f
lib/mbedtls: Switch to currently latest commit of LTS branch v2.16.
Feb 9, 2021
2d5cece
py/nlr: Implement NLR for AArch64.
Jongy Feb 17, 2021
e196cb7
py/nlrx64: Fix typo in comment.
Jongy Feb 17, 2021
098ac11
lib/utils/gchelper_generic: Implement AArch64 support.
Jongy Feb 21, 2021
8785aca
esp32/Makefile: Specify port and baud on erase_flash command.
mcauser Feb 25, 2021
23ce25a
mimxrt/boards: Add MIMXRT1050_EVK board, based on MIMXRT1060_EVK.
svetelna Dec 7, 2020
8610bab
rp2: Enable VfsFat class for FAT filesystem support.
StereoRocker Feb 3, 2021
8ade163
rp2/machine_uart: Add timeout/timeout_char to read and write.
robert-hh Feb 9, 2021
da85cb0
rp2/machine_uart: Add support for inverted TX and RX lines.
robert-hh Feb 10, 2021
a075e0b
rp2/rp2_pio: Allow more than 8 consecutive pins for PIO out/set/sideset.
robert-hh Feb 19, 2021
0461640
rp2/rp2_pio: Fix sm.get(buf) to not wait after getting last item.
robert-hh Mar 3, 2021
11cf742
rp2/modmachine: Allow changing CPU clock frequency.
robert-hh Feb 20, 2021
c675452
rp2/modmachine: Re-init UART for REPL on frequency change.
robert-hh Mar 4, 2021
b648942
rp2/rp2_flash: Prevent MICROPY_HW_FLASH_STORAGE_BASE being set negative.
lurch Mar 11, 2021
a62e791
lib/pico-sdk: Update to latest version 1.1.0.
dpgeorge Mar 11, 2021
b24fcd7
esp32/machine_hw_spi: Use default pins when making SPI if none given.
dpgeorge Mar 11, 2021
6129b8e
tests: Rename run-tests to run-tests.py for consistency.
dpgeorge Mar 11, 2021
2a38d71
tests/run-tests.py: Reformat with Black.
dpgeorge Mar 11, 2021
e98ff3f
tests/multi_bluetooth: Skip tests when BLE features are unsupported.
dpgeorge Mar 12, 2021
af45d51
rp2: Enable uerrno module.
kevinkk525 Mar 13, 2021
8010b15
rp2: Enabled more core Python features.
dpgeorge Mar 13, 2021
dcaf702
rp2/modmachine: Enable machine.Signal class.
dpgeorge Mar 13, 2021
eccd73a
extmod/extmod.cmake: Add modonewire.c to MICROPY_SOURCE_EXTMOD list.
dpgeorge Mar 14, 2021
a9140ab
rp2: Use core-provided cmake fragments instead of custom ones.
dpgeorge Mar 14, 2021
914380c
all: Add .git-blame-ignore-revs for fixing up git blame output.
stinos Mar 15, 2021
d53a6d5
stm32/Makefile: Fix C++ linker flags when toolchain has spaces in path.
stinos Mar 15, 2021
2b888aa
extmod/modbluetooth: Free temp arrays in gatts register services.
dpgeorge Mar 16, 2021
a79d97c
tests/extmod/vfs_fat_fileio2.py: Close test file at end of test.
dpgeorge Mar 16, 2021
cb68a57
tests/run-tests.py: Provide more info if script run via pyboard crashes.
dpgeorge Mar 16, 2021
6e5aea0
stm32/Makefile: Allow QSTR_DEFS,QSTR_GLOBAL_DEPENDENCIES to be extended.
dpgeorge Mar 16, 2021
42cf77f
py/vm: For tracing use mp_printf, and print state when thread enabled.
dpgeorge Mar 16, 2021
4fc2866
bare-arm: Clean up the code, make it run on an F405, and add a README.
dpgeorge Mar 12, 2021
9fef1c0
py: Rename remaining object types to be of the form mp_type_xxx.
dpgeorge Mar 26, 2021
ccc388f
rp2/mpthreadport.h: Cast core_state to _mp_state_thread_t.
Gadgetoid Feb 23, 2021
0cf12dd
rp2: Add support for USER_C_MODULES to CMake build system.
Gadgetoid Feb 23, 2021
cc497d4
examples/usercmodule: Add micropython.cmake to the C and CPP examples.
Gadgetoid Feb 23, 2021
8e5756e
docs/develop/cmodules.rst: Document C-modules and micropython.cmake.
Gadgetoid Feb 24, 2021
5976ea0
tools/ci.sh: Add CI for CMake USER_C_MODULE support.
Gadgetoid Mar 23, 2021
ca3d51f
rp2: Don't advertise remote wakeup for USB serial.
liamfraser Mar 30, 2021
0ccd9e0
esp32: Restore USER_C_MODULE support with new CMake build system.
mocleiri Mar 27, 2021
17b1f82
tools/ci.sh: Build user C modules for esp32.
mocleiri Mar 27, 2021
ec79e44
esp32: Fix multiple definition errors with mp_hal_stdout_tx functions.
mocleiri Mar 31, 2021
d87f42b
examples/usercmodules: Simplify user C module enabling.
dpgeorge Mar 30, 2021
f541b36
docs/develop: Improve user C modules to properly describe how to build.
dpgeorge Apr 2, 2021
2d8aecd
rp2/CMakeLists.txt: Enable USB enumeration fix.
dpgeorge Apr 1, 2021
25ae169
stm32: Include .ARM section in firmware for C++ exception handling.
dpgeorge Apr 6, 2021
d35f12f
tools/metrics.py: Fix esp32 output filename due to move to CMake.
dpgeorge Apr 6, 2021
172fb52
extmod/re1.5: Check and report byte overflow errors in _compilecode.
jepler Mar 28, 2021
4f53f46
rp2: Import uarray instead of array in rp2 module.
tjvr Apr 3, 2021
a66286f
unix: Improve command line argument processing.
stinos Apr 6, 2021
00963a4
stm32/powerctrl: Allow a board to configure AHB and APB clock dividers.
dpgeorge Apr 7, 2021
f4340b7
stm32/powerctrl: Support using PLLI2C on STM32F413 as USB clock source.
dpgeorge Apr 7, 2021
cb39682
stm32/boards/pllvalues.py: Relax PLLQ constraints on STM32F413 MCUs.
dpgeorge Apr 7, 2021
4d9e657
stm32/mpconfigport.h: Add support for a board to specify root pointers.
dpgeorge Apr 8, 2021
7b41d7f
stm32/boardctrl: Give boards control over execution of boot.py,main.py.
dpgeorge Apr 8, 2021
0fabda3
py/py.cmake: Move qstr helper code to micropy_gather_target_properties.
dpgeorge Apr 8, 2021
5dcc9b3
py/py.cmake: Introduce MICROPY_INC_CORE as a list with core includes.
dpgeorge Apr 8, 2021
212fe7f
extmod/extmod.cmake: Add support to build btree module with CMake.
dpgeorge Apr 8, 2021
ab9d47e
esp32: Enable btree module.
dpgeorge Apr 8, 2021
7546d3c
stm32/boards/NUCLEO_L476RG: Add 5 remaining UARTs.
aziubin Mar 21, 2021
42035e5
examples/embedding: Fix example so it compiles again.
santtu Feb 24, 2021
2c9af1c
rp2/rp2_pio: Validate state machine frequency in constructor.
dpgeorge Mar 15, 2021
6f06dca
rp2/moduos: Implement uos.urandom().
robert-hh Mar 17, 2021
22554cf
rp2/rp2_pio: Add StateMachine restart,rx_fifo,tx_fifo helper functions.
robert-hh Mar 1, 2021
1be74b9
rp2/machine_uart: Add buffered transfer of data with rxbuf/txbuf kwargs.
robert-hh Mar 11, 2021
7ca6866
rp2: Add support for building different board configurations.
jahr Apr 5, 2021
dd62c52
stm32/rfcore: Fix race condition with C2 accessing free buffer list.
dpgeorge Apr 12, 2021
2668337
stm32/rfcore: Intercept addr-resolution HCI cmd to work around BLE bug.
dpgeorge Apr 12, 2021
b26def0
py/profile: Resolve name collision with STATIC unset.
matejcik Apr 9, 2021
1a2ffda
py/runtime: Make sys.modules preallocate to a configurable size.
matejcik Mar 22, 2021
25c029c
stm32/boards: Split UARTx_RTS_DE into UARTx_RTS/UARTx_DE in pin defs.
dpgeorge Apr 13, 2021
2ac09c2
stm32/uart: Use LL_USART_GetBaudRate to compute baudrate.
dpgeorge Apr 13, 2021
9c9bfe1
unix/main: Make static variable that's potentially clobbered by longjmp.
maribu Mar 30, 2021
fc6ea28
stm32/sdram: Make MICROPY_HW_FMC_BA1,MICROPY_HW_FMC_A11 optional pins.
8bitgeek Apr 5, 2021
d0e014a
mimxrt: Enable CPYTHON_COMPAT, PY_ASYNC_AWAIT, PY_ATTRTUPLE options.
dpgeorge Apr 14, 2021
7f366a2
esp32/modsocket: Correctly handle poll/read of unconnected TCP socket.
dpgeorge Apr 14, 2021
8459f53
tests/feature_check: Check for lack of pass result rather than failure.
dpgeorge Apr 14, 2021
66a86a0
esp32: Add initial support for ESP32S2 SoCs.
dpgeorge Feb 18, 2021
c81d048
esp32: Add support for USB with CDC ACM.
dpgeorge Feb 19, 2021
d97b8da
esp32/boards: Add GENERIC_S2 board definition.
dpgeorge Apr 13, 2021
a9bbf70
tools/ci.sh: Build esp32 using IDF v4.0.2 and v4.3.
dpgeorge Apr 13, 2021
e5d2ddd
esp32/machine_pin: Use rtc_gpio_deinit instead of gpio_reset_pin.
dpgeorge Apr 15, 2021
f842a40
rp2/rp2_pio: Add fifo_join support for PIO.
tjvr Apr 2, 2021
7d911d2
tests/net_inet: Add 'Strict-Transport-Security' to exp file.
dpgeorge Apr 18, 2021
321d189
all: Bump version to 1.15.
dpgeorge Apr 18, 2021
966d25c
Merge MicroPython v1.15 into CircuitPython
tannewt May 12, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# tests/run-tests.py: Reformat with Black.
2a38d7103672580882fb621a5b76e8d26805d593

# all: Update Python code to conform to latest black formatting.
06659077a81b85882254cf0953c33b27614e018e

# tools/uncrustify: Enable more opts to remove space between func and '('.
77ed6f69ac35c1663a5633a8ee1d8a2446542204

# tools/codeformat.py: Include extmod/{btstack,nimble} in code formatting.
026fda605e03113d6e753290d65fed774418bc53

# all: Format code to add space after C++-style comment start.
84fa3312cfa7d2237d4b56952f2cd6e3591210c4

# tests: Format all Python code with black, except tests in basics subdir.
3dc324d3f1312e40d3a8ed87e7244966bb756f26

# all: Remove spaces inside and around parenthesis.
1a3e386c67e03a79eb768cb6e9f6777e002d6660

# all: Remove spaces between nested paren and inside function arg paren.
feb25775851ba0c04b8d1013716f442258879d9c

# all: Reformat C and Python source code with tools/codeformat.py.
69661f3343bedf86e514337cff63d96cc42f8859

# stm32/usbdev: Convert files to unix line endings.
abde0fa2267f9062b28c3c015d7662a550125cc6

# all: Remove trailing spaces, per coding conventions.
761e4c7ff62896c7d8f8c3dfc3cc98a4cc4f2f6f
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ jobs:
run: |
make -C ports/unix VARIANT=coverage -j2
- name: Test all
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests -j1
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1
working-directory: tests
- name: Native Tests
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests -j1 --emit native
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --emit native
working-directory: tests
- name: mpy Tests
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
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
working-directory: tests
- name: Native mpy Tests
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
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
working-directory: tests
- name: Build mpy-cross.static-aarch64
run: make -C mpy-cross -j2 -f Makefile.static-aarch64
Expand Down
4 changes: 4 additions & 0 deletions docs/library/uasyncio.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ Core functions

Returns the corresponding `Task` object.

.. function:: current_task()

Return the `Task` object associated with the currently running task.

.. function:: run(coro)

Create a new task from the given coroutine and run it until it completes.
Expand Down
93 changes: 93 additions & 0 deletions extmod/extmod.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# CMake fragment for MicroPython extmod component

set(MICROPY_EXTMOD_DIR "${MICROPY_DIR}/extmod")
set(MICROPY_OOFATFS_DIR "${MICROPY_DIR}/lib/oofatfs")

set(MICROPY_SOURCE_EXTMOD
${MICROPY_DIR}/lib/embed/abort_.c
${MICROPY_DIR}/lib/utils/printf.c
${MICROPY_EXTMOD_DIR}/machine_i2c.c
${MICROPY_EXTMOD_DIR}/machine_mem.c
${MICROPY_EXTMOD_DIR}/machine_pulse.c
${MICROPY_EXTMOD_DIR}/machine_signal.c
${MICROPY_EXTMOD_DIR}/machine_spi.c
${MICROPY_EXTMOD_DIR}/modbluetooth.c
${MICROPY_EXTMOD_DIR}/modbtree.c
${MICROPY_EXTMOD_DIR}/modframebuf.c
${MICROPY_EXTMOD_DIR}/modonewire.c
${MICROPY_EXTMOD_DIR}/moduasyncio.c
${MICROPY_EXTMOD_DIR}/modubinascii.c
${MICROPY_EXTMOD_DIR}/moducryptolib.c
${MICROPY_EXTMOD_DIR}/moductypes.c
${MICROPY_EXTMOD_DIR}/moduhashlib.c
${MICROPY_EXTMOD_DIR}/moduheapq.c
${MICROPY_EXTMOD_DIR}/modujson.c
${MICROPY_EXTMOD_DIR}/modurandom.c
${MICROPY_EXTMOD_DIR}/modure.c
${MICROPY_EXTMOD_DIR}/moduselect.c
${MICROPY_EXTMOD_DIR}/modussl_axtls.c
${MICROPY_EXTMOD_DIR}/modussl_mbedtls.c
${MICROPY_EXTMOD_DIR}/modutimeq.c
${MICROPY_EXTMOD_DIR}/moduwebsocket.c
${MICROPY_EXTMOD_DIR}/moduzlib.c
${MICROPY_EXTMOD_DIR}/modwebrepl.c
${MICROPY_EXTMOD_DIR}/uos_dupterm.c
${MICROPY_EXTMOD_DIR}/utime_mphal.c
${MICROPY_EXTMOD_DIR}/vfs.c
${MICROPY_EXTMOD_DIR}/vfs_blockdev.c
${MICROPY_EXTMOD_DIR}/vfs_fat.c
${MICROPY_EXTMOD_DIR}/vfs_fat_diskio.c
${MICROPY_EXTMOD_DIR}/vfs_fat_file.c
${MICROPY_EXTMOD_DIR}/vfs_lfs.c
${MICROPY_EXTMOD_DIR}/vfs_posix.c
${MICROPY_EXTMOD_DIR}/vfs_posix_file.c
${MICROPY_EXTMOD_DIR}/vfs_reader.c
${MICROPY_EXTMOD_DIR}/virtpin.c
${MICROPY_EXTMOD_DIR}/nimble/modbluetooth_nimble.c
)

# Library for btree module and associated code

set(MICROPY_LIB_BERKELEY_DIR "${MICROPY_DIR}/lib/berkeley-db-1.xx")

if(EXISTS "${MICROPY_LIB_BERKELEY_DIR}/btree/bt_close.c")
add_library(micropy_extmod_btree OBJECT
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_close.c
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_conv.c
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_debug.c
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_delete.c
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_get.c
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_open.c
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_overflow.c
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_page.c
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_put.c
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_search.c
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_seq.c
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_split.c
${MICROPY_LIB_BERKELEY_DIR}/btree/bt_utils.c
${MICROPY_LIB_BERKELEY_DIR}/mpool/mpool.c
)

target_include_directories(micropy_extmod_btree PRIVATE
${MICROPY_LIB_BERKELEY_DIR}/PORT/include
)

target_compile_definitions(micropy_extmod_btree PRIVATE
__DBINTERFACE_PRIVATE=1
mpool_error=printf
abort=abort_
"virt_fd_t=void*"
)

# The include directories and compile definitions below are needed to build
# modbtree.c and should be added to the main MicroPython target.

list(APPEND MICROPY_INC_CORE
"${MICROPY_LIB_BERKELEY_DIR}/PORT/include"
)

list(APPEND MICROPY_DEF_CORE
__DBINTERFACE_PRIVATE=1
"virt_fd_t=void*"
)
endif()
4 changes: 2 additions & 2 deletions extmod/moduselect.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ STATIC mp_obj_t select_select(size_t n_args, const mp_obj_t *args) {
// poll the objects
mp_uint_t n_ready = poll_map_poll(&poll_map, rwx_len);

if (n_ready > 0 || (timeout != -1 && mp_hal_ticks_ms() - start_tick >= timeout)) {
if (n_ready > 0 || (timeout != (mp_uint_t)-1 && mp_hal_ticks_ms() - start_tick >= timeout)) {
// one or more objects are ready, or we had a timeout
mp_obj_t list_array[3];
list_array[0] = mp_obj_new_list(rwx_len[0], NULL);
Expand Down Expand Up @@ -230,7 +230,7 @@ STATIC mp_uint_t poll_poll_internal(uint n_args, const mp_obj_t *args) {
for (;;) {
// poll the objects
n_ready = poll_map_poll(&self->poll_map, NULL);
if (n_ready > 0 || (timeout != -1 && mp_hal_ticks_ms() - start_tick >= timeout)) {
if (n_ready > 0 || (timeout != (mp_uint_t)-1 && mp_hal_ticks_ms() - start_tick >= timeout)) {
break;
}
MICROPY_EVENT_POLL_HOOK
Expand Down
1 change: 1 addition & 0 deletions extmod/uasyncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"wait_for_ms": "funcs",
"gather": "funcs",
"Event": "event",
"ThreadSafeFlag": "event",
"Lock": "lock",
"open_connection": "stream",
"start_server": "stream",
Expand Down
4 changes: 4 additions & 0 deletions extmod/uasyncio/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ def get_event_loop(runq_len=0, waitq_len=0):
return Loop


def current_task():
return cur_task


def new_event_loop():
global _task_queue, _io_queue
# TaskQueue of Task instances
Expand Down
2 changes: 2 additions & 0 deletions extmod/uasyncio/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def is_set(self):

def set(self):
# Event becomes set, schedule any tasks waiting on it
# Note: This must not be called from anything except the thread running
# the asyncio loop (i.e. neither hard or soft IRQ, or a different thread).
while self.waiting.peek():
core._task_queue.push_head(self.waiting.pop_head())
self.state = True
Expand Down
6 changes: 5 additions & 1 deletion extmod/vfs_posix_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ STATIC mp_uint_t vfs_posix_file_write(mp_obj_t o_in, const void *buf, mp_uint_t

STATIC mp_uint_t vfs_posix_file_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
mp_obj_vfs_posix_file_t *o = MP_OBJ_TO_PTR(o_in);
check_fd_is_open(o);

if (request != MP_STREAM_CLOSE) {
check_fd_is_open(o);
}

switch (request) {
case MP_STREAM_FLUSH: {
int ret;
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/gchelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ typedef uintptr_t gc_helper_regs_t[6];
typedef uintptr_t gc_helper_regs_t[4];
#elif defined(__thumb2__) || defined(__thumb__) || defined(__arm__)
typedef uintptr_t gc_helper_regs_t[10];
#elif defined(__aarch64__)
typedef uintptr_t gc_helper_regs_t[11]; // x19-x29
#endif

#endif
Expand Down
27 changes: 27 additions & 0 deletions lib/utils/gchelper_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,33 @@ STATIC void gc_helper_get_regs(gc_helper_regs_t arr) {
arr[9] = r13;
}

#elif defined(__aarch64__)

STATIC void gc_helper_get_regs(gc_helper_regs_t arr) {
const register long x19 asm ("x19");
const register long x20 asm ("x20");
const register long x21 asm ("x21");
const register long x22 asm ("x22");
const register long x23 asm ("x23");
const register long x24 asm ("x24");
const register long x25 asm ("x25");
const register long x26 asm ("x26");
const register long x27 asm ("x27");
const register long x28 asm ("x28");
const register long x29 asm ("x29");
arr[0] = x19;
arr[1] = x20;
arr[2] = x21;
arr[3] = x22;
arr[4] = x23;
arr[5] = x24;
arr[6] = x25;
arr[7] = x26;
arr[8] = x27;
arr[9] = x28;
arr[10] = x29;
}

#else

#error "Architecture not supported for gc_helper_get_regs. Set MICROPY_GCREGS_SETJMP to use the fallback implementation."
Expand Down
4 changes: 2 additions & 2 deletions mpy-cross/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ STATIC void pre_process_options(int argc, char **argv) {
heap_size *= 1024 * 1024;
}
if (word_adjust) {
heap_size = heap_size * BYTES_PER_WORD / 4;
heap_size = heap_size * MP_BYTES_PER_OBJ_WORD / 4;
}
} else {
exit(usage(argv));
Expand All @@ -161,7 +161,7 @@ STATIC void pre_process_options(int argc, char **argv) {
}

MP_NOINLINE int main_(int argc, char **argv) {
mp_stack_set_limit(40000 * (BYTES_PER_WORD / 4));
mp_stack_set_limit(40000 * (sizeof(void *) / 4));

pre_process_options(argc, argv);

Expand Down
19 changes: 8 additions & 11 deletions ports/unix/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -226,26 +226,23 @@ include $(TOP)/py/mkrules.mk

.PHONY: test test_full

test: $(PROG) $(TOP)/tests/run-tests
test: $(PROG) $(TOP)/tests/run-tests.py
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests --auto-jobs
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py --auto-jobs

test_full: $(PROG) $(TOP)/tests/run-tests
test_full: $(PROG) $(TOP)/tests/run-tests.py
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests -d thread
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests --emit native
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) -d basics float micropython
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) --emit native -d basics float micropython
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py -d thread
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py --emit native
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) -d basics float micropython
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) --emit native -d basics float micropython
cat $(TOP)/tests/basics/0prelim.py | ./$(PROG) | grep -q 'abc'

test_gcov: test_full
gcov -o $(BUILD)/py $(TOP)/py/*.c
gcov -o $(BUILD)/extmod $(TOP)/extmod/*.c

coverage_clean:
$(MAKE) V=2 BUILD=build-coverage PROG=micropython_coverage clean

# build an interpreter for fuzzing
fuzz:
$(MAKE) \
Expand Down
23 changes: 16 additions & 7 deletions ports/unix/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ STATIC int invalid_args(void) {
STATIC void pre_process_options(int argc, char **argv) {
for (int a = 1; a < argc; a++) {
if (argv[a][0] == '-') {
if (strcmp(argv[a], "-c") == 0 || strcmp(argv[a], "-m") == 0) {
break; // Everything after this is a command/module and arguments for it
}
if (strcmp(argv[a], "-h") == 0) {
print_help(argv);
exit(0);
Expand Down Expand Up @@ -386,7 +389,7 @@ STATIC void pre_process_options(int argc, char **argv) {
goto invalid_arg;
}
if (word_adjust) {
heap_size = heap_size * BYTES_PER_WORD / 4;
heap_size = heap_size * MP_BYTES_PER_OBJ_WORD / 4;
}
// If requested size too small, we'll crash anyway
if (heap_size < 700) {
Expand All @@ -399,6 +402,8 @@ STATIC void pre_process_options(int argc, char **argv) {
}
a++;
}
} else {
break; // Not an option but a file
}
}
}
Expand Down Expand Up @@ -445,7 +450,7 @@ MP_NOINLINE int main_(int argc, char **argv) {
signal(SIGPIPE, SIG_IGN);
#endif

mp_stack_set_limit(40000 * (BYTES_PER_WORD / 4));
mp_stack_set_limit(40000 * (sizeof(void *) / 4));

pre_process_options(argc, argv);

Expand Down Expand Up @@ -571,11 +576,10 @@ MP_NOINLINE int main_(int argc, char **argv) {
if (a + 1 >= argc) {
return invalid_args();
}
set_sys_argv(argv, a + 1, a); // The -c becomes first item of sys.argv, as in CPython
set_sys_argv(argv, argc, a + 2); // Then what comes after the command
ret = do_str(argv[a + 1]);
if (ret & FORCED_EXIT) {
break;
}
a += 1;
break;
} else if (strcmp(argv[a], "-m") == 0) {
if (a + 1 >= argc) {
return invalid_args();
Expand All @@ -595,7 +599,12 @@ MP_NOINLINE int main_(int argc, char **argv) {

mp_obj_t mod;
nlr_buf_t nlr;
bool subpkg_tried = false;

// Allocating subpkg_tried on the stack can lead to compiler warnings about this
// variable being clobbered when nlr is implemented using setjmp/longjmp. Its
// value must be preserved across calls to setjmp/longjmp.
static bool subpkg_tried;
subpkg_tried = false;

reimport:
if (nlr_push(&nlr) == 0) {
Expand Down
4 changes: 4 additions & 0 deletions ports/unix/moduselect.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@

#if MICROPY_PY_USELECT_POSIX

#if MICROPY_PY_USELECT
#error "Can't have both MICROPY_PY_USELECT and MICROPY_PY_USELECT_POSIX."
#endif

#include <stdio.h>
#include <errno.h>
#include <poll.h>
Expand Down
Loading