summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-11-03stm32/boards/make-pins.py: Don't generate qstrs.Jim Mussared
Qstrs are picked up from the generated pin source files in the usual qstr processing stage. Similarly for the stm constant qstrs. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-11-03rp2/boards/make-pins.py: Don't generate qstrs.Jim Mussared
Also remove af-const header, as this is left over from the STM32 version and unused. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-11-03py/mkrules.mk: Add rule for compiling auto-generated source files.Jim Mussared
This prevents each port Makefile from having to add an explicit rule for `build-BOARD/pins_BOARD.c`. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-11-03top: Update .git-blame-ignore-revs for latest formatting commit.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-11-03all: Update Python formatting to ruff-format.Jim Mussared
This updates a small number of files that change with ruff-format's (vs black's) rules. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-11-03all: Replace "black" with "ruff format".Jim Mussared
- Add config for [tool.ruff.format] to pyproject.toml. - Update pre-commit to run both ruff and ruff-format (and only check C files when running codeformat.py) - Update CI. - Simplify codeformat.py to remove all the Python-specific logic (just run "ruff format" directly). This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-11-01lib/littlefs: Update LittleFS to v2.8.1.Daniël van de Giessen
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2023-11-01esp32/usb: Wake main thread when USB receives data.Andrew Leech
This improves (decreases) the latency on stdin, on SoCs with built-in USB and using TinyUSB, like S2 and S3. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-11-01esp32/mphalport: Add function to wake main from separate FreeRTOS task.Andrew Leech
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-11-01esp32: Use better build settings for ESP32-C3.Alessandro Gatti
ESP32-C3 is not Xtensa-based, so build settings are now tailored a bit better following that fact. ESP-IDF 5.x already adds architecture-specific modules by itself so there is no need to specify either the `xtensa` or the `riscv` module in the build settings. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2023-11-01esp32/boards: Reduce size of D2WD and OTA firmware.Damien George
Commit c4e63ace661df9748cfae451bde7781e61e0b3d9 enabled the SPI Ethernet driver and that cost about 13k of firwmare size, pushing the firmware over the limit of the D2WD and OTA board variants available size. To fix, disable SPI Ethernet on the D2WD variant, and build the OTA variant with size optimisation rather than performance optimisation. Signed-off-by: Damien George <damien@micropython.org>
2023-10-31extmod: Remove empty utime_mphal.h file.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-10-31teensy: Remove the teensy port.Jim Mussared
This port is largely unmaintained, has limited features (the only hardware support is for GPIO and timer, and no machine module), only supports a small number of Teensy boards, and can be confused with the mimxrt support for Teensy 4.x. Signed-off-by: Jim Mussared <jim.mussared@gmail.com> Signed-off-by: Damien George <damien@micropython.org>
2023-10-31esp32/modmachine: Fix deepsleep() when previous sleep delay was set.Pascal Brunot
Fixes issue #7158. Signed-off-by: Pascal Brunot <pascal.brunot@gmail.com>
2023-10-31esp32/network_lan: Register the hostname setting for Ethernet.robert-hh
Fixes issue #12817. Signed-off-by: robert-hh <robert@hammelrath.com>
2023-10-31esp32/network_lan: Fix LAN.isconnected().robert-hh
nic.isconnected() returns now "True", if a) the physical link is up and b) an IP address is assigned. The latter happens often by DHCP, in which case an active connection can be assumed. If the IP address is set manually, nic.isconnected() would report "True" as well, if at least the physical link is up. This matches WLAN behaviour which returns "True" when the WLAN has an IP address. Before, the behaviour of nic.isconneceted() was erratic, returning "True" sometimes even without a Ethernet cable attached. Fixes issue #12741. Signed-off-by: robert-hh <robert@hammelrath.com>
2023-10-31esp32/network_lan: Fix and simplify the code for ETH-SPI devices.robert-hh
SPI support was not enabled, and was not adapted for esp-idf v5.x. This change enables SPI ethernet for all boards and adapts the code for esp-idf v5.x. The change follows the sample implementation of @hemakumarm72, but adds the changes for the other adapters as well. Further, it simplifies the code by removing actions from netwwork_lan.c which are done in the esp-idf drivers later, like setting the default values for .command_bits and .address_bits, and registering the SPI interface. Tested with a Wiznet W5500 breakout. Signed-off-by: robert-hh <robert@hammelrath.com>
2023-10-31esp32/boards: Disable ALPN support.Daniël van de Giessen
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2023-10-31esp32/network_ppp: Reduce PPP thread CPU usage.Daniël van de Giessen
Reduces the CPU usage by the PPP thread by sleeping for one tick if there was nothing to read; preventing the loop using 100% CPU when the read operation has a zero timeout and immediately returns. Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2023-10-31esp32/machine_uart: Add error checking for IDF API's.Daniël van de Giessen
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2023-10-31esp32/mpconfigport: Remove port-specific GAP name.Daniël van de Giessen
Instead use the generic default defined in modbluetooth_nimble.c. This then also allows custom boards to easily override the default Bluetooth GAP name. Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2023-10-31esp32: Poll serial/JTAG for unread data to prevent blocking.Daniël van de Giessen
If data is pushed over serial/JTAG too fast we may fill up stdin_ringbuf and not be able to read all the data out of the serial/JTAG buffer. Thus we need to explicitly poll and read the serial/JTAG RX buffer to prevent blocking (since if the serial/JTAG buffer is already filled, we will not get another interrupt to transfer it to the stdin ringbuffer). Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2023-10-31esp32/network_ppp: Allow building with IPv6 disabled.Alessandro Gatti
PPP code assumes that IPv6 support is enabled. Whilst this is the default, certain applications may want to disable IPv6 support if not needed (or to reduce code size). This makes the code build with CONFIG_LWIP_IPV6 disabled, reducing code by about 30k in that case. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2023-10-30esp32/boards: Update UM board settings to use custom PID/VID.Seon Rozenblum
Signed-off-by: Seon Rozenblum <seon@unexpectedmaker.com>
2023-10-30esp32/boards/UM_TINYWATCHS3: Add new UM TinyWATCH S3 board.Seon Rozenblum
Signed-off-by: Seon Rozenblum <seon@unexpectedmaker.com>
2023-10-30py/qstr: Add support for sorted qstr pools.Jim Mussared
This provides a significant performance boost for qstr_find_strn, which is called a lot during parsing and loading of .mpy files, as well as interning of string objects (which happens in most string methods that return new strings). Also adds comments to explain the "static" qstrs. These are part of the .mpy ABI and avoid needing to duplicate string data for QSTRs known to already be in the firmware. The static pool isn't currently sorted, but in the future we could either split the static pool into the sorted regions, or in the next .mpy version just sort them. Based on initial work done by @amirgon in #6896. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-30bare-arm/lib: Add minimal strncmp implementation.Jim Mussared
Required by upcoming qstr sorting. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-30tests/extmod/asyncio_as_uasyncio.py: Fix qstr order dependency.Jim Mussared
This test depends on the order in which qstrs are stored in ROM, which affects the order in which `dir()` will probe the object to see what it supports. Because of the lazy-loading in asyncio/__init__.py, if it tries to do e.g. `wait_for_ms` before `funcs` then it will import funcs, making `funcs` later succeed. But in the other way around, `funcs` will initially not be found. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-27tests/perf_bench: Add string/qstr/map tests.Jim Mussared
These tests are designed to measure changes in performance relating to: - string interning / searching for existing strings - map lookup - string operations - string hashing This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-27extmod/network_ninaw10: Fix select flags handling in socket poll.iabdalkader
The flags returned from `select()` were misinterpreted to mean an error had occurred for the socket, when it's actually just an exceptional condition for the socket, such as OOB data. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-10-27py/asm{arm,thumb,x64,x86,xtensa}: Remove unused macros.Alessandro Gatti
`ASM_MOV_REG_IMM_FIX_U16` and `ASM_MOV_REG_IMM_FIX_WORD` are no longer used anywhere in the code. See discussion in #12771. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2023-10-27docs/reference/micropython2_migration: Add migration guide.Jim Mussared
This is just scaffolding for now, but the idea is that there should be an addition to this file for every commit that uses the `MICROPY_PREVIEW_VERSION_2` macro. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-27py/mkrules.mk: Add MICROPY_PREVIEW_VERSION_2.Jim Mussared
This provides a way to enable features and changes slated for MicroPython 2.x, by running `make MICROPY_PREVIEW_VERSION_2=1`. Also supported for the cmake ports (except Zephyr). This is an alternative to having a 2.x development branch (or equivalently, keeping a 1.x release branch). Any feature or change that needs to be "hidden" until 2.x can use this flag (either in the Makefile or the preprocessor). A good example is changing function arguments or other public API features, in particular to aid in improving consistency between ports. When `MICROPY_PREVIEW_VERSION_2` is enabled, the REPL banner is amended to say "MicroPython (with v2.0 preview) vX.Y.Z", and sys.implementation gets a new field `_v2` set to `True`. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-26extmod/modmachine: Consolidate mem, i2c and spi headers to modmachine.h.Damien George
The contents of machine_mem.h, machine_i2c.h and machine_spi.h have been moved into extmod/modmachine.h. Signed-off-by: Damien George <damien@micropython.org>
2023-10-26nrf/modules/machine: Use SPI Python bindings provided by extmod.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-10-26extmod/modmachine: Consolidate simple machine headers into modmachine.h.Damien George
The contents of machine_bitstream.h, machine_pinbase.h, machine_pulse.h and machine_signal.h have been moved into extmod/modmachine.h. Signed-off-by: Damien George <damien@micropython.org>
2023-10-26extmod/modmachine: Clean up decls of machine types to use common ones.Damien George
The machine_i2c_type, machine_spi_type and machine_timer_type symbols are already declared in extmod/modmachine.h and should not be declared anywhere else. Also move declarations of machine_pin_type and machine_rtc_type to the common header in extmod. Signed-off-by: Damien George <damien@micropython.org>
2023-10-26extmod/machine_uart: Factor ports' UART Python bindings to common code.Damien George
This is a code factoring to have the Python bindings in one location, and all the ports use those same bindings. For all ports except the two listed below there is no functional change. The nrf port has UART.sendbreak() removed, but this method previously did nothing. The zephyr port has the following methods added: - UART.init(): supports setting timeout and timeout_char. - UART.deinit(): does nothing, just returns None. - UART.flush(): raises OSError(EINVAL) because it's not implemented. - UART.any() and UART.txdone(): raise NotImplementedError. Signed-off-by: Damien George <damien@micropython.org>
2023-10-23extmod/machine_adc: Factor ports' ADC Python bindings to common code.Damien George
No functional change, just code factoring to have the Python bindings in one location, and all the ports use those same bindings. Signed-off-by: Damien George <damien@micropython.org>
2023-10-23nrf/boards: Automatically configure MICROPY_PY_MACHINE_PWM.Damien George
This commit makes it so that MICROPY_PY_MACHINE_PWM is enabled if at least one of MICROPY_PY_MACHINE_HW_PWM and/or MICROPY_PY_MACHINE_SOFT_PWM are enabled. This simplifies the configuration for boards, and fixes DVK_BL652 which enabled PWM without selecting software or hardware implementations. With this change, DVK_BL652 and EVK_NINA_B1 now enable (hardware) PWM. Signed-off-by: Damien George <damien@micropython.org>
2023-10-23py/makeqstrdefs.py: Print a nicer error when preprocessing stage fails.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-10-20extmod/machine_i2s: Factor comments, some enums and macros.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-10-20extmod/machine_i2s: Factor init_helper argument parsing.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-10-20extmod/machine_i2s: Factor print function.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-10-20extmod/machine_i2s: Factor I2S.irq method.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-10-20extmod/machine_i2s: Factor I2S.shift method.Damien George
It's exactly the same for all four port implementations. Signed-off-by: Damien George <damien@micropython.org>
2023-10-20extmod/machine_i2s: Factor stream and ring-buf code.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-10-20extmod/machine_i2s: Factor ports' I2S Python bindings to common code.Damien George
This factors the basic top-level I2S class code from the ports into extmod/machine_i2s.c: - I2S class definition and method table. - The init and deinit method wrappers. - The make_new code. Further factoring will follow. Signed-off-by: Damien George <damien@micropython.org>
2023-10-20extmod/machine_pwm: Remove header file and move decls to .c file.Damien George
With public declarations moved to extmod/modmachine.h. It's now mandatory for a port to define MICROPY_PY_MACHINE_PWM_INCLUDEFILE if it enables MICROPY_PY_MACHINE_PWM. This follows how extmod/machine_wdt.c works. All ports have been updated to work with this modified scheme. Signed-off-by: Damien George <damien@micropython.org>
2023-10-20extmod/machine_wdt: Factor ports' WDT Python bindings to common code.Damien George
There are currently 7 ports that implement machine.WDT and a lot of code is duplicated across these implementations. This commit factors the common parts of all these implementations to a single location in extmod/machine_wdt.c. This common code provides the top-level Python bindings (class and method wrappers), and then each port implements the back end specific to that port. With this refactor the ports remain functionally the same except for: - The esp8266 WDT constructor now takes keyword arguments, and accepts the "timeout" argument but raises an exception if it's not the default value (this port doesn't support changing the timeout). - The mimxrt and samd ports now interpret the argument to WDT.timeout_ms() as signed and if it's negative truncate it to the minimum timeout (rather than it being unsigned and a negative value truncating to the maximum timeout). Signed-off-by: Damien George <damien@micropython.org>