summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-09-14renesas-ra: Add RNG driver.iabdalkader
It needs to be enabled explicitly by a board. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-14renesas-ra: Add Bluetooth support using NimBLE.iabdalkader
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-14renesas-ra: Add TinyUSB support.iabdalkader
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-14mimxrt/Makefile: Update to work with latest TinyUSB.iabdalkader
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-14lib/tinyusb: Update to the most recent master.iabdalkader
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-14shared/tinyusb: Support HS endpoint sizes.iabdalkader
Set buffer and endpoint sizes to 512 if the device is configured as a High Speed device. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-14renesas-ra/Makefile: Generate binary firmware output.iabdalkader
This patch generates a binary firmware image (*.bin) and removes the split TEXT1/0_ADDR/SECTIONS because it's not configured for this port so it generates broken binaries. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-14py/persistentcode: Always close reader even if an exception is raised.Damien George
Fixes issue #3874. Signed-off-by: Damien George <damien@micropython.org>
2023-09-14py/parse: Always free lexer even if an exception is raised.Damien George
Fixes issue #3843. Signed-off-by: Damien George <damien@micropython.org>
2023-09-14py/runtime: Add helpers to call a general function on nlr jump callback.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-09-13stm32/uart: Add support for UART10 when it's a USART.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-09-13stm32/timer: Fix use of TIM8 on H5 MCU's.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-09-13stm32/powerctrlboot: Allow using PLL3 for USB clock on H5 MCU's.Damien George
A board should enable MICROPY_HW_CLK_USE_PLL3_FOR_USB to use this feature. Signed-off-by: Damien George <damien@micropython.org>
2023-09-13stm32/octospi: Add support for dual-line SPI interface.Damien George
And fix the case of 32-bit addresses in single-line mode. Signed-off-by: Damien George <damien@micropython.org>
2023-09-13stm32/dma: Add support for SPI1 DMA on H5 MCU's.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-09-12stm32/timer: Fix deadtime config on Advanced Timer peripherals.Andrew Leech
Newer MCU series have additional fields in the struct which need to be initialised to zero, eg Break2AFMode on WB55. This work was funded by Planet Innovation. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-09-12extmod/modlwip: Fix setting of IP option SOF_BROADCAST.Damien George
Follow up to 25b89cbe946a198734f29b05c3e6730d6b949979. Signed-off-by: Damien George <damien@micropython.org>
2023-09-06tests/multi_net: Increase asyncio tests timeouts.iabdalkader
Increase asyncio tests timeouts to account for different WiFi modules and CPU clocks on different boards. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-05esp32: Skip validation of image on boot from deepsleep.Glenn Moloney
sdkconfig.base: Add CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP=y. This reduces time to boot from deepsleep by at least 200ms and can provide significant power savings for deepsleep-based battery applications. docs/library/esp32.rst: Add note cautioning not to enter deepsleep after changing the boot partition, without first performing a hard reset. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
2023-09-05github/workflows: Bump actions/checkout from 3 to 4.dependabot[bot]
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
2023-09-05mimxrt/sdio: Move config guard so headers are only included if used.Damien George
Otherwise it's a build error on certain MCU series. Signed-off-by: Damien George <damien@micropython.org>
2023-09-05mimxrt/machine_uart: Add a helper function to change the baudrate.robert-hh
And use it in the Bluetooth bindings instead of setting the baudrate by a call to the NXP lib. Also fixes machine_uart.c to work with a baud rate of 921600. Signed-off-by: robert-hh <robert@hammelrath.com>
2023-09-04esp32/boards/UM_FEATHERS3: Fix I2C pins in pins.csv.Seon Rozenblum
Signed-off-by: Seon Rozenblum <seon@unexpectedmaker.com>
2023-09-04docs/esp32/tutorial: Add example for pin access via registers.IhorNehrutsa
Synchronous access to pins directly via registers. Signed-off-by: Ihor Nehrutsa <Ihor.Nehrutsa@gmail.com>
2023-09-04docs/library/network: Clarify network.hostname() behaviour.Jim Mussared
This must be called before the interface connects. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-09-04docs/library/platform: Add docs for the platform library.Francis Dela Cruz
Signed-off-by: Francis Dela Cruz <rainyworlds1@outlook.com>
2023-09-04esp32/boards/ARDUINO_NANO_ESP32: Clarify recovery instructions.Sebastian Romero
Signed-off-by: Sebastian Romero <s.romero@arduino.cc>
2023-09-04py/malloc: Fix DEBUG_print() args in m_realloc_maybe.IhorNehrutsa
Signed-off-by: Ihor Nehrutsa <IhorNehrutsa@gmail.com>
2023-09-04unix/modjni: Fix build errors with type definitions and error strings.David Yang
- Superfluous comments in MP_DEFINE_CONST_OBJ_TYPE stop correct macro expanding. - MP_ERROR_TEXT now gives mp_rom_error_text_t, but we want plain const char *. Signed-off-by: David Yang <mmyangfl@gmail.com>
2023-09-03extmod/modssl_mbedtls: Ignore err ERR_SSL_RECEIVED_NEW_SESSION_TICKET.Mirko Vogt
It appears a new session ticket being issued by the server right after completed handshake is not uncommon and shouldn't be treated as fatal. mbedtls itself states "This error code is experimental and may be changed or removed without notice." Signed-off-by: Mirko Vogt <mirko-dev|mpy@nanl.de>
2023-09-03extmod/modssl_mbedtls: Call func psa_crypto_init if PSA is used.Mirko Vogt
Whenever the PSA interface is used (if MBEDTLS_PSA_CRYPTO is defined), psa_crypto_init() needs to be called to initialise the global PSA data struct, before any PSA related operations. TLSv1.3 depends on the PSA interface, TLSv1.2 only uses the PSA stack if MBEDTLS_USE_PSA_CRYPTO is defined. Without psa_crypto_init() every PSA related call will result in -0x6C00/-27648 which translates to "SSL - Internal error (eg, unexpected failure in lower-level module)". The error is misleading, especially since mbedtls in its docs itself advices "to return #PSA_ERROR_BAD_STATE or some other applicable error.". Signed-off-by: Mirko Vogt <mirko-dev|mpy@nanl.de>
2023-09-03py/modthread: Return thread id from start_new_thread().David Lechner
In CPython, `_thread.start_new_thread()` returns an ID that is the same ID that is returned by `_thread.get_ident()`. The current MicroPython implementation of `_thread.start_new_thread()` always returns `None`. This modifies the required functions to return a value. The native thread id is returned since this can be used for interop with other functions, for example, `pthread_kill()` on *nix. `_thread.get_ident()` is also modified to return the native thread id so that the values match and avoids the need for a separate `native_id` attribute. Fixes issue #12153. Signed-off-by: David Lechner <david@pybricks.com>
2023-09-02esp32/network_ppp: Block after deleting task.Daniël van de Giessen
When calling ppp.active(False) we could get a crash due to immediately returning after asking FreeRTOS to delete the current task. This commit adds a simple blocking loop, the same as used in all other places where we call vTaskDelete(NULL). Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2023-09-02esp32/boards/UM_NANOS3: Add new UM NanoS3 board.Seon Rozenblum
Signed-off-by: Seon Rozenblum <seon@unexpectedmaker.com>
2023-09-02esp32/boards: Add pins.csv to UM boards and other minor changes.Seon Rozenblum
Signed-off-by: Seon Rozenblum <seon@unexpectedmaker.com>
2023-09-02rp2/machine_timer: Fix printing of timer period.robert-hh
Showing the period alway as microsecond quantities, since tick_hz is assumed as 1_000_000 if the period is given by freq=xxx. If the period is larger than 0xffffffff, the value is divided by 1000 and "000" is appended in the display. That works for periods up to about 50 days. Signed-off-by: robert-hh <robert@hammelrath.com>
2023-09-02tools/metrics.py: Fix nrf and rp2 board names after renaming.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-09-02examples/natmod: Add features4 as a class definition example.Jim Mussared
Also provide a basic README.md for dynamic native modules. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-09-02samd/modules/_boot.py: Add /lib to sys.path.Jim Mussared
Needed for mip to find a default location to install to. Like esp32, samd uses "/" as the mount point for the flash. Make _boot.py add the entry after successfully mounting. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-09-01esp32/machine_uart: Release GIL for blocking reads.Daniël van de Giessen
If we're reading from an UART with a non-zero timeout, we can release the GIL so that other threads/tasks may run while we are sleeping waiting for data to arrive. Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2023-09-01esp32: Support JTAG console, free up UART.Daniël van de Giessen
CONFIG_USB_OTG_SUPPORTED is automatically set by the ESP-IDF when the chip supports USB-OTG, which is the case for the ESP32-S2 and ESP32-S3. When trying to use the JTAG console with these chips, it would not work because our USB implementation will take over control over the USB port, breaking the JTAG console in the process. Thus, when the board is configured to use the JTAG console, we should not enable our USB console support. Additionally, this change also frees up UART0 when an USB-based console is configured, since there's no reason to prevent (re)configuration of UART0 for other uses in that case. Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2023-09-01esp32/modnetwork: Add support for SO_BINDTODEVICE socket option.Daniël van de Giessen
This implements support for SO_BINDTODEVICE, which allows telling a socket to use a specific interface instead of lwIP automatically selecting one. This allows devices that have multiple connections (for example cellular over PPP in addition to WLAN) to explicitly choose which data is send over which connection, which may have different reliability and or (mobile data) costs associated with using them. The used lwIP network stack already has support for this, so all that was needed was to expose this functionality in MicroPython. This commit exposes a new constant SO_BINDTODEVICE which can be set as an socket option. As a value it expects the name of the interface to bind to. These names can be retrieved using `.config('ifname')` implemented on each interface type (including adding in this commit a `.config()` method to PPP, which it didn't have before), which returns a string with the interface name: >>> import machine >>> import network >>> network.WLAN(network.AP_IF).config('ifname') 'lo0' >>> wlan = network.WLAN(network.AP_IF) >>> wlan.active(True) and wlan.config('ifname') 'ap1' >>> wlan = network.WLAN(network.STA_IF) >>> wlan.active(True) and wlan.config('ifname') 'st1' >>> ppp = network.PPP(machine.UART(0)) >>> ppp.active(True) and ppp.config('ifname') 'pp1' >>> ppp = network.PPP(machine.UART(0)) >>> ppp.active(True) and ppp.config('ifname') 'pp2' >>> ppp = network.PPP(machine.UART(0)) >>> ppp.active(True) and ppp.config('ifname') 'pp3' Note that lo0 seems to be returned by lwIP if the interface is not yet active. The method can also return None in the case of PPP where the entire lwIP interface doesn't yet exist before being activated. Currently no effort is made to unify those cases; it is expected that whatever we receive from lwIP is valid. When the socket option is set, this forces using a specific device: import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_BINDTODEVICE, 'st1') setsockopt will throw (OSError: [Errno 19] ENODEV) if the specified interface does not exist. Tested with LAN, WLAN, and PPP; can specify which interface should be used and when testing with, for example, HTTP requests to ifconfig.co the returned IP address confirms a specific interface was used. Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2023-09-01esp32/modsocket: Add support for SO_BROADCAST socket option.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-09-01extmod/{modlwip,modsocket}: Add support for SO_BROADCAST socket option.Wang Xuancong
Signed-off-by: Wang Xuancong <xuancong84@gmail.com>
2023-09-01extmod/vfs_posix_file: Implement sys.std*.buffer objects.stephanelsmith
Add the buffer attribute to sys.stdin, sys.stdout and sys.stderr. This provides raw access to underlying stdio streams for the unix port (and others that use VfsPosix). Signed-off-by: stephanelsmith <stephane.smith@titansensor.com>
2023-09-01extmod/vfs_posix_file: Fix flush handling on macOS.stephanelsmith
On macOS, if running micropython from subprocess.check_output, then a stdout.flush() raises error 45. Here's a test case. This will run fine on linux, but crashes on macOS with error 45. import sys import subprocess import tempfile with tempfile.NamedTemporaryFile('w') as fp: fp.write(''' import sys sys.stdout.write('hello world') sys.stdout.flush() print('') ''') fp.flush() print('py3') o = subprocess.check_output(f'python3 {fp.name}'.split()) print(o) print('upy') o = subprocess.check_output(f'micropython {fp.name}'.split()) print(o) On macOS: py3 b'hello world\n' upy Traceback (most recent call last): File "...", line 4, in <module> OSError: 45 On unix: py3 b'hello world\n' upy b'hello world\n' Signed-off-by: stephanelsmith <stephane.smith@titansensor.com>
2023-09-01tests/run-tests.py: Capture output of stderr when running on CPython.stephanelsmith
Signed-off-by: stephanelsmith <stephane.smith@titansensor.com>
2023-09-01py/dynruntime.h: Implement MP_OBJ_NEW_QSTR.Jim Mussared
Because mpy_ld.py doesn't know the target object representation, it emits instances of `MP_OBJ_NEW_QSTR(MP_QSTR_Foo)` as const string objects, rather than qstrs. However this doesn't work for map keys (e.g. for a locals dict) because the map has all_keys_are_qstrs flag is set (and also auto-complete requires the map keys to be qstrs). Instead, emit them as regular qstrs, and make a functioning MP_OBJ_NEW_QSTR function available (via `native_to_obj`, also used for e.g. making integers). Remove the code from mpy_ld.py to emit qstrs as constant strings, but leave behind the scaffold to emit constant objects in case we want to do use this in the future. Strictly this should be a .mpy sub-version bump, even though the function table isn't changing, it does lead to a change in behavior for a new .mpy running against old MicroPython. `mp_native_to_obj` will incorrectly return the qstr value directly as an `mp_obj_t`, leading to unexpected results. But given that it's broken at the moment, it seems unlikely that anyone is relying on this, so it's not work the other downsides of a sub-version bump (i.e. breaking pure-Python modules that use @native). The opposite case of running an old .mpy on new MicroPython is unchanged, and remains broken in exactly the same way. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-09-01tools/mpy_ld.py: Support more complex rodata sections.Jon Nordby
Sections sometimes named .rodata.str1.1 etc, instead of just .rodata. Avoid crashing in that case. Instead treat it like any other RO section. Fix thanks to @phlash. Fixes issue #8783. Signed-off-by: Jon Nordby <jononor@gmail.com>
2023-09-01py/modstruct: Support pad bytes in struct format.Daniël van de Giessen
This adds support for the x format code in struct.pack and struct.unpack. The primary use case for this is ignoring bytes while unpacking. When interfacing with existing systems, it may often happen that you either have fields in a struct that aren't properly specified or you simply don't care about them. Being able to easily skip them is useful. Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>