summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-04-11stm32/sdram: Add function to enable SDRAM power-down mode.iabdalkader
Add power-down mode for maximum power saving while in standby mode, to be used by a board if needed. Also fix a typo in a comment.
2022-04-11stm32/mboot: Add macros for use in led_state_all().Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-11stm32/mboot: Consolidate all UI and add general state change hooks.Damien George
All user interface (LED, button) code has been moved to ui.c, and the interface to this code with the rest of the system now goes through calls to mboot_state_change(). This state-change function can be overridden by a board to fully customise the user interface behaviour. Signed-off-by: Damien George <damien@micropython.org>
2022-04-11tests/inlineasm: Add test for PUSH LR and POP PC.Christian Zietz
2022-04-11py/emitinlinethumb: Use 16 bit encodings for PUSH LR and POP PC.Christian Zietz
The Thumb instruction set has special 16 bit encodings for PUSH involving LR and POP involving PC, which are commonly used in nested functions. Using this encoding is particularly important for ARMv6-M, where the more general 32 bit encoding of PUSH and POP is unavailable.
2022-04-11docs/differences: Update Python 3.5 diff, with optional listen backlog.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-11extmod/modusocket: Provide config macro for socket.listen backlog deflt.Damien George
To make it possible to change this value for any given port or board. Signed-off-by: Damien George <damien@micropython.org>
2022-04-11extmod/modusocket: Implement optional socket.listen backlog argument.Jon Bjarni Bjarnason
This follows the CPython change: https://bugs.python.org/issue21455 Socket listen backlog defaults to 2 if not given, based on most bare metal targets not having many resources for a large backlog. On UNIX it defaults to SOMAXCONN or 128, whichever is less.
2022-04-11tools/mpremote: Add option to mount cmd to allow "unsafe" symlinks.Rob Knegjens
Specifying the option `--unsafe-links` (or `-l`) to `mpremote mount` will allow symlinks to be followed in the local directory that point outside of the base directory path. For the unsafe case the `path_check()` method of `PyboardCommand` still checks for a common path but without expanding symlinks. While this check is currently redundant, it makes the purpose of the method clearer for possible future uses or extensions.
2022-04-11tools/mpremote: Show progress indicator when copying large files.Rob Knegjens
When copying large files (> 2048 bytes) to or from a device with `mpremote cp` a progress bar and percentage counter are temporarily shown.
2022-04-11rp2/Makefile: Add mbedtls to GIT_SUBMODULES list and use it in CI func.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-11mimxrt/mphalport: Fix USB CDC RX handling to not block when unprocessed.robert-hh
Changes in this commit: - Fix USB CDC RX handling to not block when unprocessed. The fix follows 587339022689187a1acbccc1d0e2425a67385ff7. - Fix dupterm rx. - Remove some obsolete lines.
2022-04-11mimxrt/machine_spi: Improve handling of busy SPI peripheral.robert-hh
This commit changes the method of waiting for SPI being not busy. Instead of the FIFO size, the TransferBusyFlag is probed. Also, raise an error if the transfer failed.
2022-04-11mimxrt/machine_rtc: Start RTC at boot and set datetime if not set.robert-hh
Changes in this commit: - Start the RTC Timer at system boot. Otherwise time.time() will advance only if an RTC() object was created. - Set the time to a more recent date than Jan 1, 1970, if not set. That is 2013/10/14, 19:53:11, MicroPython's first commit. - Compensate an underflow in in timeutils_seconds_since_2000(), called by time.time(), if the time is set to a pre-2000 date.
2022-04-11mimxrt/modules: Append /flash/lib to the default sys.path.robert-hh
2022-04-11mimxrt/boards: Add board.json file for OLIMEX RT1010Py.robert-hh
2022-04-07stm32/machine_bitstream: Include all clobbered regs in Cortex-M0 impl.Damien George
These additional registers are used by the assembly code. Thanks to Jim Mussared for the fix. Signed-off-by: Damien George <damien@micropython.org>
2022-04-07stm32/mpconfigport.h: Let MICROPY_PY_IO_FILEIO take its default value.Damien George
This is enabled at MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES, which is the default for stm32. Not setting the value in mpconfigboard.h allows boards to optionally configure it. Signed-off-by: Damien George <damien@micropython.org>
2022-04-05rp2/mphalport: Fix USB CDC RX handling to not block when unprocessed.Martin Fischer
Prior to this commit, the USB CDC OUT endpoint got NACK'd if a character was received but not consumed by the application, e.g. via sys.stdin.read(). This meant that USB CDC was blocked and no additional characters could be sent from the host. In particular a ctrl-C could not interrupt the application if another character was pending. To fix the issue, the approach in this commit uses a callback tud_cdc_rx_cb which is called by the TinyUSB stack on reception of new CDC data. By consuming the data immediately, the endpoint does not stall anymore. The previous handler tud_cdc_rx_wanted_cb was made obsolete and removed. In addition some cleanup was done along the way: by adding interrupt_char.c and removing the existing code mp_hal_set_interrupt_char(). Also, there is now only one (stdin) ringbuffer. Fixes issue #7996.
2022-04-04esp32: Allow overriding cmake frozen manifest from the command line.iabdalkader
If MICROPY_FROZEN_MANIFEST is set from the cmake command line, then it will override the default and any manifest set by the board.
2022-04-04rp2: Enable ucryptolib, using mbedtls for backend functions.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-04extmod/extmod.cmake: Add micropy_lib_mbedtls component.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-04stm32/Makefile: Allow overriding COPT in Makefile.Andrew Leech
It can now be set in mpconfigboard.mk (as well as the make command line).
2022-04-04docs/reference/mpremote: Add details about mount usage over soft reboot.Andrew Leech
2022-04-04tools/mpremote: Improve reliability of mount after soft reboot.Andrew Leech
With the existing code problems can occur with remounting, the "if t - t_last_activity > QUIET_TIMEOUT:" check can be triggered early before the REPL string comes through, meaning that the remount doesn't happen. On certain boards the "MPY: soft reboot" line comes through immediately (getting the routine past initial timeout) but then there's a slightly longer delay while the board restarts before it prints out the startup header and the REPL prompt. This commit adds some extra pattern monitoring during the timeout loop to track the state if a soft restart is actually started.
2022-04-04drivers/codec: Add driver for the WM8960 codec.robert-hh
This codec is assembled for the MIMXRT1xxx_DEV boards and available for WM8960 breakout boards as well. The driver itself has been tested as working with the MIMXRT boards and a Sparkfun WM6890 breakout board. It implements the initialization, basic methods and some enhanced methods like 3D, ALC, soft-mute and deemphasis.
2022-04-04docs: Add quickref and docs for mimxrt, including network.LAN docs.robert-hh
2022-04-02tests/pyb: Update CAN tests to match revised CAN API.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-02docs/library/pyb.CAN: Update CAN docs to match revised API.iabdalkader
2022-04-02stm32/pyb_can: Replace CAN.initfilterbanks with CAN.init keyword arg.iabdalkader
The CAN.initfilterbanks() class method is removed, and its functionality is replaced with the "num_filter_banks" keyword argument to the CAN constructor and CAN.init(). This configures the filter bank split. This new approach provides more flexibility configuring the resources used by a given CAN instance, allowing other MCUs like H7 to fit the API. It also brings CAN closer to how other machine peripherals are configured, where everything is done in the constructor/init method. This is a breaking change to the CAN API.
2022-04-02stm32/pyb_can: Define the maximum bit timing parameters.iabdalkader
Define the maximum parameters for CAN/FDCAN nominal bit timing, and for FDCAN data bit timing, for bit timing calculations.
2022-04-02stm32/pyb_can: Return the filter ID and type of received messages.iabdalkader
CAN.recv() now returns a 5-tuple, with the new element in the second position being a boolean, True if the ID is extended. This is a breaking change of the API for CAN.recv().
2022-04-02stm32/pyb_can: Add support for bus with mixed Classic/FD nodes.iabdalkader
A CAN bus can have mixed classic/FD nodes. Prior to this patch the CAN API could be configured for either standard or extended ID, but not both/mixed operation. This patch allows extended IDs to be filtered and enabled on a per-message basis, in send(), setfilter() and clearfilter(). This is a breaking change to the API: init() no longer accepts the extframe keyword argument.
2022-04-02stm32/pyb_can: Add support for CAN FD extended frame ID.iabdalkader
2022-04-02stm32/pyb_can: Enable CAN FD frame support and BRS.iabdalkader
- Enable CAN FD frame support and BRS. - Optimize the message RAM usage per FDCAN instance. - Document the usage and different sections of the Message RAM.
2022-04-01py/makeqstrdefs: Cleanup and extend source file classification.Daniel Jour
- The classification of source files in makeqstrdefs.py has been moved into functions to consolidate the logic for that classification into a single place. - Classification of source files (into C or C++ or "other" files) is based on the filename extension. - For C++ there are many more common filename extensions than just ".cpp"; see "Options Controlling the Kind of Output" in man gcc for example. All common extensions for C++ source files which need preprocessing have been added.
2022-04-01tests/basics/fun_callstardblstar: Add test for large arg allocation.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-01py/runtime: Remove unnecessary check for kw_value == MP_OBJ_NULL.Damien George
The values are always real objects, only the key can be MP_OBJ_NULL to indicate a **kwargs entry. Signed-off-by: Damien George <damien@micropython.org>
2022-04-01py: Fix compiling and decoding of *args at large arg positions.Damien George
There were two issues with the existing code: 1. "1 << i" is computed as a 32-bit number so would overflow when executed on 64-bit machines (when mp_uint_t is 64-bit). This meant that *args beyond 32 positions would not be handled correctly. 2. star_args must fit as a positive small int so that it is encoded correctly in the emitted code. MP_SMALL_INT_BITS is too big because it overflows a small int by 1 bit. MP_SMALL_INT_BITS - 1 does not work because it produces a signed small int which is then sign extended when extracted (even by mp_obj_get_int_truncated), and this sign extension means that any position arg after *args is also treated as a star-arg. So the maximum bit position is MP_SMALL_INT_BITS - 2. This means that MP_OBJ_SMALL_INT_VALUE() can be used instead of mp_obj_get_int_truncated() to get the value of star_args. These issues are fixed by this commit, and a test added. Signed-off-by: Damien George <damien@micropython.org>
2022-03-31py/emitbc: Assert that a small int fits its encoding when emitting one.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-03-31py/runtime: Use size_t/ssize_t instead of uint/int.David Lechner
This replaces instances of uint with size_t and int with ssize_t in the mp_call_prepare_args_n_kw_var() function since all of the variables are used as array offsets. Also sort headers while we are touching this. Signed-off-by: David Lechner <david@pybricks.com>
2022-03-31tests/basics/fun_callstardblstar: Add coverage test.David Lechner
This fixes code coverage for the case where a *arg without __len__ is unpacked and uses exactly the amount of memory that was allocated for kw args. This triggers the code branch where the memory for the kw args gets reallocated since it was used already by the *arg unpacking. Signed-off-by: David Lechner <david@pybricks.com>
2022-03-31py/runtime: Drop new_alloc < 4 check.David Lechner
To reach this check, n_kw has to be >= 1 and therefore args2_alloc has to be >= 2. Therefore new_alloc will always be >= 4. So this check will never be true and can be removed. Signed-off-by: David Lechner <david@pybricks.com>
2022-03-31py/runtime: Do not overallocate when len is known.David Lechner
This fixes overallocating an extra mp_obj_t when the length of *args and **args is known. Previously we were allocating 1 mp_obj_t for each n_args and n_kw plus the length of each *arg and **arg (if they are known). Since n_args includes *args and n_kw includes **args, this was allocating an extra mp_obj_t in addition to the length of these args when unpacked. To fix this, we just subtract 1 from the length to account for the 1 already implicitly allocated by n_args and n_kw. Signed-off-by: David Lechner <david@pybricks.com>
2022-03-31py/runtime: Allow multiple *args in a function call.David Lechner
This is a partial implementation of PEP 448 to allow unpacking multiple star args in a function or method call. This is implemented by changing the emitted bytecodes so that both positional args and star args are stored as positional args. A bitmap is added to indicate if an argument at a given position is a positional argument or a star arg. In the generated code, this new bitmap takes the place of the old star arg. It is stored as a small int, so this means only the first N arguments can be star args where N is the number of bits in a small int. The runtime is modified to interpret this new bytecode format while still trying to perform as few memory reallocations as possible. Signed-off-by: David Lechner <david@pybricks.com>
2022-03-31py/runtime: Allow multiple **args in a function call.David Lechner
This is a partial implementation of PEP 448 to allow multiple ** unpackings when calling a function or method. The compiler is modified to encode the argument as a None: obj key-value pair (similar to how regular keyword arguments are encoded as str: obj pairs). The extra object that was pushed on the stack to hold a single ** unpacking object is no longer used and is removed. The runtime is modified to decode this new format. Signed-off-by: David Lechner <david@pybricks.com>
2022-03-31py/vm: Prevent array bound warning when using -MP_OBJ_ITER_BUF_NSLOTS.Damien George
This warning can happen on clang 13.0.1 building mpy-cross: ../py/vm.c:748:25: error: array index -3 refers past the last possible element for an array in 64-bit address space containing 64-bit (8-byte) elements (max possible 2305843009213693952 elements) [-Werror,-Warray-bounds] sp[-MP_OBJ_ITER_BUF_NSLOTS + 1] = MP_OBJ_NULL; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Using pointer access instead of array access works around this warning. Fixes issue #8467. Signed-off-by: Damien George <damien@micropython.org>
2022-03-30py/emitnative: Don't store prelude at end of machine code if not needed.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-03-30py/asmxtensa: Fix use of l32i/s32i when offset won't fit in encoding.Damien George
This commit adds optimised l32i/s32i functions that select the best load/ store encoding based on the size of the offset, and uses the function when necessary in code generation. Without this, ASM_LOAD_REG_REG_OFFSET() could overflow the word offset (using a narrow encoding), for example when loading the prelude from the constant table when there are many (>16) constants. Fixes issue #8458. Signed-off-by: Damien George <damien@micropython.org>
2022-03-30py/compile: Only show raw code that is bytecode.Damien George
Signed-off-by: Damien George <damien@micropython.org>