Age | Commit message (Collapse) | Author |
|
To get division helper functions, eg `__aeabi_uidiv`, `__aeabi_idiv` and
`__aeabi_uidivmod`.
Signed-off-by: Damien George <damien@micropython.org>
|
|
SDK 2.1.1 shipped with PICOTOOL_FETCH_FROM_GIT configured to fetch the
"develop" branch. This broke downstream CI, which was trusting Pico
SDK to fetch the correct version.
RPi have added a "2.1.1-correct-picotool" tag which fixes this.
lib/pico-sdk: Bump to "2.1.1-correct-picotool" tag.
Signed-off-by: Phil Howard <github@gadgetoid.com>
|
|
It seems GCC 14 got stricter with warn/errs like -Wsign-compare and types a
"bare number" as a long int that can't be compared to a (unsigned) size_t.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
|
|
Commit dc2fcfcc5511a371ff684f7d7772e7a7b479246d seems to have accidentally
changed the ruff quote style to "preserve", instead of keeping it at the
default which is "double".
Put it back to the default and update relevant .py files with this rule.
Signed-off-by: Damien George <damien@micropython.org>
|
|
Without this there's a build error on macOS (at least). This was likely
due to a combination of 9b7d85227e67a7edd608aab4ff7eb4a838651f75 and
df05caea6c6437a8b4756ec502a5e6210f4b6256.
Signed-off-by: Damien George <damien@micropython.org>
|
|
There is currently no build using REPR_C in the unix CI tests. As
discussed in PR #16953, this is something that combines well with the
longlong build.
Signed-off-by: Yoctopuce dev <dev@yoctopuce.com>
|
|
Current implementation of REPR_C works by clearing the two lower bits of
the mantissa to zero. As this happens after each floating point operation,
this tends to bias floating point numbers towards zero, causing decimals
like .9997 instead of rounded numbers. This is visible in test cases
involving repeated computations, such as `tests/misc/rge_sm.py` for
instance.
The suggested fix fills in the missing bits by copying the previous two
bits. Although this cannot recreate missing information, it fixes the bias
by inserting plausible values for the lost bits, at a relatively low cost.
Some float tests involving irrational numbers have to be softened in case
of REPR_C, as the 30 bits are not always enough to fulfill the expectations
of the original test, and the change may randomly affect the last digits.
Such cases have been made explicit by testing for REPR_C or by adding a
clear comment.
The perf_test fft code was also missing a call to round() before casting a
log_2 operation to int, which was causing a failure due to a last-decimal
change.
Signed-off-by: Yoctopuce dev <dev@yoctopuce.com>
|
|
When this configuration flag is set, VfsPosix instances can be written.
Otherwise, they will always be created "read only".
This flag is useful when fuzzing micropython: Without VfsPosix, the fuzzing
input script cannot be read; but with writable VfsPosix, fuzzing scripts
can potentially perform undesired operations on the host filesystem.
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
Otherwise operations such as unlink can be performed on a nominally
read-only VfsPosix.
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
I noticed that operations such as unlink could be performed on a nominally
read-only VfsPosix.
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
Back in LFS2 version 2.6 they updated the on-disk version from 2.0 to 2.1
which broke back compatibility (aka older versions could no long read new
version disk format), see
https://github.com/littlefs-project/littlefs/releases/tag/v2.6.0
Then in LFS2 v2.7 an optional `config->disk_version` was added to force the
library to use an older disk format instead, see:
https://github.com/littlefs-project/littlefs/releases/tag/v2.7.0
This commit simply exposes `config->disk_version` as a compile time option
if LFS2_MULTIVERSION is set, otherwise there is no change in behavior.
This is Useful for compatibility with older LFS versions.
Note: LFS2_MULTIVERSION needs to be defined at the make / CFLAGS level,
setting it in mpconfigboard.h doesn't work as it's not included in the
`lfs2.c` file in any way.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
|
|
This is an annoying regression caused by including mpconfig.h in 36922df -
the mimxrt platform headers define ARRAY_SIZE and mbedtls also defines in
some source files, using a different parameter name which is a warning in
gcc.
Technically mimxrt SDK is to blame here, but as this isn't a named warning
in gcc the only way to work around it in the mimxrt port would be to
disable all warnings when building this particular mbedTLS source file.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
The original version of this test had to exchange a 1 byte UDP packet
before the DTLS handshake. This is no longer needed due to MSG_PEEK
support.
The test also doesn't work with HelloVerify enabled, as the first
connection attempt always fails with an
MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED result. Anticipate this by listening
for the client twice on the server side.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
- DTLS spec recommends HelloVerify and Anti Replay protection be enabled,
and these are enabled in the default mbedTLS config. Implement them here.
- To help compensate for the possible increase in code size, add a
MICROPY_PY_SSL_DTLS build config macro that's enabled for EXTRA and
above by default.
This allows bare metal mbedTLS ports to use DTLS with HelloVerify support.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
This is already enabled in the ESP-IDF mbedTLS config, so provide an
implementation of the cookie store functions. This allows DTLS connections
between two esp32 boards.
The session cookie store is a very simple dictionary associated with the
SSLContext. To work, the server needs to reuse the same SSLContext (but
cookies are never cleaned up, so a server with a high number of clients
should recycle the context periodically.)
Server code still needs to handle the MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED
error by waiting for the next UDP packet from the client.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
With the recent update to ESP-IDF 5.4.2, there is a change in BLE event
behaviour which makes `tests/multi_bluetooth/ble_mtu.py` and
`tests/multi_bluetooth/ble_mtu_peripheral.py` now fail on ESP32 with IDF
5.4.2.
The change in behaviour is that MTU_EXCHANGE events can now occur before
CENTRAL_CONNECT/PERIPHERAL_CONNECT events. That seems a bit strange,
because the MTU exchange occurs after the connection. And looking at the
timing of the events there is exactly 100ms between them, ie MTU_EXCHANGE
fires and then exactly 100ms later CENTRAL_CONNECT/PERIPHERAL_CONNECT
fires.
It's unknown if this is a bug in (Espressif's) NimBLE, a subtle change in
scheduling with still valid behaviour, an intended change, a change allowed
under the BLE spec, or something else.
But in order to move forward with updating to IDF 5.4.2, the relevant tests
have been adjusted so they can pass. The test just needs to wait a bit
between doing the connect and doing the MTU exchange, so the other side
sees the original/correct ordering of events. This wait is done using the
multitest synchronisation primitives (broadcast and wait).
Signed-off-by: Damien George <damien@micropython.org>
|
|
This is a patch release of the IDF. Comparing with 5.4.1, firmware size is
up by about 1.5k on ESP32 and 9k on ESP32-S3. But IRAM usage (of the IDF)
is down by about 500 byte on ESP32 and DRAM usage is down by about 20k on
ESP32 and 10k on ESP32-S3.
Testing on ESP32, ESP32-S2, ESP32-S3 and ESP32-C3 shows no regressions,
except in BLE MTU ordering (the MTU exchange event occuring before the
connect event).
Signed-off-by: Damien George <damien@micropython.org>
|
|
This is no longer needed, the esp32 port can now pass this test using just
a single UART.
Signed-off-by: Damien George <damien@micropython.org>
|
|
Currently, `UART.sendbreak()` on esp32 will reconfigure the UART to a
slower baudrate and send out a null byte, to synthesise a break condition.
That's not great because it changes the baudrate of the RX path as well,
which could miss incoming bytes while sending the break.
This commit changes the sendbreak implementation to just reconfigure the TX
pin as GPIO in output mode, and hold the pin low for the required duration.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This parameter is already used for PC-based tests (eg unix and webassembly
ports), and it makes sense for it to be used for bare-metal ports as well.
That way the timeout is configurable for all targets.
Because this increases the default timeout from 10s to 30s, this fixes some
long-running tests that would previously fail due to a timeout such as
`thread/stress_aes.py` on ESP32.
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
The `run-perfbench.py` test is run as part of CI, but the actual
performance results are not used. Rather, the test is just testing that
all the performance tests run correctly.
So there's no need to run with the default averaging of 8 (which runs each
test 8 times and takes the average time for the performance result) which
can take a lot of time for slower builds, eg unix sanitize, settrace and
stackless builds.
This commit changes the averaging to just 1.
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
The native emitter will not release/bounce the GIL when running code, so
if it runs tight loops then no other threads get a chance to run (if the
GIL is enabled). So for the thread tests, explicitly include a call to
`time.sleep(0)` (or equivalent) to bounce the GIL and give other threads a
chance to run.
For some tests (eg `thread_coop.py`) the whole point of the test is to test
that the GIL is correctly bounced. So for those cases force the use of the
bytecode emitter for the busy functions.
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
The unix port can now be built with the GIL enabled, by passing
MICROPY_PY_THREAD_GIL=1 on the make command line.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This test passes sometimes and fails other times. Eventually that should
be fixed, but for now just skip this test.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This test passes sometimes and fails other times. Eventually that should
be fixed, but for now just skip this test.
Signed-off-by: Damien George <damien@micropython.org>
|
|
Stackless mode makes `tests/thread/stress_aes.py` slow, around 75 seconds
for this CI job (probably due to contention among the many threads for the
GC lock, to allocate frames for function calls). So increase the timeout
to allow this test to pass.
Signed-off-by: Damien George <damien@micropython.org>
|
|
The qemu emulation introduces enough overhead that the
`tests/thread/stress_aes.py` test overruns the default timeout. So
increase it to allow this test to pass.
Signed-off-by: Damien George <damien@micropython.org>
|
|
When detecting the target platform, also check if it has threading and
whether the GIL is enabled or not (using the new attribute
`sys.implementation._thread`). If threading is available, add the thread
tests to the set of tests to run (unless the set of tests is explicitly
given).
With this change, the unix port no longer needs to explicitly run the set
of thread tests, so that line has been removed from the Makefile.
This change will make sure thread tests are run with other testing
combinations. In particular, thread tests are now run:
- on the unix port with the native emitter
- on macOS builds
- on unix qemu, the architectures MIPS, ARM and RISCV-64
Signed-off-by: Damien George <damien@micropython.org>
|
|
This thread stress test is quite intensive and can run for a long time on
certain targets. For example, builds with stackless enabled are slower
than non-stackless, and this test in stackless mode takes around 2 minutes
on the unix port of MicroPython with the existing parameters of
`n_thread=20` and `n_loop=5`.
It's not really necessary to test 20 threads at once, that's not really
going to test anything more than 10 at once. So reduce the parameters to
keep the running time reasonable.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This is a workaround for the case where threading is enabled without a GIL.
In such a configuration, creating a new global variable is not atomic and
threads have race conditions resizing/accessing the global dict.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This is useful to distinguish between GIL and non-GIL builds.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This commit adds some documentation on what are the limitations of using
Picolibc as a standard C library for native modules.
This also contains a reference to the "errno" issue when building
natmods on RV32 that the PR this commit is part of, as it is not obvious
how to approach this issue when encountered for the first time.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit fixes building the "btree" example natmod on RV32 when
Picolibc is being used and uses thread-local storage for storing the
errno variable.
The fix is surprisingly simple: Picolibc allows overriding the function
that will provide a pointer to the "errno" variable, and the btree
natmod integration code already has all of this machinery set up as part
of its library integration. Redirecting Picolibc to the already
existing pointer provider function via a compile-time definition is
enough to let the module compile and pass QEMU tests.
This workaround will work on any Picolibc versions (Arm, RV32, Xtensa,
etc.) even if TLS support was not enabled to begin with, and will
effectively do nothing if the toolchain used will rely on Newlib to
provide standard C library functions.
Given that the btree module now builds and passes the relevant natmod
tests, said module is now part of the QEMU port's natmod testing
procedure, and CI now will build the btree module for RV32 as part to
its checks.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This aligns the prefix string in L285 to that in L284 though the
two strings have equal length.
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
|
|
This mutes usage error for blobless update from older `git` to
reduce noise upon submodule updating.
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
|
|
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
If big integer support is 'long long' then mp_parse_num_integer() can
parse to it directly instead of failing over from small int. This means
strtoll() is no longer pulled in, and fixes some bugs parsing long long
integers (i.e. can now parse negative values correctly, can now parse
values which aren't NULL terminated).
The (default) smallint parsing compiled code should stay the same here,
macros and a typedef are used to abstract some parts of it out.
When bigint is long long we parse to 'unsigned long long' first (to avoid
the code size hit of pulling in signed 64-bit math routines) and the
convert to signed at the end.
One tricky case this routine correctly overflows on is
int("9223372036854775808") which is one more than LLONG_MAX in decimal. No
unit test case added for this as it's too hard to detect 64-bit long
integer mode.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
Makes it compatible with the __builtin_mul_overflow() syntax, used in
follow-up commit.
Includes optimisation in runtime.c to minimise the code size impact from
additional param.
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
Long long big integer support now raises an exception on overflow rather
than returning an undefined result.
Also adds an error when shifting by a negative value.
The new arithmetic checks are added in the misc.h header.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
The other performance tests run and pass with only 64-bit big integer
support.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
Relies on arbitrary precision math, so won't run on a port which
has threads & limited bigint support.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
These tests cover the use of mp_obj_new_int_from_str_len when
mp_parse_num_integer overflows the SMALLINT limit, and also the case where
the value may not be null terminated.
Placed in a separate test file so that extmod/json test doesn't rely on
bigint support.
Signed-off-by: Yoctopuce dev <dev@yoctopuce.com>
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
These will run on all ports which support them, but importantly
they'll also run on ports that don't support arbitrary precision
but do support 64-bit long ints.
Includes some test workarounds to account for things which will overflow
once "long long" big integers overflow (added in follow-up commit):
- uctypes_array_load_store test was failing already, now won't parse.
- all the ffi_int tests contain 64-bit unsigned values, that won't parse
as long long.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
This commit improves get handling by guarding against implicit unknown
symbols accessed directly by specific JS native APIs.
Fixes issue #17657.
Signed-off-by: Andrea Giammarchi <andrea.giammarchi@gmail.com>
|