Open
Conversation
|
The current version (before the incoming merge) has a bug while trying to compile ports/unix. I have to edit the code of the AXTLS library: -------------------------- ssl/os_port_micropython.h -------------------------- #define TTY_FLUSH() -#include "../../../extmod/crypto-algorithms/sha256.h" #define SHA256_CTX CRYAL_SHA256_CTX |
This commit updates the Unix/MIPS target's environment to use the latest available LTS version of Ubuntu Linux (24.04). Since the new OS updated some key components used in the CI build process, a few modifications have been made to the setup and build procedure. Newer QEMU's sysroot location changed and the "static" variant of the QEMU emulators has to be used to make binfmt work, and updated autotools versions split some macros into an optional package that has to be manually installed. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit updates the Unix/Arm target's environment to use the latest available LTS version of Ubuntu Linux (24.04). Since the new OS updated some key components used in the CI build process, a few modifications have been made to the setup and build procedure. Newer QEMU's sysroot location changed and the "static" variant of the QEMU emulators has to be used to make binfmt work, and updated autotools versions split some macros into an optional package that has to be manually installed. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit forces the installation of CPython 3.11 instead of CPython 3.12 in the OS image for Unix/RV64 CI jobs. CPython 3.12 is not compatible with settrace tests, but it is the CPython version that is installed by default in "ubuntu-latest" (which is Ubuntu 24.04 LTS right now). Updating the base image for the RV64 tests also disabled settrace tests to work around its incompatibility, however turns out there is a way to force CI to set up a base OS image with an arbitrary CPython version. Now the RV64 CI jobs are now going to be executed using CPython 3.11, and thus the settrace tests can be removed from the ignore list. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Also make sure code_size runs when the esp32 port source changes, as per the other ports that are built as part of code_size. Signed-off-by: Jeff Epler <jepler@unpythonic.net> Signed-off-by: Damien George <damien@micropython.org>
This commit updates the Unix/x86 target's environment to use the latest available LTS version of Ubuntu Linux (24.04). Since the new OS updated some key components used in the CI build process, a few modifications have been made to the setup and build procedure. The new OS introduces a CPython version that is known to not be compatible with a subset of settrace tests, so even though the OS is updated, an older version of CPython is installed as part of the image provisioning process. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit changes the way native modules' trampoline code sequence is emitted, generating an optimised code sequence to jump to the entry symbol. Turns out the address of the entry point is known even before the segments are built and the address of the entry point doesn't change when processing the module on anything but Xtensa. This means that the jump trampoline doesn't have to be a dummy fixed-size block to be filled in later, but it can be the final trampoline being used in the module. On Xtensa the address of the symbol is offset by the length of the literals pool, but since the trampoline being generated is always the shortest one said platform is left alone (handling distances greater than 128KiB would require more extensive changes). Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit lets "tools/mpy_ld.py" store architecture flags in generated
MPY files if explicitly requested, like "mpy-cross" does.
To achieve this, a new command-line option ("--arch-flags") was added to
receive the architecture flags value, accepting the same arguments'
format as "mpy-cross", and performing the same input validation.
The rest of the MPY toolchain was also modified to let the user pass the
arch flags to standard native module makefiles. Given that there's
already a well-established "ARCH" argument, "ARCH_FLAGS" was chosen to
pass the optional flags to "mpy_ld.py".
Finally, documentation was updated to mention the new variable.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](actions/cache@v4...v5) --- updated-dependencies: - dependency-name: actions/cache dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Damien George <damien@micropython.org>
"MicroPython" is sometimes misspelled as "Micropython". Add an explicit check for that as part of CI (note that codespell doesn't consider case when spelling, hence the need to do it this way). Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
SPIRAM usually uses GPIO 9 and 10 on ESP32, so don't use them as default UART pins. Fixes issue #18544. Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Elvis Pfutzenreuter <elvis.pfutzenreuter@gmail.com>
According to https://wiki.seeedstudio.com/xiao_esp32c6_getting_started/#demo1-deep-sleep-with-external-wake-up and https://docs.espressif.com/projects/esp-idf/en/stable/esp32c6/api-reference/peripherals/gpio.html ESP32C6 supports RTC/LP on Pins 0-7. Signed-off-by: FH <fh3095-gitcommit@yahoo.com>
The main functional change here is to make sure that the SDMMC1/2 clocks are enabled in low power mode; they were not previously enabled for SD card use, only WLAN. It doesn't hurt to unconditionally enable the clocks in low power, like all the other peripherals. Signed-off-by: Damien George <damien@micropython.org>
This doubles the speed of SD card transfers. Signed-off-by: Damien George <damien@micropython.org>
And fix typo in the usage string of plli2svalues.py. Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
The existing linker script for F412 is renamed to separate F412xG (with 1MB RAM) from F412xE (with 512K). Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
Configuration: - Clock is 8MHz from STLINK MCO, CPU runs at 400MHz - REPL on USB and on UART connected to ST-Link interface - Storage is configured for internal flash memory - 3x LEDs and 1x user button - Ethernet Product page: https://www.st.com/en/evaluation-tools/nucleo-h753zi.html Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
To connect STM32H7 that is in SLEEPD1 state (e.g. during REPL) debuggers like st-flash or openocd must assert SRST. Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
STM32CubeMX shows a conflict of UART5 with ETH MII. However UART1 can be used with TX and RX on the pin headers. PLL1Q is reduced from 200 to 100 MHz because it may be used for FDCAN or SDMMC. FDCAN needs <= 150 MHz, and 100 MHz is enough for an SDCard connected to pin headers to work reliably. Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
This commit fixes tests that will always fail when using CPython 3.14 to get a known-good output to compare MicroPython's behaviour against. Starting from CPython 3.14, statements inside a `finally` block that will prevent the execution flow to reach the block's last statement will raise a SyntaxWarning. That text would end up in the comparison data and thus make known-good tests fail. Given that those tests explicitly exercise flow control interruptions in finally blocks, there is no real workaround that can be applied to the tests themselves. Therefore those tests will now check MicroPython's behaviour against expected output files recorded from the tests' output with CPython 3.11. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit makes tests exercising certain math functions' limit work when using CPython 3.14 to validate the tests' output. CPython 3.14 introduced more descriptive messages when math domain error conditions are encountered rather than a single generic message. This breaks the tests in question as MicroPython uses a single error message when reporting these conditions (both to closely follow CPython and to save firmware space). The math domain tests now look for an error pattern that is compatible with both CPython 3.14 and previous versions, converting messages in the newer format into the previous one. This makes the tests' behaviour under MicroPython comparable with CPython for the foreseeable future. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit fixes a test exercising complex numbers creation, working around a deprecation introduced in CPython 3.14. Creating complex numbers using a complex number as the real part in the constructor is deprecated in CPython 3.14, but that construction method is still supported by MicroPython and covered by tests. To work around this, the specific constructor is extracted into its own test, providing an expected output file recorded using CPython 3.11. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
As of January 12 the default Python version changed from 3.9 to 3.12, and 3.12 has issues running the settrace tests. 3.13 seems to also have some issues, so setting 3.11 for now. See actions/runner-images#13468 Signed-off-by: Angus Gratton <angus@redyak.com.au>
This test was ignored since 2020, which hid a new bug in the test for the native emitter added in 2024. Hopefully other changes to the test will make it more reliable. Signed-off-by: Jeff Epler <jepler@unpythonic.net>
Locally, this changes the duration of the test from about 2.7s to 0.3s. Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This ensures that zero-duration sleeps run scheduled callbacks. Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This ensures that zero-duration delays run scheduled callbacks. Signed-off-by: Jeff Epler <jepler@unpythonic.net>
Some MCUs (eg N6) have more timers which are 32-bit, and it's best to use this macro to work that out. Signed-off-by: Damien George <damien@micropython.org>
This functionality already exists in the TIM code, and can be reused by the upcoming PWM implementation. Signed-off-by: Damien George <damien@micropython.org>
This commit implements the standard `machine.PWM` class on stm32, using the common bindings in `extmod/machine_pwm.c`. Features implemented are: - construct a PWM object from a pin, with automatic selection of TIM instance and channel; - get and set freq, duty_u16 and duty_ns; - optionally invert the output. The PWM objects are static objects (partly in ROM, partly in RAM) so creating a PWM instance on the same pin will return exactly the same object. That's consistent with other peripherals in the stm32 port, and consistent with other PWM implementations (eg rp2). When creating a PWM object on a pin, if that pin has multiple TIM instances then only the first will be selected. A future extension could allow selecting the TIM/channel (eg similar to how ADCBlock allows selecting an ADC). Signed-off-by: Damien George <damien@micropython.org>
When assigning a TIMx_CHy to a pin, the second available alternate function is chosen (or the first if there is only one). This gives better overall static allocation of TIM's to pins. On most MCUs (eg F4, F7, H5, H7) picking the second gives TIM5_CH[1-4] for PA0-PA3, and TIM5 is a 32-bit timer. That leaves TIM2 (also usually on PA0-PA3) for other pins that only have TIM2. For STM32G0, STM32L432 and STM32L452 the heuristic is to simply use the first available alternate function because that gives TIM2 (a 32-bit timer) on PA0-PA3. The above heuristic guarantees that PA0-PA3 always get a 32-bit timer on all supported MCUs. Signed-off-by: Damien George <damien@micropython.org>
To be slightly more accurate computing the expected low/high times for the PWM output. Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
This allows the newly-added `machine.PWM` class to fit on these boards, which is arguably more useful than the features disabled in this commit. Signed-off-by: Damien George <damien@micropython.org>
So that TIM2_CH1 can be used. Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Intended to catch problems where new features don't build in old ESP-IDF. Includes major refactor to the GitHub Actions Workflow for esp32 port, including making a reusable workflow for both Code Size and ESP32 build jobs. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Signed-off-by: Damien George <damien@micropython.org>
This commit updates the listed limitations of the native emitter in the documentation related to how to increase speed of python code. Context managers are supported, as in functions marked as native can use the `with` statement in regular code. Generators can be used in native functions both on the emitting (ie. `yield <whatever>`) and on the receiving end. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit fixes an issue related to the NimBLE initialisation procedure in low memory environments on ESP32 boards. MicroPython uses at least two different NimBLE stacks across the supported ports, mynewt (imported as an external library), and the one provided by Espressif in their own SDKs. The problem is that these two ports differ in the signature for `nimble_port_init(void)`, with mynewt returning `void`, and Espressif's returning a status code on failure. On ESP32 boards, allocating almost all the available heap and then turning on the Bluetooth stack would trigger a failure in the NimBLE initialisation function that is not handled by the NimBLE integration code, as there's no expectation of a recoverable condition. Since the stack initialisation would progress, then uninitialised memory accesses crash the board. Since we cannot really modify neither mynewt nor Espressif SDKs, the next best thing is to provide two conditional initialisation paths depending on a configuration setting. This would make Espressif ports recover from a failed initialisation whilst retaining the existing behaviour on other ports. This fixes #14293. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Because socket objects have a finaliser they must be created carefully, in case an exception is raised during the population of their members, eg invalid input argument or out-of-memory when allocating additional arrays. Prior to the fix in this commit, the finaliser would crash due to `incoming.udp_raw.array` being an invalid pointer in the following cases: - if a SOCK_RAW was created with a proto argument that was not an integer - if a SOCK_DGRAM or SOCK_RAW was created where the allocation of `lwip_incoming_packet_t` failed - if an integer was passed in for the socket type but it was not one of SOCK_STREAM, SOCK_DGRAM or SOCK_RAW Furthermore, if the allocation of `lwip_incoming_packet_t` failed then it may have led to corruption within lwIP when freeing `socket->pcb.raw` because that PCB was not fully set up with its callbacks. This commit fixes all of these issues by ensuring: - `pcb.tcp` and `incoming.udp_raw.array` are initialised to NULL early on - the proto argument is parsed before allocating the PCB - the allocation of `lwip_incoming_packet_t` occurs befor allocating the PCB - `incoming.udp_raw.array` is checked for NULL in the finaliser code The corresponding test (which already checked most of these causes of failure) has been updated to include a previously-uncovered scenario. Signed-off-by: Damien George <damien@micropython.org>
User callbacks allow code to respond to incoming messages without blocking or polling. User callbacks are optional, and if no callback is registered the code has no effect. The mechanism is the same as for TCP: when a connection is accepted or a TCP packet is received, a user callback is executed. Fixes issue #3594. Signed-off-by: Jack Whitham <jack.d.whitham@gmail.com>
Add DMA, NPU and PDM IRQ priorities to irq.h. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2.25k Seems necessary so it doesn't crash `thread/thread_stacksize1.py`. But 2.5k gives a little extra headroom to make that test actually pass. Signed-off-by: Damien George <damien@micropython.org>
With the recent addition of `machine.PWM` and `machine.CAN`, the internal flash of PYBD_SF3 overflows by about 300 bytes. This commit moves the inline assembler compiler functions from internal to external QSPI flash. That frees up about 3k internal flash, and shouldn't affect performance. Signed-off-by: Damien George <damien@micropython.org>
qstr literals are of type qstr_short_t (aka uint16_t) for efficiency, but when the type is passed to `mp_printf` it must be cast explicitly to type `qstr`. These locations were found using an experimental gcc plugin for `mp_printf` error checking. Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This adds support for the standard `weakref` module, to make weak references to Python objects and have callbacks for when an object is reclaimed by the GC. This feature was requested by PyScript, to allow control over the lifetime of external proxy objects (distinct from JS<->Python proxies). Addresses issue #646 (that's nearly a 12 year old issue!). Functionality added here: - `weakref.ref(object [, callback])` create a simple weak reference with optional callback to be called when the object is reclaimed by the GC - `weakref.finalize(object, callback, /, *args, **kwargs)` create a finalize object that holds a weak reference to an object and allows more convenient callback usage and state change The new module is enabled at the "everything" level. The implementation aims to be as efficient as possible, by adding another bit-per-block to the garbage collector, the WTB (weak table). Similar to the finalizer bit (FTB), if a GC block has its corresponding WTB bit set then a weak reference to that block is held. The details of that weak reference are stored in a global map, `mp_weakref_map`, which maps weak reference to ref/finalize objects, allowing the callbacks to be efficiently found when the object is reclaimed. With this feature enabled the overhead is: - 1/128th of the available memory is used for the new WTB table (eg a 128k heap now needs an extra 1k for the WTB). - Code size is increased. - At garbage collection time, there is a small overhead to check if the collected objects had weak references. This check is the same as the existing FTB finaliser scan, so shouldn't add much overhead. If there are weak reference objects alive (ref/finalize objects) then additional time is taken to call the callbacks and do some accounting to clean up the used weak reference. Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Needs a native exp file because native code doesn't print line numbers in the traceback. Signed-off-by: Damien George <damien@micropython.org>
Following a69425b, this is a convenient way to run a subset of tests. Signed-off-by: Damien George <damien@micropython.org>
The webassembly port needs some additional weakref tests due to the fact that garbage collection only happens when Python execution finishes and JavaScript resumes. The `tests/ports/webassembly/heap_expand.py` expected output also needs to be updated because the amount of GC heap got smaller (weakref WTB takes some of the available RAM). Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
It takes longer now that weakref is enabled in the coverage build. Signed-off-by: Damien George <damien@micropython.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.