stat_path is only called with stringified vstr_t objects.
Thus, pulling the stringification into the function replaces three
function calls with one, saving a few bytes.
Signed-off-by: Matthias Urlichs <matthias@urlichs.de>
Changes include:
- Some mbedtls source files renamed or deprecated.
- Our `mbedtls_config.h` files are renamed to `mbedtls_config_port.h`, so
they don't clash with mbedtls's new default configuration file named
`mbedtls_config.h`.
- MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE is deprecated.
- MBEDTLS_HAVE_TIME now requires an `mbedtls_ms_time` function to be
defined but it's only used for TLSv1.3 (currently not enabled in
MicroPython so there is a lazy implementation, i.e. seconds * 1000).
- `tests/multi_net/ssl_data.py` is removed (due to deprecation of
MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE), there are the existing
`ssl_cert_rsa.py` and `sslcontext_server_client.py` tests which do very
similar, simple SSL data transfer.
- Tests now use an EC key by default (they are smaller and faster), and the
RSA key has been regenerated due to the old PKCS encoding used by openssl
rsa command, see
https://stackoverflow.com/questions/40822328/openssl-rsa-key-pem-and-der-conversion-does-not-match
(and `tests/README.md` has been updated accordingly).
Signed-off-by: Carlos Gil <carlosgilglez@gmail.com>
Running `./do-mp.sh` now generates this `mp_mbedtls_errors.c` file. The
`esp32_mbedtls_errors.c` file is already up-to-date.
Signed-off-by: Carlos Gil <carlosgilglez@gmail.com>
Prior to this commit it would skip every second cipher returned from
mbedtls.
The corresponding test is also updated and now passes on esp32, rp2, stm32
and unix.
Signed-off-by: Damien George <damien@micropython.org>
This simplifes the port configuration. It enables quite a few new
features, including the `math` and `cmath` modules, adding about 20k to the
firmware size.
Signed-off-by: Damien George <damien@micropython.org>
This is not enabled on any other MCU port, and is essentially unused on
esp8266 because mp_verbose_flag is always 0. Disabling saves ~7k of flash.
Signed-off-by: Damien George <damien@micropython.org>
The standard Arduino pinout uses LEDR/G/B and LED_BUILTIN (if available).
This patch adds aliases to match the standard pinout, while retaining
LED_RED/GREEN/BLUE for compatibility with existing scripts and examples.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This will apply to bare-arm and minimal, as well as the minimal unix
variant.
Change the default to MICROPY_QSTR_BYTES_IN_HASH=1 for the CORE,BASIC
levels, 2 for >=EXTRA.
Removes explicit setting of MICROPY_QSTR_BYTES_IN_HASH==1 in ports that
don't set the feature level (because 1 is implied by the default level,
CORE). Applies to cc3200, pic16bt, powerpc.
Removes explicit setting for nRF (which sets feature level). Also for samd,
which sets CORE for d21 and FULL for d51. This means that d21 is unchanged
with MICROPY_QSTR_BYTES_IN_HASH==1, but d51 now moves from 1 to 2 (roughly
adds 1kiB).
The only remaining port which explicitly set bytes-in-hash is rp2 because
it's high-flash (hence CORE level) but lowish-SRAM, so it's worthwhile
saving the RAM for runtime qstrs.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Sets MICROPY_QSTR_BYTES_IN_HASH==0 on stm32x0 boards.
This saves e.g. 2kiB on NUCLEO_F091.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This disables using qstr hashes altogether, which saves RAM and flash
(two bytes per interned string on a typical build) as well as code size.
On PYBV11 this is worth over 3k flash.
qstr comparison will now be done just by length then data. This affects
qstr_find_strn although this has a negligible performance impact as, for a
given comparison, the length and first character will ~usually be
different anyway.
String hashing (e.g. builtin `hash()` and map.c) now need to compute the
hash dynamically, and for the map case this does come at a performance
cost.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Required modifying the gen-cpydiff.py code to allow a "preamble" section to
be inserted at the top of any of the generated files.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This reverts the change from ce2058685b.
Without abspath, the build artefacts (object files) for boards with source
files are placed outside the build directory, because the BOARD_DIR
variable starts with "..". For the list of source files added to SRC_C,
none of them can start with "..". The usual fix for that would be to make
the files relative to the top of the MicroPython repo (because of the vpath
rule), eg ports/stm32/boards/$(BOARD). But then the $(wildcard ...)
pattern won't find files in this directory.
So abspath is necessary, although it will prevent building when there is a
space in the path. A better solution for spaces needs to be found.
Signed-off-by: Damien George <damien@micropython.org>
These were added back in commit c4935f3049
because the tests required CPython 3.8, which was quite new at the time.
But CPython 3.8 was released over 4 years ago (October 2019) and the CI
test runners, and developers, have this (or a more recent) CPython version.
Removing the .exp files also helps keep MicroPython semantics the same as
CPython.
The asyncio_fair.py test it adjusted slightly to have more deterministic
timing and output.
Signed-off-by: Damien George <damien@micropython.org>
Make can't handle paths with spaces, see https://savannah.gnu.org/bugs/?712
The following workarounds exist:
- When using make's built-in functions:
- Use relative paths wherever possible to avoid spaces in the first
place.
- All spaces in paths can be escaped with backslashes; quotes don't
work.
- Some users use the shell to temporarily rename directories, or to
create symlinks without spaces.
- When using make to pass commands to the system's shell, enclose paths in
quotes. While make will still interpret quoted strings with spaces as
multiple words, the system's shell will correctly parse the resulting
command.
This commit contains the following fixes:
- In ports/stm32/mboot/Makefile: Use relative paths to avoid spaces when
using built-in functions.
- In all other files: Use quotes to enclose paths when make is used to call
shell functions.
All changes have been tested with a directory containing spaces.
Signed-off-by: Iksas <iksas@mailbox.org>
The irq service routine cleared the RT interrupt bit on TX interrupt. This
opens the possibility that an RT interrupt is missed.
Signed-off-by: Maarten van der Schrieck <maarten@thingsconnected.nl>
The `_start` function prototype is now declared as no-return, so `main()`
can't return.
To fix this, `main()` is replaced with `_start`.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
In CMSIS 5.9.0, the compiler headers define `__VECTOR_TABLE`, which will be
substituted with its corresponding value (e.g., `__Vectors` for gcc).
However, the linker script in this port can't include compiler headers when
it's processed, so `__VECTOR_TABLE` is used as the literal variable name,
which results in an undefined linker error.
To fix this, the two possible values of `__VECTOR_TABLE` are both defined
in the linker script.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Adds support to asyncio.gather() for the case that one or more (or all)
sub-tasks finish and/or raise an exception before the gather starts.
Signed-off-by: Damien George <damien@micropython.org>
Switch the RTC clock source to Sub-clock (XCIN). This board has an
accurate LSE crystal, and it should be used for the RTC clock
source.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
No longer require importlib_metadata on new Python versions as it is
included in the standard distribution.
Signed-off-by: Jochen Sprickerhof <git@jochen.sprickerhof.de>
- Completes a longstanding TODO in the code, to not ignore
the optional family, type, proto and flags arguments to
socket.getaddrinfo().
- Note that passing family=socket.AF_INET6 will now cause queries
to fail (OSError -202). Previously this argument was ignored so
IPV4 results were returned instead.
- Optional 'type' argument is now always copied into the result. If not
set, results have type SOCK_STREAM.
- Fixes inconsistency where previously querying mDNS local suffix (.local)
hostnames returned results with socket type 0 (invalid), but all other
queries returned results with socket type SOCK_STREAM (regardless of
'type' argument).
- Optional proto argument is now returned in the result tuple, if supplied.
- Optional flags argument is now passed through to lwIP. lwIP has handling
for AI_NUMERICHOST, AI_V4MAPPED, AI_PASSIVE (untested, constants for
these are not currently exposed in the esp32 socket module).
- Also fixes a possible memory leak in an obscure code path
(lwip_getaddrinfo apparently sometimes returns a result structure with
address "0.0.0.0" instead of failing, and this structure would have been
leaked.)
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This was originally needed because the .c --> .o rule is:
$(BUILD)/%.o: %.c
and because the generated frozen_content.c is inside build-FOO, it must
therefore generate build-FOO/build-FOO/frozen_content.o.
But 2eda513870 added a new build rule for
pins.c that can also be used for frozen_content.c.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
CPython says thread identifier is a "nonzero integer", so rp2 should use a
1-indexed core number rather than 0-indexed. This fixes the
thread/thread_ident1 test failure on rp2 port.
Unfortunately this may be a breaking change for rp2 code which makes a
hard-coded comparison of thread identifier to 0 or 1.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
If there are any free chunks found then it's better to sweep the filesystem
and use the available chunks, rather than error out with ENOSPC when there
is in fact a bit of space remaining.
Signed-off-by: Damien George <damien@micropython.org>
Compare the full absolute path instead of relying on the path form
passed by the user.
For instance, this will make
python3 run-tests.py -d basics
python3 run-tests.py -d ./basics
python3 run-tests.py -d ../tests/basics
python3 run-tests.py -d /full/path/to/basics
all behave the same by correctly treating the bytes_compare3 and
builtin_help tests as special, whereas previously only the first
invocation would do that and hence result in these tests to fail
when called with a different path form.
Signed-off-by: stijn <stijn@ignitron.net>
Increases firmware size by +140 bytes and uses +4 extra bytes of RAM, but
allows the test suite to run without crashing.
Signed-off-by: Damien George <damien@micropython.org>