summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-06-30rp2/modmachine: Implement lightsleep() with optional sleep period.Damien George
This gets basic machine.lightsleep([n]) behaviour working on the rp2 port. It supports: - Calling lightsleep without a specified period, in which case it uses xosc dormant mode. There's currently no way to wake it up from this state, unless you write to raw registers to enable a GPIO wake up source. - Calling lightsleep with a period n in milliseconds. This period must be less than about 72 minutes and uses timer alarm3 to wake it up. The RTC continues to run during lightsleep, but other peripherals have their clock turned off during the sleep. It doesn't yet support longer periods than 72 minutes, or waking up from GPIO IRQ. Measured current consumption from the USB port on a PICO board is about 1.5mA when doing machine.lightsleep(5000), and about 0.9mA when doing machine.lightsleep(). Addresses issue #8770. Signed-off-by: Damien George <damien@micropython.org>
2022-06-29tests/micropython: Add test for builtin execfile() function.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-06-29unix/variants/dev: Allow all config options to be overridden.Damien George
They can be overridden on the make command line, for example. Signed-off-by: Damien George <damien@micropython.org>
2022-06-29unix/variants/coverage: Change config to use ROM level everything.Damien George
This ROM level is not yet fully defined, but it at least enables MICROPY_PY_SYS_TRACEBACKLIMIT. The coverage build should have everything enabled, so it makes sense to use this ROM level for it. Signed-off-by: Damien George <damien@micropython.org>
2022-06-29unix/variants: Enable remaining options on dev,coverage from ROM extra.Damien George
So that the default configuration for the dev and coverage variants includes all options set by MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES. Note that enabling MICROPY_PY_SYS_STDIO_BUFFER on unix doesn't do anything because unix doesn't use shared/runtime/sys_stdio_mphal.c. Signed-off-by: Damien George <damien@micropython.org>
2022-06-29unix/variants: Move setting of MICROPY_PY_USELECT to port config file.Damien George
The default is the same as before: MICROPY_PY_USELECT=0 and MICROPY_PY_USELECT_POSIX=1. But now this can be easily overridden at the make command-line using, eg: make VARIANT=dev CFLAGS_EXTRA=-DMICROPY_PY_USELECT=1 Signed-off-by: Damien George <damien@micropython.org>
2022-06-28py/builtinhelp: Don't show help for an MP_MODULE_ATTR_DELEGATION_ENTRY.Damien George
Otherwise it can lead to a crash. Fixes issue #8816. Signed-off-by: Damien George <damien@micropython.org>
2022-06-28tests: Fix run-perfbench parsing "no matching params" case.Angus Gratton
Signed-off-by: Angus Gratton <gus@projectgus.com>
2022-06-28tests: Add an explanation of run-perfbench.py.Angus Gratton
Also changes this file to a Markdown file. Signed-off-by: Angus Gratton <gus@projectgus.com>
2022-06-28esp32/network_wlan: Don't raise exception when scan returns no results.Damien George
Prior to this commit, running scan() without any APs available would give: >>> wl.scan() Traceback (most recent call last): File "<stdin>", line 1, in <module> RuntimeError: Wifi Unknown Error 0x0102 Signed-off-by: Damien George <damien@micropython.org>
2022-06-28stm32/boards: Enable LTO by default on boards with smaller flash size.Angus Gratton
Signed-off-by: Angus Gratton <gus@projectgus.com>
2022-06-28tests/perf_bench: Add some configurations for N=32, M=10.Angus Gratton
For STM32L072 and similar, very low end targets. The other perf_bench tests run out of memory, crash, or fail on prerequisite features. Signed-off-by: Angus Gratton <gus@projectgus.com>
2022-06-28stm32/Makefile: Enable link-time-optimisation via LTO=1 make option.Angus Gratton
When tested, this reduces default MP binary sizes by approx 2-2.5%, and very marginally increases performance in benchmarks. Build times seem very similar to non-LTO when using gcc 12. See #8733 for further discussion. Signed-off-by: Angus Gratton <gus@projectgus.com>
2022-06-28stm32: Use a separate symbol name for the bootloader state pointer.Angus Gratton
Prerequisite for enabling Link Time Optimisation. The _bl_state address is the same as _estack, but _estack is referred to as a uint32_t elsewhere in the code. LTO doesn't like it when the same symbol has two different types. Signed-off-by: Angus Gratton <gus@projectgus.com>
2022-06-27py/builtin: Remove unnecessary module declarations.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-06-25py/objfun: Support function attributes on native functions.Damien George
Native functions can just reuse the bytecode function attribute code. Signed-off-by: Damien George <damien@micropython.org>
2022-06-24tests/basics: Add tests for __name__ and __globals__ attrs on closures.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-06-24py/objclosure: Forward function attributes for closures.Michael Bentley
Add .attr attribute which forwards to self->fun. A closure is intended to wrap around a function object, so forward any requested attributes to the wrapped function object. Signed-off-by: Michael Bentley <mikebentley15@gmail.com>
2022-06-24stm32/usb: Expose USB HID device instance via usbd_hid_get().Koen De Vleeschauwer
This is needed to implement a HID device in user C modules.
2022-06-24docs/library/bluetooth: Add link to aioble.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-06-24mimxrt/boards: Remove conditional assignment of flash type/size.Philipp Ebensberger
Removes conditional assignment because respective variables should only be set in board makefile fragments. Hence no conditional assignment needed.
2022-06-24mimxrt/Makefile: Fix some minor formatting inconsistencies.Philipp Ebensberger
2022-06-24mimxrt/Makefile: Rework floating point config.Philipp Ebensberger
Reworks source file and compile flags selection for floating point support.
2022-06-24mimxrt/Makefile: Rework board flash type handling.Philipp Ebensberger
Reworks handling and configuration of different board flash types in the Makefile, linker scripts and board makefile fragments.
2022-06-24mimxrt/Makefile: Modify handling of SDCARD option.Philipp Ebensberger
Removes separate `if` case in Makefile for setting SDCARD option define.
2022-06-24mimxrt/Makefile: Modify handling of SDRAM option.Philipp Ebensberger
Replaces preprocessor macro for SDRAM option from #ifdef to #if in order to allow always setting the define `MICROPY_HW_SDRAM_AVAIL` just with the appropriate value 0/1. This eliminates one `if` in the Makefile.
2022-06-24mimxrt/Makefile: Refactor Makefile and divide it into sections.Philipp Ebensberger
Reworks grouping of Makefile variables and reorders variable values in alphabetic order.
2022-06-24extmod/uasyncio: Implement stream read(-1) to read all data up to EOF.Damien George
Fixes issue #6355. Signed-off-by: Damien George <damien@micropython.org>
2022-06-24tests/extmod: Add heap-lock test for stream writing.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-06-24extmod/uasyncio: Attempt to write immediately in Stream.write method.Thorsten von Eicken
The main aim of this change is to reduce the number of heap allocations when writing data to a stream. This is done in two ways: 1. Eliminate appending of data when .write() is called multiple times before calling .drain(). With this commit, the data is written out immediately if the underlying stream is not blocked, so there is no accumulation of the data in a temporary buffer. 2. Eliminate copying of non-bytes objects passed to .write(). Prior to this commit, passing a bytearray or memoryview to .write() would always result in a copy of it being made and turned into a bytes object. That won't happen now if the underlying stream is not blocked. Also, this change makes .write () more closely implement the CPython documented semantics: "The method attempts to write the data to the underlying socket immediately. If that fails, the data is queued in an internal write buffer until it can be sent."
2022-06-23esp32/modesp32: Add wake_on_ulp() so ULP can wake CPU from deepsleep.Christian Walther
Add esp32.wake_on_ulp() to give access to esp_sleep_enable_ulp_wakeup(), which is needed to allow the ULP co-processor to wake the main CPU from deep sleep.
2022-06-23esp32/boards: Increase 512 bytes limit on ULP programs to 2040.Christian Walther
Allow esp32.ULP.load_binary() to use the maximum amount of memory available again, which is 2040 bytes unless MICROPY_HW_RTC_USER_MEM_MAX is customized. This value regressed in 3d49b157b89a59774fc4958dcaacd2c96ba6eaa4
2022-06-23esp32/machine_uart: Implement the functionality of timeout_char arg.robert-hh
Using it for the rx-timeout. The value is given as ms, which is then converted to character times. A value of less than a character time will cause the rx call to return immediately after 1 character, which may be inefficient at high transmission rates. Addresses #8778.
2022-06-23nrf: Enable optional support for Arduino 1200bps touch.iabdalkader
Individual boards must enable it via MICROPY_HW_USB_CDC_1200BPS_TOUCH.
2022-06-23rp2/boards/ARDUINO_NANO_RP2040_CONNECT: Enable Arduino 1200bps touch.iabdalkader
2022-06-23shared/runtime/tinyusb_helpers: Add TinyUSB helper functions.iabdalkader
Currently this file only includes a CDC jump-to-bootloader helper function.
2022-06-23stm32/usbd_cdc_interface: Add support for Arduino 1200bps touch.iabdalkader
If the serial port is closed with baudrate at 1200 then the board will enter its bootloader.
2022-06-23esp8266/mpconfigport: Disable MICROPY_PY_UTIMEQ.Damien George
This is no longer needed with new uasyncio v3, and disabling it saves 900 bytes. Signed-off-by: Damien George <damien@micropython.org>
2022-06-23esp8266/mpconfigport: Switch to ROM feature level configuration.Damien George
This is a no-op in terms of board configuration. Signed-off-by: Damien George <damien@micropython.org>
2022-06-23py/parsenum: Optimise when building with complex disabled.Damien George
To reduce code size when MICROPY_PY_BUILTINS_COMPLEX is disabled. Signed-off-by: Damien George <damien@micropython.org>
2022-06-23py/parsenum: Fix parsing of complex "j" and also "nanj", "infj".Damien George
Prior to this commit, complex("j") would return 0j, and complex("nanj") would return nan+0j. This commit makes sure "j" is tested for after parsing the number (nan, inf or a decimal), and also supports the case of "j" on its own. Signed-off-by: Damien George <damien@micropython.org>
2022-06-23py/parsenum: Support parsing complex numbers of the form "a+bj".Jim Mussared
To conform with CPython. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-06-21docs/library/uasyncio: Consistently use "uasyncio" instead of "asyncio".Luiz Brandao
2022-06-21docs/library/machine: Add note on interrupts being critical to system.Patrick Joy
2022-06-21docs: Set LaTeX engine to XeLaTeX for PDF generation.Stewart C. Russell
Also added to suggested packages list for PDF build. See comment in Sphinx project for (some) details: https://github.com/sphinx-doc/sphinx/pull/5693#pullrequestreview-180444650
2022-06-21docs/library: Remove unnecessary "pyb." prefix on class names.Damien George
Otherwise these classes are refered to with a double prefix, like pyb.pyb.ADC. Signed-off-by: Damien George <damien@micropython.org>
2022-06-21docs/library/pyb.Timer: Document `brk` argument and its constants.Howard Lovatt
2022-06-21extmod/modbtree: Use buffer protocol for keys/values.David Lechner
This changes the btree implementation to use the buffer protocol for reading key/values in all methods. `str` and `bytes` objects are not the only bytes-like objects that could be used. Documentation and tests are also updated. Addresses issue #8748. Signed-off-by: David Lechner <david@pybricks.com>
2022-06-21extmod/extmod.mk: Separate out extmod file list from py.mk to extmod.mk.David Lechner
This separates extmod source files from `py.mk`. Previously, `py.mk` assumed that every consumer of the py/ directory also wanted to include extmod/. However, this is not the case. For example, building mpy-cross uses py/ but doesn't need extmod/. This commit moves all extmod-specific items from `py.mk` to `extmod.mk` and explicitly includes `extmod.mk` in ports that use it. Signed-off-by: David Lechner <david@pybricks.com>
2022-06-20extmod/extmod.cmake: Only include modbtree in build if it's enabled.Damien George
Following how it's done in extmod.mk. Signed-off-by: Damien George <damien@micropython.org>