summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-04-28py/modsys: Introduce sys.implementation._machine constant.Damien George
This contains a string useful for identifying the underlying machine. This string is kept consistent with the second part of the REPL banner via the new config option MICROPY_BANNER_MACHINE. This makes os.uname() more or less redundant, as all the information in os.uname() is now available in the sys module. Signed-off-by: Damien George <damien@micropython.org>
2022-04-28py/modsys: Rename sys.implementation.mpy to sys.implementation._mpy.Damien George
Per CPython docs, non-standard attributes must begin with an underscore. Signed-off-by: Damien George <damien@micropython.org>
2022-04-28py/modsys: Append MicroPython git version and build date to sys.version.Damien George
This commit adds the git hash and build date to sys.version. This is allowed according to CPython docs, and is what PyPy does. The docs state: A string containing the version number of the Python interpreter plus additional information on the build number and compiler used. Eg on CPython: Python 3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.version '3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0]' and PyPy: Python 2.7.12 (5.6.0+dfsg-4, Nov 20 2016, 10:43:30) [PyPy 5.6.0 with GCC 6.2.0 20161109] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>> import sys >>>> sys.version '2.7.12 (5.6.0+dfsg-4, Nov 20 2016, 10:43:30)\n[PyPy 5.6.0 with GCC ... With this commit on MicroPython we now have: MicroPython v1.18-371-g9d08eb024 on 2022-04-28; linux [GCC 11.2.0] v... Use Ctrl-D to exit, Ctrl-E for paste mode >>> import sys >>> sys.version '3.4.0; MicroPython v1.18-371-g9d08eb024 on 2022-04-28' Note that the start of the banner is the same as the end of sys.version. This helps to keep code size under control because the string can be reused by the compiler. Signed-off-by: Damien George <damien@micropython.org>
2022-04-28stm32/boards/NUCLEO_G0B1RE: Add NUCLEO_G0B1RE board definition.Asensio Lorenzo Sempere
This commit adds a board definition for NUCLEO_G0B1RE. This board has the REPL on UART2 which is connected to the on-board ST-link USB-UART. Signed-off-by: Asensio Lorenzo Sempere <asensio.aerospace@gmail.com>
2022-04-28stm32: Add support for G0 MCUs.Asensio Lorenzo Sempere
This commit adds support for the STM32G0 series of MCUs. Signed-off-by: Asensio Lorenzo Sempere <asensio.aerospace@gmail.com>
2022-04-28stm32/storage: Add support for internal storage on Cortex-M0 MCUs.Asensio Lorenzo Sempere
This implements self-triggering of the Flash NVIC interrupt on Cortex-M0 devices, which allows enabling internal storage on those MCUs. Signed-off-by: Asensio Lorenzo Sempere <asensio.aerospace@gmail.com>
2022-04-28lib/stm32lib: Update library for G0 v1.5.1.Damien George
Changes in this new library version are: - Add G0 HAL at v1.5.1. Signed-off-by: Damien George <damien@micropython.org>
2022-04-28stm32/boards/ARDUINO_PORTENTA_H7: Add support for Arduino Portenta H7.iabdalkader
2022-04-28stm32/ulpi: Include missing py/mperrno.h header.iabdalkader
2022-04-26stm32/ulpi: Add USB3320 ULPI low-power functions.iabdalkader
This driver allows switching USB3320 ULPI to low-power mode. It is ported/ adapted from ST code, stm32f7xx_lp_modes.c, which is BSD-3 licensed code.
2022-04-26stm32/qspi: Workaround for SR set immediately after setting AR.iabdalkader
See issue #5441. This issue is now reproducible on the Arduino Portenta H747, QSPI flash PN MX25L12833F.
2022-04-26stm32/qspi: Wait for a free FIFO location before writing to DR.iabdalkader
Must always check the FIFO before writing to DR. Without this, this function hangs on the H747.
2022-04-26stm32/qspi: Support common flash sizes in MPU configuration.iabdalkader
Add MPU configuration for common flash sizes up to 256MiB.
2022-04-26rp2/mpconfigport: Enable execfile, NotImplemented and REPL EMACS keys.Damien George
To bring this port in line with other ports that use MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES. Signed-off-by: Damien George <damien@micropython.org>
2022-04-22esp32/modnetwork: Fix build when MICROPY_PY_NETWORK_WLAN is disabled.Damien George
Fixes issue #8541. Signed-off-by: Damien George <damien@micropython.org>
2022-04-22esp32/network_wlan: Support setting/getting txpower in WLAN.config().wemos
2022-04-22docs/library/network.WLAN: Add "txpower" to list of known WLAN configs.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-22tests/cmdline: Add test for REPL auto-indent.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-22shared/readline: Disable auto-indent if space/tab follows added indent.Damien George
Auto-indent still works as the default behaviour, but it is now undone and disabled if there is a space/tab immediately after an automatically-added indent. This makes the REPL behaviour closer to CPython, and in particular allows text to be pasted at the normal REPL. Addresses issue #7925. Signed-off-by: Damien George <damien@micropython.org>
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>