summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-08-19stm32: Add implementation of machine.bitstream.Jim Mussared
Hand-written version for M0, and cycle-counter version for everything else. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-19extmod: Add machine.bitstream.Jim Mussared
This is a generic API for synchronously bit-banging data on a pin. Initially this adds a single supported encoding, which supports controlling WS2812 LEDs. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-19tools/mpremote: Remove support for pyb.USB_VCP in/out specialisation.Damien George
The sys.stdin.buffer and sys.stdout.buffer streams work just as well (and are just as fast) as pyb.USB_VCP on stm32 devices, so there's no need to have the USB_VCP specialisation code, which just adds complexity. Also, on stm32 devices with both USB and UART (or other serial interface), if something other than the USB_VCP port is used for the serial connection then mpremote mount will not work because it will default to reading and writing on USB_VCP instead of the other connected serial stream. As part of this simplification, support for a second port as input is removed (this feature was never exposed to the user). Signed-off-by: Damien George <damien@micropython.org>
2021-08-19py/lexer: Clear fstring_args vstr on lexer free.Jim Mussared
This was missed in 692d36d779192f32371f7f9daa845b566f26968d. It's not strictly necessary as the GC will clean it anyway, but it's good to pre-emptively gc_free() all the blocks used in lexing/parsing. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-17docs/library/network.rst: Simplify socket import.Jim Mussared
Replace `import socket as socket` with `import socket`. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-17docs/library/builtins.rst: Add module title.Jim Mussared
This fixes the rendering on library/index.rst. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-17tests/extmod/vfs_fat_finaliser.py: Ensure alloc at never-used GC blocks.Jim Mussared
Prevents the finaliser from being missed if there's a dangling reference on the stack to one of the blocks for the files (that this test checks that they get finalised). See github.com/micropython/micropython/pull/7659#issuecomment-899479793 Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-17unix/Makefile: Disable error compression on arm-linux-gnueabi-gcc.Jim Mussared
This compiler is unable to optimise out the giant strcmp match generated by MP_MATCH_COMPRESSED. See github.com/micropython/micropython/pull/7659#issuecomment-899479793 Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-16esp32/machine_pin: Make check for non-output pins respect chip variant.Damien George
Fixes issue #7631. Signed-off-by: Damien George <damien@micropython.org>
2021-08-16esp32/machine_hw_spi: Release GIL during transfers.Jonathan Hogg
Release the GIL while waiting for SPI transfers to complete to allow other threads to make progress. Fixes #7662.
2021-08-16mimxrt/machine_pin: Implement ioctl for Pin.Philipp Ebensberger
To make machine.Signal work correctly (among other things). The solution is taken over from the rp2 port. Signed-off-by: Philipp Ebensberger
2021-08-14tests/multi_bluetooth/ble_subscribe.py: Add test for subscription.Jim Mussared
This tests both sending indications/notifications from a server to subscribed clients via gatts_write(...,send_update=True) and subscribing from a client. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-14extmod/modbluetooth: Add send_update arg to gatts_write.Jim Mussared
This allows the write to trigger a notification or indication, but only to subscribed clients. This is different to gatts_notify/gatts_indicate, which will unconditionally notify/indicate. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-14stm32,esp32,rp2: Enable MICROPY_PY_FSTRINGS by default.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-14py: Implement partial PEP-498 (f-string) support.Jim Mussared
This implements (most of) the PEP-498 spec for f-strings and is based on https://github.com/micropython/micropython/pull/4998 by @klardotsh. It is implemented in the lexer as a syntax translation to `str.format`: f"{a}" --> "{}".format(a) It also supports: f"{a=}" --> "a={}".format(a) This is done by extracting the arguments into a temporary vstr buffer, then after the string has been tokenized, the lexer input queue is saved and the contents of the temporary vstr buffer are injected into the lexer instead. There are four main limitations: - raw f-strings (`fr` or `rf` prefixes) are not supported and will raise `SyntaxError: raw f-strings are not supported`. - literal concatenation of f-strings with adjacent strings will fail "{}" f"{a}" --> "{}{}".format(a) (str.format will incorrectly use the braces from the non-f-string) f"{a}" f"{a}" --> "{}".format(a) "{}".format(a) (cannot concatenate) - PEP-498 requires the full parser to understand the interpolated argument, however because this entirely runs in the lexer it cannot resolve nested braces in expressions like f"{'}'}" - The !r, !s, and !a conversions are not supported. Includes tests and cpydiffs. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-14tools/mpremote: Add "devs" shortcut for "connect list".Damien George
See issue #7480. Signed-off-by: Damien George <damien@micropython.org>
2021-08-14tools/mpremote: Fix connect-list in case VID/PID are None.Damien George
Which can be the case on Windows and macOS for certain serial devices. Fixes issue #7636. Signed-off-by: Damien George <damien@micropython.org>
2021-08-13extmod/modlwip: Fix close and clean up of UDP and raw sockets.Damien George
The correct callback-deregister functions must be called dependent on the socket type, otherwise resources may not be freed correctly. Signed-off-by: Damien George <damien@micropython.org>
2021-08-13tests/run-multitests.py: Add broadcast and wait facility.Damien George
Test instances can now use the following methods to synchronise their execution: multitest.broadcast("sync message") multitest.wait("sync message") Signed-off-by: Damien George <damien@micropython.org>
2021-08-13tools/autobuild: Add auto build for Silicognition wESP32.Patrick Van Oosterwijck
2021-08-13nrf: Set .mpy features consistent with documentation and other ports.Daniel Mizyrycki
This allows nrf devices to load .mpy files. And nrf52840 and nrf9160 based boards also support compiling and loading native code.
2021-08-13docs/library/index.rst: Clarify module naming and purpose.Jim Mussared
Adds section about extending built-in modules from Python. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-13tools/gen-cpydiff.py: Don't rename foo to ufoo in diff output.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-13docs: Replace ufoo with foo in all docs.Jim Mussared
Anywhere a module is mentioned, use its "non-u" name for consistency. The "import module" vs "import umodule" is something of a FAQ, and this commit intends to help clear that up. As a first approximation MicroPython is Python, and so imports should work the same as Python and use the same name, to a first approximation. The u-version of a module is a detail that can be learned later on, when the user wants to understand more and have finer control over importing. Existing Python code should just work, as much as it is possible to do that within the constraints of embedded systems, and the MicroPython documentation should match the idiomatic way to write Python code. With universal weak links for modules (via MICROPY_MODULE_WEAK_LINKS) users can consistently use "import foo" across all ports (with the exception of the minimal ports). And the ability to override/extend via "foo.py" continues to work well. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-13docs: Rename ufoo.rst to foo.rst.Jim Mussared
This is a simple rename of the files, no content changes (other than updating index.rst to use the new paths) Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-13docs/templates: Add unix and zephyr quickref links to top-index.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-08-13docs/library/zephyr: Add libraries specific to the Zephyr port.Julia Hathaway
Includes documentation for Zephyr specific modules (zephyr and zsensor), classes (DiskAccess and FlashArea), and functions. Signed-off-by: Julia Hathaway <julia.hathaway@nxp.com>
2021-08-13docs/zephyr: Add quick reference for the Zephyr port.Julia Hathaway
Includes an introduction to using the Zephyr port on MicroPython. The quickref details examples of how to use each module the port currently supports. The tutorial provides additional details for Zephyr specific modules. Signed-off-by: Julia Hathaway <julia.hathaway@nxp.com>
2021-08-10stm32/mbedtls: Fix compile warning about uninitialized val.Ned Konz
2021-08-10stm32/boards/NUCLEO_H743ZI2: Add modified version of NUCLEO_H743ZI.Ned Konz
This commit creates a new stm32 board for the NUCLEO_H743ZI2, which is the current version of this from ST. This is a modified copy of the NUCLEO_H743ZI board, and the ZI2 board differs in a few minor ways: - LED2 has moved from PB7 to PE1 and is now yellow rather than blue - the USB power enable has moved from PG6 to PG10 - the USER button is now pulled down
2021-08-10rp2/CMakeLists.txt: Allow a board's cmake to set the manifest path.iabdalkader
This allows boards to add frozen modules, or bypass the port manifest entirely.
2021-08-10esp32/makeimg.py: Get bootloader and partition offset from sdkconfig.Damien George
So that it works on ESP32C3, which has the bootloader at 0x0. Fixes issue #7565. Signed-off-by: Damien George <damien@micropython.org>
2021-08-09nrf: Enable source line on tracebacks.Daniel Mizyrycki
2021-08-09nrf/modules/nrf: Add function to enable/disable DCDC.Glenn Ruben Bakke
This function can be used to enable and disable the DC/DC converter with or without the Bluetooth stack enabled. It can also be used to query the current state of the DC/DC. This commit also adds a definition of ARRAY_SIZE needed by nrfx HAL-layer.
2021-08-08nrf/modules/uos: Add ilistdir to uos module.Damien George
This was missed in the initial implementation of the uos module. Signed-off-by: Damien George <damien@micropython.org>
2021-08-08tools/codeformat.py: Include ports/nrf/modules/nrf in code formatting.Glenn Ruben Bakke
2021-08-08nrf/boards: Enable MICROPY_VFS_LFS2 for all target boards.Glenn Ruben Bakke
Enable LittleFS v2 for all targets, except nrf51 targets when SoftDevice is present.
2021-08-08nrf/mphalport: Add dummy function for mp_hal_time_ns().Glenn Ruben Bakke
extmod/vfs_lfs.c needs to resolve `mp_hal_time_ns()` in order to calculate a timestamp from 1970 epoch. A wall clock is not available in the nrf port, hence the function is implemented to resolve compilation linkage error. The function always return 0.
2021-08-08nrf/Makefile: Set default manifest file for all targets.Glenn Ruben Bakke
Set the default manifest to "modules/manifest.py". This includes files from the folder "modules/scripts". The manifest default value is overriden by all nrf51 boards that have SoftDevice present (SD=s110) to save flash. Also add "modules/manifest.py" which is set to freeze "modules/scripts/_mkfs.py".
2021-08-08nrf/modules/scripts: Add file system formatting script.Glenn Ruben Bakke
Add a helper script _mkfs.py which automatically formats the file system if nrf.Flash() is located and a VFS file system has been included in the compilation. The precedence is: first LFS1, LFS2 then FAT.
2021-08-08nrf/boards: Set FROZEN_MANIFEST blank when SD present on nrf51 targets.Glenn Ruben Bakke
2021-08-08tools/ci.sh: Add mpy-cross build to nrf port.Glenn Ruben Bakke
2021-08-08nrf: Facilitate use of freeze manifest.Glenn Ruben Bakke
Update the Makefile to handle FROZEN_MANIFEST, and the README with some small samples on how to use freeze manifests. And add BOARD_DIR to the Makefile which can be referenced in boards/<board>/mpconfigboard.mk to include a board specific manifest.
2021-08-08nrf/boards: Enable needed features for FAT/LFS1/LFS2.Glenn Ruben Bakke
Enable the following features for all boards except nrf51 boards with SoftDevice present: - MICROPY_VFS - MICROPY_PY_NRF - MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
2021-08-08nrf/main: Add auto mount and auto format hook for internal flash FS.Glenn Ruben Bakke
2021-08-08nrf/qstrdefsport.h: Add entries for in-built FS mount points.Glenn Ruben Bakke
2021-08-08nrf/mpconfigport.h: Enable MICROPY_PY_IO_FILEIO when an FS is enabled.Glenn Ruben Bakke
Enable MICROPY_PY_IO_FILEIO if MICROPY_VFS_FAT, MICROPY_VFS_LFS1 or MICROPY_VFS2 has been enabled.
2021-08-08nrf/modules/uos: Allow a board to configure MICROPY_VFS_FAT/LFS1/LFS2.Glenn Ruben Bakke
2021-08-08nrf/Makefile: Add _fs_size linker script override from make.Glenn Ruben Bakke
Add posibility to override linker script "_fs_size" from make by adding the FS_SIZE parameter. The syntax of value is linker script syntax. For example, the value of 131072 bytes can be written as 128K like this: FS_SIZE=128K. If not set, default value for "_fs_size" from linker script will be used.
2021-08-08nrf/mpconfigport.h: Tune FAT FS configuration.Glenn Ruben Bakke
Disable MICROPY_FATFS_MULTI_PARTITION configuration because there is no partition table in the flash for FATFS to read. Also, set MICROPY_FATFS_MAX_SS to the size of a flash page. For nrf51 the value 1024 is set. For nrf52/nrf91 the value 4096 is set.