summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-04-22shared/readline: Make tab insert an indent when it follows whitespace.Damien George
Entering tab at the REPL will now make it insert an indent (4 spaces) in the following cases: - after any whitespace on a line - at the start of a line that is not the first line This changes the existing behaviour where a tab would insert an indent only if there were no matches in the auto-complete search, and it was the start of the line. This means, if there were any symbols in the global namespace, tab could never be used to indent. Note that entering tab at the start of the first line will still do auto-completion, but will now do nothing if there are no symbols in the global namespace, which is more consistent than before. Signed-off-by: Damien George <damien@micropython.org>
2022-04-22extmod/uasyncio: Rename and merge TaskQueue push/pop methods.Damien George
These are internal names and can be safely renamed without affecting user code. push_sorted() and push_head() are merged into a single push() method, which is already how the C version is implemented. pop_head() is simply renamed to pop(). The changes are: - q.push_sorted(task, t) -> q.push(task, t) - q.push_head(task) -> q.push(task) - q.pop_head() -> q.pop() The shorter names and removal of push_head() leads to a code size reduction of between 40 and 64 bytes on bare-metal targets. Signed-off-by: Damien George <damien@micropython.org>
2022-04-21extmod/uasyncio: Fix bug with task ending just after gather is cancel'd.Damien George
This fixes a bug where the gather is cancelled externally and then one of its sub-tasks (that the gather was waiting on) finishes right between the cancellation being queued and being executed. Signed-off-by: Damien George <damien@micropython.org>
2022-04-21extmod/uasyncio: Make Python Task match C version with use of asserts.Damien George
This helps to catch bugs when a Task is put on more than one pairing heap. Signed-off-by: Damien George <damien@micropython.org>
2022-04-21tests/run-tests.py: Add timeout for running PC-based MicroPython test.Damien George
So the test suite runs to completion, even if the interpreter locks up. Signed-off-by: Damien George <damien@micropython.org>
2022-04-21tools/ci.sh: Don't run uasyncio_gather test on macOS.Damien George
The timing on macOS makes this test unreliable. Signed-off-by: Damien George <damien@micropython.org>
2022-04-20tests/extmod/uasyncio_gather: Make double-raise gather test reliable.Damien George
This double-raise test could fail when task[0] raises and stops the gather before task[1] raises, then task[1] is left to raise later on and spoil the test. Signed-off-by: Damien George <damien@micropython.org>
2022-04-20top: Update .git-blame-ignore-revs for latest formatting commit.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-20ports: Reformat more C and Python source code.Damien George
These files that are reformatted only now fall under the list of files to apply uncrustify/black formatting to. Signed-off-by: Damien George <damien@micropython.org>
2022-04-20tools/codeformat.py: Include more ports .c/.h files in formatting.Damien George
This adds a rule to cover all ports/**/*.[ch] file to the code formatting list. Explicit exclusions are also added for code in ports/ which is third party, or which requires a lot of reformatting. Signed-off-by: Damien George <damien@micropython.org>
2022-04-20tools/codeformat.py: Remove ports/unix/*.py from exclusion list.Damien George
These .py files were removed from the .gitignore in commit 3c2aa5ff93a3b12723c7ca794aa9c583891c349b Signed-off-by: Damien George <damien@micropython.org>
2022-04-20stm32/boards/LEGO_HUB_NO6: Exclude BTstack code from formatting.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-20py/objtype: Convert result of user __contains__ method to bool.Jon Bjarni Bjarnason
Per https://docs.python.org/3/reference/expressions.html#membership-test-operations For user-defined classes which define the contains() method, x in y returns True if y.contains(x) returns a true value, and False otherwise. Fixes issue #7884.
2022-04-20drivers/ninaw10: Fix isconnected to return False when inactive.iabdalkader
If isconnected is called before active, it returns -1, which causes mp_obj_new_bool return True, indicating the module is connected.
2022-04-20stm32/boards/ADAFRUIT_F405_EXPRESS: Use external SPI flash for storage.iabdalkader
Fixes issue #8553.
2022-04-20stm32/mphalport: Fix I/O glitches when switching GPIO mode to alt-func.iabdalkader
To avoid any I/O glitches in mp_hal_pin_config, make sure a valid alternate function is set in AFR first before switching the pin mode. When switching from AF to INPUT or OUTPUT, the AF in AFR will remain valid up until the pin mode is switched.
2022-04-19stm32/boards/SPARKFUN_MICROMOD_STM32: Fix incorrect UART and I2C config.Chris Wilson
Based on testing with real hardware.
2022-04-15docs/reference: Update constrained docs now that tuples can be const.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-15tests/micropython: Add tests that const tuples don't use the heap.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14tools/mpy-tool.py: Intern more strings when freezing.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14tools/mpy-tool.py: Optimise freezing of str when str data is a qstr.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14tools/mpy-tool.py: Make global qstr list a dedicated class.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14tools/mpy-tool.py: Optimise freezing of empty str and bytes objects.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14tools/mpy-tool.py: Optimise freezing of ints that can fit a small int.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14qemu-arm/test-frzmpy: Add test for freezing constant tuples.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14tests/perf_bench: Update import tests for changes to .mpy consts.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14ports: Recompile bytecode tests now that .mpy format changed.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14tools/mpy-tool.py: Support freezing tuples and other consts.Damien George
This also simplifies how constants are frozen. Signed-off-by: Damien George <damien@micropython.org>
2022-04-14tools/mpy-tool.py: Support loading tuples from .mpy files.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14py/persistentcode: Support loading and saving tuples in .mpy files.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14py/parse: Add MICROPY_COMP_CONST_TUPLE option to build const tuples.Damien George
This commit adds support to the parser so that tuples which contain only constant elements (bool, int, str, bytes, etc) are immediately converted to a tuple object. This makes it more efficient to use tuples containing constant data because they no longer need to be created at runtime by the bytecode (or native code). Furthermore, with this improvement constant tuples that are part of frozen code are now able to be stored fully in ROM (this will be implemented in later commits). Code size is increased by about 400 bytes on Cortex-M4 platforms. See related issue #722. Signed-off-by: Damien George <damien@micropython.org>
2022-04-14py/parse: Print const object value in mp_parse_node_print.Damien George
To give more information when printing the parse tree. Signed-off-by: Damien George <damien@micropython.org>
2022-04-14py/parse: Factor obj extract code to mp_parse_node_extract_const_object.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14py/persistentcode: Define enum values for obj types instead of letters.Damien George
To keep the separate parts of the code that use these values in sync. And make it easier to add new object types. Signed-off-by: Damien George <damien@micropython.org>
2022-04-14esp32/modesp32: Properly define RTC_VALID_EXT_PINS on S2/S3 variants.Stephane Smith
On ESP32 S2/S3 variants, GPIO0 through GPIO21 are valid RTC pins. This commit defines the valid RTC_VALID_EXT_PINS for the S2/S3 variants, otherwise, it keeps functionality the same.
2022-04-14esp32/machine_pin: Don't expose pins 33-37 when octal SPIRAM is enabled.Stephane Smith
For ESP32-S3 configurations, CONFIG_SPIRAM_MODE_OCT requires pins 33-37 for PSRAM. So exclude them from the machine_pin_type and machine_pin_irq_type object tables.
2022-04-14esp32/boards: Compile GENERIC_SPIRAM and UM_TINYPICO with -Os.Stephane Smith
These boards do not build with IDF v4.4 because the section .iram0.text does not fit in region iram0_0_seg. Enabling SPIRAM increases the code size so use -Os instead of -O2 to build these boards. Fixes issue #8260.
2022-04-14esp32: Add MICROPY_HW_ENABLE_UART_REPL and enable on generic S2/S3.Damien George
Some S2/S3 modules don't use the native USB interface but instead have an external USB-UART. To make the GENERIC_S3/S3 firmware work on these boards the UART REPL is enabled in addition to the native USB CDC REPL. Fixes issues #8418 and #8524. Signed-off-by: Damien George <damien@micropython.org>
2022-04-14esp32/boards: Add test manifest to test freezing during build.Damien George
Includes tests for freezing @micropython.native and @micropython.viper code. Signed-off-by: Damien George <damien@micropython.org>
2022-04-14Revert "py/emitnative: Don't store prelude at end of machine code if..."Damien George
This reverts commit 7e8222ae063d78ae8f901bb0f9fef663edd2edb6. The prelude data must exist somewhere in the native code so load_raw_code and mpy-tool.py can access and parse it. Signed-off-by: Damien George <damien@micropython.org>
2022-04-14stm32/mpbthciport: Switch scheduling callback to use node scheduler.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14py/scheduler: Add support for scheduling static C-based callbacks.Damien George
If MICROPY_SCHEDULER_STATIC_NODES is enabled then C code can declare a static mp_sched_node_t and schedule a callback using mp_sched_schedule_node(). In contrast to using mp_sched_schedule(), the node version will have at most one pending callback outstanding, and will always be able to schedule if there is nothing already scheduled on this node. This guarantees that the the callback will be called exactly once after it is scheduled. Signed-off-by: Damien George <damien@micropython.org>
2022-04-12rp2/machine_uart: Use read/write mutex to prevent char duplication.Peter Hinch
Duplication of characters is caused by re-entrant calls from separate cores of uart_fill_tx_fifo(). This patch uses a mutex to ensure that a re-entrant execution of the function returns without affecting the UART FIFO. Fixes issues #8344 and #8360.
2022-04-11stm32/boards/PYBD_SFx: Allow FROZEN_MANIFEST to be overridden.Dave Hylands
Because mpconfigboard.mk used = rather then ?= it doesn't allow FROZEN_MANIFEST to be overridden using a GNUmakefile or the manifest.
2022-04-11stm32/system_stm32: Improve H7 PLL and OSC configuration.iabdalkader
- Allow boards to configure CSI, HSI48 and PLL2. - Allow peripheral clock source configuration. - Set H7 SYSCLKSource.
2022-04-11stm32/system_stm32: Allow boards to configure PLL VCI, VCO and FRACN.iabdalkader
This removes hard-coded PLL1/3 VCI, VCO and FRACN.
2022-04-11stm32/system_stm32: Set voltage scaling level 0 for H7 Rev-V devices.iabdalkader
This enables voltage scaling level 0 for H7 Rev-V devices, which allows the CPU to run at the maximum supported operating frequency (480MHz).
2022-04-11stm32/system_stm32: Add H7 switched-mode-power-supply support.iabdalkader
- Add board-level configuration option to set the SMPS supply mode. - Wait for valid voltage levels after configuring the SMPS mode. - Wait for external supply ready flag if SMPS supplies external circuitry.
2022-04-11stm32/Makefile: Add H747 to Makefile's MCU flags.iabdalkader
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.