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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
The `num_stas` was uninitialised and if it happened to take the value 0
then no results were returned. It now has the correct maximum value.
Signed-off-by: Damien George <damien@micropython.org>
This function is documented to return True if any stations are connected to
the AP. Without this fix it returns True whenever the driver has brought
the AP interface up.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
The docs have been authored by many people now. Instead of singling out
individuals in the copyright line, prefer to mention all "MicroPython
authors and contributors".
Individual contributions can still be discovered via the git history.
Signed-off-by: Damien George <damien@micropython.org>
This is currently an implementation detail of MicroPython rather than by
design.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>