summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-12-10esp32: Fix machine_touchpad compiling on IDFv5.3.Daniƫl van de Giessen
Signed-off-by: Damien George <damien@micropython.org>
2024-12-10esp32: Add basic espressif IDF v5.3 compatibility.Andrew Leech
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au> Signed-off-by: Damien George <damien@micropython.org>
2024-12-10esp32: Fix link failure due to link library order.Angus Gratton
When a wrapped symbol is provided in its own file, it's possible for the linker to skip that file entirely and not return to it depending on the order of libraries passed on the linker command line. This is because these wrapped symbols create linker cycles (libmain_espXX depends on liblwip but liblwip now also depends on libmain for the wrapped functions in lwip_patch.c, for example.) Linker failure for symbols in lwip_patch.c was reproducible if mDNS was disabled in the board configuration. This commit adds an explicit undefined symbol for each file, to ensure the linker will add the wrapped objects on its first pass. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-12-10mimxrt/mpconfigport: Update FATFS config to align with other ports.iabdalkader
Make this port use the same FATFS config as stm32, rp2, renesas-ra. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-12-10renesas-ra/mpconfigport: Switch FATFS LFN to type 2.iabdalkader
LFN type 2 uses the stack to allocate the internal working buffer for LFN, which is thread-safe and saves about 512 bytes of BSS memory (at the expense of needing that much memory on the stack). Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-12-10rp2/mpconfigport: Switch FATFS LFN to type 2.iabdalkader
LFN type 2 uses the stack to allocate the internal working buffer for LFN, which is thread-safe and saves about 512 bytes of BSS memory (at the expense of needing that much memory on the stack). Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-12-10stm32/mpconfigport: Switch FATFS LFN to type 2.iabdalkader
LFN type 2 uses the stack to allocate the internal working buffer for LFN, which is thread-safe and saves about 512 bytes of BSS memory (at the expense of needing that much memory on the stack). Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-12-10stm32/main: Deinitialize SPI and I2C on soft-reset.iabdalkader
Following UART, CAN, Timer, etc. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-12-10stm32/pyb_i2c: Add pyb_i2c_deinit_all function.iabdalkader
I2C objects can remain active after a soft-reboot because they are statically allocated and lack a finalizer to collect and deinitialize them. This commit adds a `pyb_i2c_deinit_all()` function for I2C, similar to other peripherals such as UART, DAC, etc. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-12-10stm32/spi: Add spi_deinit_all function.iabdalkader
SPI objects can remain active after a soft-reboot because they are statically allocated and lack a finalizer to collect and deinitialize them. This commit adds a `spi_deinit_all()` functions for SPI, similar to other peripherals such as UART, DAC, etc. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-12-10stm32/sdram: Make SDRAM refresh count configurable by a board.iabdalkader
Refresh count calculations were using a hard-coded SDRAM frequency and refresh cycles, so change them to values that can be set by a board. And set these options to their existing values on STM32F769DISC and STM32F7DISC boards. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-12-10stm32/boards: Rename SDRAM frequency config option to make units clear.iabdalkader
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-12-10stm32/boards: Update Arduino board configs for SPI reset and bootloader.iabdalkader
Update ARDUINO_GIGA, ARDUINO_OPTA, ARDUINO_NICLA_VISION and ARDUINO_PORTENTA_H7 to: - Enable SPI flash soft-reset. - Disable enter bootloader via reset. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-12-10drivers/memory/spiflash: Add a config option to soft-reset SPI flash.iabdalkader
Add a compile-time config option to soft-reset SPI flash on init. This puts the flash in a known state on reset. Note this option is disabled by default. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-12-10nrf/boards/ARDUINO_NANO_33_BLE_SENSE: Update LED and timer config.iabdalkader
Changes: - Enable hardware timer. - Define LED pins. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-12-10mimxrt: Switch to shared TinyUSB descriptor.iabdalkader
This removes duplicated TinyUSB configuration and port-specific code. Tested on RT1062, CDC+MSC still working. @robert-hh tested CDC with 1011, 1015, 1020 and 1176. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-12-10shared/tinyusb: Set MSC max endpoint size based on device speed.iabdalkader
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-12-10extmod/extmod.mk: Fix libmetal build prefix.iabdalkader
libmetal source files already have the build directory prefix, because they're auto-generated inside the build directory. When they're added to `SRC_THIRDPARTY_C`, another build directory prefix is added resulting in the object files being generated in a nested build directory. This patch strips the build directory prefix before adding libmetal's source files. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-12-06tests/extmod: Convert machine1.py test to use unittest.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-12-06tests/net_hosted: Convert connect-nonblock-xfer test to use unittest.Damien George
This allows it to run parts of the test on esp8266 (or any target using axTLS). Signed-off-by: Damien George <damien@micropython.org>
2024-12-06tests/ports/stm32_hardware: Convert DMA test to use unittest.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-12-06qemu/Makefile: Include unittest in firmware.Damien George
So that this port can run unittest-based tests. Signed-off-by: Damien George <damien@micropython.org>
2024-12-06esp8266/mpconfigport: Enable function attributes.Damien George
This allows `unittest` to work on esp8266 boards. Signed-off-by: Damien George <damien@micropython.org>
2024-12-06lib/micropython-lib: Update submodule to latest.Damien George
This brings in: - umqtt.simple: add optional socket timeout to connect method - aioespnow,webrepl: use recommended network.WLAN.IF_[AP|STA] constants - unittest: allow SkipTest to work within a subTest - unittest: always use "raise" with an argument Signed-off-by: Damien George <damien@micropython.org>
2024-12-06tests/run-tests.py: Print .out file when there is no .exp file.Damien George
So that a failing unittest-based test has its entire log printed when using `run-tests.py --print-failures`. Signed-off-by: Damien George <damien@micropython.org>
2024-12-06tests/run-tests.py: Add support for tests to use unittest.Damien George
All the existing tests require a .exp file (either manually specified or generated running the test first under CPython) that is used to check the output of running the test under MicroPython. The test passes if the output matches the expected output exactly. This has worked very well for a long time now. But some of the newer hardware tests (eg UART, SPI, PWM) don't really fit this model, for the following main reasons: - Some but not all parts of the test should be skipped on certain hardware targets. With the expected-output approach, skipping tests is either all or nothing. - It's often useful to output diagnostics as part of the test, which should not affect the result of the test (eg the diagnostics change from run to run, like timing values, or from target to target). - Sometimes a test will do a complex check and then print False/True if it passed or not, which obscures the actual test result. To improve upon this, this commit adds support to `run-tests.py` for a test to use `unittest`. It detects this by looking at the end of the output after running the test, looking for the test summary printed by `unittest` (or an error message saying `unittest` was not found). If the test uses `unittest` then it should not have a .exp file, and it's not run under CPython. A `unittest` based test passes or fails based on the summary printed by `unittest`. Note that (as long as `unittest` is installed on the target) the tests are still fully independent and you can still run them without `run-tests.py`: you just run it as usual, eg `mpremote run <test.py>`. This is very useful when creating and debugging tests. Note also that the standard test suite testing Python semantics (eg everything in `tests/basics/`) will probably never use unittest. Only more advanced tests will, and ones that are not runnable under CPython. Signed-off-by: Damien George <damien@micropython.org>
2024-12-03docs/library/binascii: Add docs for binascii.crc32 method.Amirreza Hamzavi
Signed-off-by: Amirreza Hamzavi <amirrezahamzavi2000@gmail.com>
2024-11-30docs,ports: Fix some comments and error messages with doubled-up words.chuangjinglu
Signed-off-by: chuangjinglu <chuangjinglu@outlook.com>
2024-11-30extmod/modplatform: Add Android to the recognised platforms list.Alessandro Gatti
This commit adds code to distinguish between regular Linux and Android, also adding a specific entry for the platform libc. The reported libc is marked as "bionic" and its version matches the Android platform API version (there are no definitions for a specific bionic version). Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-11-30extmod/modplatform: Add Clang to the known compilers list.Alessandro Gatti
This commit adds support to distinguish between GCC and Clang to report the appropriate compiler version. Usually Clang also disguises itself as GCC for compatibility reasons, but these changes look for Clang-specific definitions first to avoid that problem. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-11-30extmod/modplatform: Distinguish AArch64 from AArch32.Alessandro Gatti
This commit adds a new platform architecture name for Arm CPUs running in 64 bits mode ("aarch64"). The 32 bits name is left as "arm" to maintain compatibility with existing code. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-11-30esp32: Add missing network.STAT_CONNECT_FAIL constant.Angus Gratton
The esp32 port had network.STAT_ASSOC_FAIL for the same purpose, but this is undocumented and different to all other ports. That constant is now deprecated. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-30github/workflows: Bump codecov/codecov-action from 4 to 5.dependabot[bot]
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
2024-11-30tools/ci.sh: Remove explicit macOS pkg-config install.Angus Gratton
Reasons to remove this: - GitHub's macOS runners install this package by default nowadays. - Brew renamed this package to 'pkgconf' so installing the old name on top of the new package name has started failing. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-28tests/extmod: Workaround CPython warning in asyncio_new_event_loop test.Angus Gratton
This started failing in CI on the mingw build, after CPython updated to 3.12.7. The test prints two warnings during interpreter shutdown of "Task was destroyed but it is pending!". This didn't happen on other CPython builds, and I think that's because of finalizer order in CPython interpreter shutdown but not certain (the loop finalizer calls loop.close() if not already closed). Adding explicit calls to loop.close() causes the warning to be printed on every run with CPython 3.12.7 on Linux. Next, added the workaround exception handler to swallow this exception as MicroPython doesn't produce an equivalent. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-28github/workflows: Workaround using CPython 3.12 in MSYS2 builds.Angus Gratton
Once MSYS2 repository updates past Python 3.12, this commit can be reverted. Explanation: CPython 3.12 can't pass sys_settrace_features test (see parent commit for explanation). MSYS2 mingw-w64-ARCH-python package is currently 3.12.7. MSYS2 doesn't recommend installing old packages from their archive (due to library dependencies), so switch to the GitHub CI setup-python action for now. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-28tests/misc/sys_settrace_features.py: Add note about CPython 3.12 issue.Angus Gratton
CPython 3.12 has a documented issue with settrace for opcodes, apparently due to PEP 669. "This behavior will be changed back in 3.13 to be consistent with previous versions." No easy way to make the test pass on CPython 3.12, but at least this helps signal what the problem is to anyone who runs into a failure. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-28py/objfloat: Workaround non-constant NAN definition on Windows MSVC.Angus Gratton
Recent MSVC versions have changed the definition of NAN to a non-constant expression! This is a bug, C standard says it should be a constant. Good explanation and workaround at: https://stackoverflow.com/a/79199887 This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-28nrf/drivers/ticker: Reset slow ticker callback count on soft reboot.robert-hh
The micro:bit board (and probably other boards using the music or display module) locked up on soft reboot. Reason was a buffer overflow caused by an index counter, which was not reset on soft_reboot. That's fixed in this commit. Tested with a micro:bit board, performing a series of soft reboots. Signed-off-by: robert-hh <robert@hammelrath.com>
2024-11-28extmod/modframebuf: Fix 0 radius bug in FrameBuffer.ellipse.Corran Webster
This fixes a bug in FrameBuffer.ellipse where it goes into an infinite loop if both radii are 0. This fixes the bug with a simple pre-check to see if both radii are 0, and in that case sets a single pixel at the center. This is consistent with the behaviour of the method when called with just one of the radii set to 0, where it will draw a horizontal or vertical line of 1 pixel width. The pixel is set with setpixel_checked so it should handle out-of-bounds drawing correctly. This fix also includes three new tests: one for the default behaviour, one for drawing out-of-bounds, and one for when the sector mask is 0. Fixes issue #16053. Signed-off-by: Corran Webster <cwebster@unital.dev>
2024-11-28docs,esp32: Update machine.TouchPad docs for ESP32-S2 and ESP32-S3.Angus Gratton
Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-28esp32: Fix machine.TouchPad startup on ESP32-S2 and S3.Angus Gratton
Closes #13178. TouchPad confirmed working on both chips, and fixes the the ESP32-S3 reading constant max value. Was unable to reproduce the bug on ESP32-S2 but this may be due to my test setup, and it still works with the fix. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-28esp32: Use hardware version for touchpad macro defines.Angus Gratton
ESP32 has hardware V1 and S2/S3 has V2, and future chips may have different versions. This should still compile to the same binary before and after. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-28tests: Add basic wlan test.Angus Gratton
Includes adding some ESP8266 port output to the ignored output list for the multitest runner. This test passes on ESP8266 and various ESP32s (including talking to each other). Without the fix in the parent commit, ESP32 AP will fail if the station can report its channel (i.e. channel is wrong). Testing with a CYW43 (RPI_PICO_W) currently fails but I have some fixes to submit so it can pass as well. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-28esp32: Fix setting WLAN channel in AP mode.Angus Gratton
- Previously the call to esp_wifi_set_channel() would be immediately overridden by calling esp_wifi_config(...) with the previous channel set. - AP interface doesn't seem to need more than esp_wifi_config(...) to work. It will automatically configure 40MHz bandwidth and place the secondary channel using similar logic to what was being explicitly calculated here. - However, calling esp_wifi_set_channel() on the STA interface is necessary if using this interface with ESP-NOW (without connecting to an AP). So the esp_wifi_set_channel() call is kept in for this purpose. Without this, tests/multi_espnow/70_channel.py fails. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-28tests/multi_espnow: Add channel setting test, add some docs.Angus Gratton
Test currently passes. It was added so it can be used to check for regressions when fixing channel selection for AP mode in a follow-up commit. Also add some docs about how channel setting is observed to work for ESP-NOW. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-20py/usermod.cmake: If USER_C_MODULES is a folder add micropython.cmake.Andrew Leech
This mirrors how it works when using a Makefile. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2024-11-20py/usermod.cmake: Add check that any specified USER_C_MODULES exists.Andrew Leech
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2024-11-20py/py.mk: Add check that any specified USER_C_MODULES folder exists.Andrew Leech
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2024-11-20extmod/network_cyw43: Allow configuring active AP interface.Angus Gratton
Configuring the AP for cyw43 writes to some buffers that are only sent to the modem when the interface is brought up. This means you can't configure the AP after calling active(True), the new settings seem to be accepted but the radio doesn't change. This is different to the WLAN behaviour on other ports. The esp8266 port requires calling active(True) on the AP before configuring, even. Fix this by bouncing the AP interface after a config change, if it's active. Configuring with active(False) still works the same as before. Adds a static variable to track interface active state, rather than relying on the LWIP interface state. This is because the interface state is updated by a driver callback and there's a race: if code calls active(True) and then config(a=b) then the driver doesn't know it's active yet and the changes aren't correctly applied. It is possible this pattern will cause the AP to come up briefly with the default "PICOabcd" SSID before being reconfigured, however (due to the aforementioned race condition) it seems like this may not happen at all before the new config is applied. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>