summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-11-19docs/esp32: Add a factory reset page.Angus Gratton
This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-19docs/rp2: Add a small factory reset page.Angus Gratton
This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-19docs: Add a "Reset and Boot Sequence" reference page.Angus Gratton
Previously individual ports documented these aspects to varying degrees, but most of the information is common to all ports. In particular, this adds a canonical explanation of `boot.py` and `main.py`. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-18samd/mboot/README.md: Add information about the bootloader source.robert-hh
Includes the LICENSE file of the source and the specific board files for the Xplained Pro board. Signed-off-by: robert-hh <robert@hammelrath.com>
2024-11-18samd/samd_flash: Make flash read/write methods access self parameters.robert-hh
Use `self` (the first argument) instead of the global `samd_flash_obj` when accessing the `flash_base` parameter. This allows there to be multiple flash objects for various types of filesystem. Signed-off-by: robert-hh <robert@hammelrath.com>
2024-11-18samd/boards/SAMD21_XPLAINED_PRO: Use the SPI flash for the file system.robert-hh
The initial settings did not support it. The change required to add a dedicated handling of the Adesto 1MByte flash of the XPLAINED PRO board, which does not support the sfdp feature. Fixes the ID check of the Adesto/Renesas 1MByte flash. Signed-off-by: robert-hh <robert@hammelrath.com>
2024-11-18samd/mboot: Provide a UF2 bootloader for SAMD21 Xplained Pro.robert-hh
A bootloader labelled for the SAMD21 XPLAINED PRO board. The only difference to a generic bootloader are the names and ID of the USB port and the label of the drive that is opened. Signed-off-by: robert-hh <robert@hammelrath.com>
2024-11-18samd/boards/SAMD21_XPLAINED_PRO: Add specific deploy instructions.robert-hh
Add instructions to install a bootloader to the board. The SAMD21 XPLAINED PRO board is shipped without a bootloader, which therefore has to be installed once before it can be used with MicroPython. Signed-off-by: robert-hh <robert@hammelrath.com>
2024-11-18samd/machine_uart: Add full support for 9-bit data.robert-hh
Prior to this commit, 9-bit UART data could be specified in the constructor and was transmitted, but the 9th bit was set to 0 when sending, and ignored when receiving. This commit completes 9-bit support in that the 9th bit is taken from the data. 9-bit data has to be provided with `uart.write()` and and read with `uart.read()` as two bytes for each transmitted item, low order byte first. The data length supplied with `uart.write()` and requested by `uart.read()` has to be even, which is checked. The size of the UART buffers will be transparently doubled to cater for 9-bit data. Signed-off-by: robert-hh <robert@hammelrath.com>
2024-11-18mimxrt/machine_pwm: Fix a few inconsistencies with PWM output.robert-hh
Changes in this commit: - When setting PWM parameters of a FLEXPWM AB channel twice within a PWM cycle, the second setting was ignored. Now the second setting persists. - With `duty_u16(0)` a FLEXPWM X channel was set to high impedance. Now it is set to low impedance with value 0 for `invert=False`, and 1 for `invert=True`. - The align parameter requires a duty rate and frequency to be set. Align will now be ignored if freq or duty are missing. Signed-off-by: robert-hh <robert@hammelrath.com>
2024-11-18ports: Make PWM duty_u16 have an upper value of 65535 across all ports.robert-hh
The following ports used 65536 as the upper value (100% duty cycle) and are changed in this commit to use 65535: esp8266, mimxrt, nrf, samd. Tested that output is high at `duty_u16(65535)` and low at `duty_u16(0)`. Also verified that at `duty_u16(32768)` the high and low pulse have the same length. Partially reverts #10850, commits 9c7ad68165bcd224c94ca6d8f172362cf8000d99 and 2ac643c15bec8c88ece0e944ce58f36d02dfd2dd. Signed-off-by: robert-hh <robert@hammelrath.com>
2024-11-13extmod/vfs_blockdev: Support bool return from Python read/write blocks.Damien George
Commit f4ab9d924790581989f2398fe30bbac5d680577f inadvertently broke some Python block devices, for example esp32 and stm32 SDCard classes. Those classes return a bool from their `readblocks` and `writeblocks` methods instead of an integer errno code. With that change, both `False` and `True` return values are now be interpreted as non-zero and hence the block device call fails. The fix in this commit is to allow a bool and explicitly convert `True` to 0 and `False` to `-MP_EIO`. Signed-off-by: Damien George <damien@micropython.org>
2024-11-13esp32/modsocket: Fix getaddrinfo hints to set AI_CANONNAME.Damien George
Because the `ai_canonname` field is subsequently used. ESP32_GENERIC_S3 (at least) crashes with IDF 5.2.3 without this set. Signed-off-by: Damien George <damien@micropython.org>
2024-11-13extmod/network_ppp: Allow stream=None to suspend PPP.Daniël van de Giessen
This allows the stream to be set to `None`, which essentially stops all PPP communication without disconnecting the session. This allows replacing the stream on-the-fly to suspend it, for example to send AT commands to a modem without completely disconnecting and re-establishing the PPP connection: uart = ppp.config('stream') ppp.config(stream=None) uart.write(b'+++') # do some AT commands uart.write(b'ATO\r\n') ppp.config(stream=uart) Any attempted communication by PPP while the stream is not connected will register as simple packet loss to the LwIP stack because we return 0 for any write calls, and protocols like TCP will then automatically handle retrying. Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2024-11-13extmod/network_ppp: Add stream config parameter.Daniël van de Giessen
This makes the stream that the PPP object wraps, which is normally only set once via the constructor, accessible and configurable via the `ppp.config()` method. Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2024-11-13tools/mpremote: Support trailing slash on dest for non-recursive copy.Damien George
This fixes a regression in db59e55fe7a0b67d3af868990468e7b8056afe42: prior to that commit `mpremote` supported trailing slashes on the destination of a normal (non-recursive) copy. Add back support for that, with the semantics that a trailing slash requires the destination to be an existing directory. Also add a test for this. Signed-off-by: Damien George <damien@micropython.org>
2024-11-13tools/mpremote: Add test for forced copy.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-11-13tools/mpremote: Make sure stdout and stderr output appear in order.Damien George
mpremote error messages now go to stderr, so make sure stdout is flushed before printing them. Also update the test runner to capture error messages. Signed-off-by: Damien George <damien@micropython.org>
2024-11-13tests/net_hosted: Improve and simplify non-block-xfer test.Damien George
CPython changed its non-blocking socket behaviour recently and this test would not run under CPython anymore. So the following steps were taken to get the test working again and then simplify it: - Run the test against CPython 3.10.10 and capture the output into the .exp file for the test. - Run this test on unix port of MicroPython and verify that the output matches the CPython 3.10.10 output in the new .exp file (it did). From now on take unix MicroPython as the source of truth for this test when modifying it. - Remove all code that was there for CPython compatibility. - Make it print out more useful information during the test run, including names of the OSError errno values. - Add polling of the socket before the send/write/recv/read to verify that the poll gives the correct result in non-blocking mode. Tested on unix MicroPython, ESP32_GENERIC, PYBD_SF2 and RPI_PICO_W boards. Signed-off-by: Damien George <damien@micropython.org>
2024-11-13extmod/modlwip: Don't allow writing to a TCP socket that is connecting.Damien George
This follows the behaviour of unix MicroPython (POSIX sockets) and the esp32 port. Signed-off-by: Damien George <damien@micropython.org>
2024-11-11tests/cpydiff: Fix test case for modules_json_nonserializable.Jeff Epler
The test case was producing the following error: Traceback (most recent call last): File "<stdin>", line 12, in <module> UnicodeError: which did not demonstrate the intended difference (this particular non-json-serializable object DID throw an exception! just not TypeError). The updated test uses a byte string with all ASCII bytes inside, which better illustrates the diference. Signed-off-by: Jeff Epler <jepler@gmail.com>
2024-11-08tests: Use the recommended network.WLAN.IF_[AP|STA] constants.Angus Gratton
Removes the deprecated network.[AP|STA]_IF form from unit tests. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-08esp8266: Use the recommended network.WLAN.IF_[AP|STA] constants.Angus Gratton
Removes the deprecated network.[AP|STA]_IF form from the esp8266 port This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-08esp32: Use the recommended network.WLAN.IF_[AP|STA] constants.Angus Gratton
Removes the deprecated network.[AP|STA]_IF form from the esp32 port This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-08docs: Specify the recommended network.WLAN.IF_[AP|STA] constants.Angus Gratton
Removes the deprecated network.[AP|STA]_IF form from the docs. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-06esp32: Workaround native code execution crash on ESP32-S2.Angus Gratton
Seemingly ESP-IDF incorrectly marks RTC FAST memory region as MALLOC_CAP_EXEC on ESP32-S2 when it isn't. This memory is the lowest priority, so it only is returned if D/IRAM is exhausted. Apply this workaround to treat the allocation as failed if it gives us non-executable RAM back, rather than crashing. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-05esp32/machine_pwm: Restore PWM support for ESP-IDF v5.0.x and v5.1.x.Angus Gratton
The cleanup in 548babf8 relies on some functions not available in older ESP-IDF. Temporarily restore them, until we drop support for ESP-IDF <5.2. PWM functionality should end up the same regardless of ESP-IDF version, and also no different from MicroPython V1.23. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-05esp32/network_wlan: Add missing WLAN security constants.Damien George
These were added to the `network` module but not the `network.WLAN` class, which is the new home for such constants. Also: - Mark the WLAN constants in the `network` module as deprecated, to be removed in MicroPython 2.0. - Move the static assert to the WLAN source code, to be close to where it relates to. Signed-off-by: Damien George <damien@micropython.org>
2024-11-05extmod/nimble: Remove asserts of ediv_rand_present and adjust comments.Damien George
Recent versions of NimBLE (since release 1.6.0) removed this variable; see https://github.com/apache/mynewt-nimble/commit/7cc8c08d67d52b373eeeec6b33b113192cf2e996. We never used it except in an assert, so remove those asserts to make the code compatible with newer NimBLE versions (eg for the esp32 port). Signed-off-by: Damien George <damien@micropython.org>
2024-11-04extmod/modlwip: Fix IGMP address type when IPv6 is enabled.Damien George
This was missed in 628abf8f25a7705a2810fffe2ca6ae652c532896. The the bug was that, when IPv6 is enabled, the `sizeof(ip_addr_t)` is much larger than IPv4 size, which is what's needed for IGMP addressing. Fixes issue #16100. Signed-off-by: Damien George <damien@micropython.org>
2024-11-04tests/run-tests.py: Add mimxrt and samd platforms.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-11-04tests/run-tests.py: Change --target/--device options to --test-instance.Damien George
Previously to this commit, running the test suite on a bare-metal board required specifying the target (really platform) and device, eg: $ ./run-tests.py --target pyboard --device /dev/ttyACM1 That's quite a lot to type, and you also need to know what the target platform is, when a lot of the time you either don't care or it doesn't matter. This commit makes it easier to run the tests by replacing both of these options with a single `--test-instance` (`-t` for short) option. That option specifies the executable/port/device to test. Then the target platform is automatically detected. The `--test-instance` can be passed: - "unix" (the default) to use the unix version of MicroPython - "webassembly" to test the webassembly port - anything else is considered a port/device to pass to Pyboard There are also some shortcuts to specify a port/device, following `mpremote`: - a<n> is short for /dev/ttyACM<n> - u<n> is short for /dev/ttyUSB<n> - c<n> is short for COM<n> For example: $ ./run-tests.py -t a1 Note that the default test instance is "unix" and so this commit does not change the standard way to run tests on the unix port, by just doing `./run-tests.py`. As part of this change, the platform (and it's native architecture if it supports importing native .mpy files) is show at the start of the test run. Signed-off-by: Damien George <damien@micropython.org>
2024-11-04tests/run-tests.py: Simplify the way target-specific tests are given.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-11-04tests/basics/deque2.py: Add tests for deque subscript-from-end.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-11-04py/objdeque: Fix buffer overflow in deque_subscr.Jan Sturm
In `deque_subscr()`, if `index_val` equals `self->alloc`, the index correction `index_val -= self->alloc` does not execute, leading to an out-of-bounds access in `self->items[index_val]`. The fix in this commit ensures that the index correction is applied whenever `index_val >= self->alloc`, preventing access beyond the allocated buffer size. Signed-off-by: Jan Sturm <jansturm92@googlemail.com>
2024-10-31docs/reference/packages: Fix description of --target option in mip.Jan Klusáček
Descripton of mip usage with micropython port suggest using it like this: ./micropython -m mip install --target=third-party pkgname But it should be called without equal sign: ./micropython -m mip install --target third-party pkgname Signed-off-by: honza.klu@gmail.com
2024-10-31tools/ci.sh: Fix reference commit for code size comparison.Angus Gratton
Previously the code size comparison was between the merge base (i.e. where the PR branched), and the generated merge commit into master. If the PR branch was older than current master, this meant the size comparison could incorrectly include changes already merged on master but missing from the PR branch. This commit changes it to compare the generated merge commit against current master, i.e. the size impact if this PR was to be merged. This commit also disables running the code size check on "push", it now only runs on pull_request events. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-10-31tools/ci.sh: Fix commit msg checking when PR branch HEAD behind master.Angus Gratton
Fixes the problem noted at https://github.com/micropython/micropython/pull/15547#issuecomment-2434479702 which is that, because default CI HEAD for a PR is a (generated) merge commit into the master branch's current HEAD, then if the PR branch isn't fully rebased then the commit check runs against commits from master as well! Also drops running this check on push, the pull_request event is triggered by default on open and update ("synchronized" event), which probably covers the cases where this check should run. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-10-30pic16bit: Make it build with recent XC16 versions.Alessandro Gatti
The PIC16 port didn't catch up with the other ports, so it required a bit of work to make it build with the latest version of XC16. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-10-30esp32/machine_pwm: Use IDF functions to calculate resolution correctly.Andrew Leech
This commit fixes PWM configuration across C3, C6, S2 and S3 chips, which was broken by 6d799378bad4474e77ddb2fa2187ecd6e290e0ba. Without this fix the PWM frequency is limited to a maximum of 2446Hz (on S2 at least). Signed-off-by: Andrew Leech <andrew@alelec.net>
2024-10-30esp32/machine_hw_spi: Reject invalid number of bits in constructor.Alessandro Gatti
This commit adds an extra bit of parameters validation to the SPI bus constructor on ESP32. Passing 0 as the number of bits would trigger a division by zero error when performing read/write operations on an SPI bus created in such a fashion. Fixes issue #5910. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-10-28tools/mpremote: Fix UnboundLocalError in Transport.fs_writefile().Glenn Moloney
The variable `written` was being used before it was defined in the `fs_writefile()` method of the Transport class. This was causing an `UnboundLocalError` to be raised when the `progress_callback` was not provided. Fixes issue #16084. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
2024-10-28esp32: Add some notes about the different CMake files.Angus Gratton
Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-10-28esp32: Move the linker wrap options out of the project CMakeLists.Angus Gratton
For in-tree builds, these are effectively equivalent. However for out-of-tree builds it's preferable to have as little as possible in the top-level CMakeLists.txt file (as the out-of-tree build needs its own copy). This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-10-28rp2/README: Remove redundant `global` statement from example code.Steve Holden
Since `led` is not being rebound inside the `tick` function the standard Python name resolution method will find it. Signed-off-by: Steve Holden <steve@holdenweb.com>
2024-10-28all: Bump version to 1.25.0-preview.v1.25.0-previewDamien George
Signed-off-by: Damien George <damien@micropython.org>
2024-10-26all: Bump version to 1.24.0.v1.24.0Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-10-25lib/micropython-lib: Update submodule to latest.Damien George
This brings in: - requests improvements with overriding headers - use non-u versions of built-in modules, including asyncio - fix to logging so StreamHandler calls parent constructor - various fixes to usb-device packages - fixes to lora sx126x and sx127x drivers - improvements to unix-ffi/sqlite3 - support additional gap_connect arguments in aioble Signed-off-by: Damien George <damien@micropython.org>
2024-10-25stm32/boards/ARDUINO_OPTA: Add Opta expansion module.iabdalkader
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-10-25stm32/boards/ARDUINO_NICLA_VISION: Add SE05x driver.iabdalkader
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>