This commit adds support to the parser so that tuples which contain only
constant elements (bool, int, str, bytes, etc) are immediately converted to
a tuple object. This makes it more efficient to use tuples containing
constant data because they no longer need to be created at runtime by the
bytecode (or native code).
Furthermore, with this improvement constant tuples that are part of frozen
code are now able to be stored fully in ROM (this will be implemented in
later commits).
Code size is increased by about 400 bytes on Cortex-M4 platforms.
See related issue #722.
Signed-off-by: Damien George <damien@micropython.org>
To keep the separate parts of the code that use these values in sync. And
make it easier to add new object types.
Signed-off-by: Damien George <damien@micropython.org>
On ESP32 S2/S3 variants, GPIO0 through GPIO21 are valid RTC pins. This
commit defines the valid RTC_VALID_EXT_PINS for the S2/S3 variants,
otherwise, it keeps functionality the same.
For ESP32-S3 configurations, CONFIG_SPIRAM_MODE_OCT requires pins 33-37 for
PSRAM. So exclude them from the machine_pin_type and machine_pin_irq_type
object tables.
These boards do not build with IDF v4.4 because the section .iram0.text
does not fit in region iram0_0_seg. Enabling SPIRAM increases the code
size so use -Os instead of -O2 to build these boards.
Fixes issue #8260.
Some S2/S3 modules don't use the native USB interface but instead have an
external USB-UART. To make the GENERIC_S3/S3 firmware work on these boards
the UART REPL is enabled in addition to the native USB CDC REPL.
Fixes issues #8418 and #8524.
Signed-off-by: Damien George <damien@micropython.org>
This reverts commit 7e8222ae06.
The prelude data must exist somewhere in the native code so load_raw_code
and mpy-tool.py can access and parse it.
Signed-off-by: Damien George <damien@micropython.org>
If MICROPY_SCHEDULER_STATIC_NODES is enabled then C code can declare a
static mp_sched_node_t and schedule a callback using
mp_sched_schedule_node(). In contrast to using mp_sched_schedule(), the
node version will have at most one pending callback outstanding, and will
always be able to schedule if there is nothing already scheduled on this
node. This guarantees that the the callback will be called exactly once
after it is scheduled.
Signed-off-by: Damien George <damien@micropython.org>
Duplication of characters is caused by re-entrant calls from separate cores
of uart_fill_tx_fifo(). This patch uses a mutex to ensure that a
re-entrant execution of the function returns without affecting the UART
FIFO.
Fixes issues #8344 and #8360.
- Add board-level configuration option to set the SMPS supply mode.
- Wait for valid voltage levels after configuring the SMPS mode.
- Wait for external supply ready flag if SMPS supplies external circuitry.
All user interface (LED, button) code has been moved to ui.c, and the
interface to this code with the rest of the system now goes through calls
to mboot_state_change(). This state-change function can be overridden by a
board to fully customise the user interface behaviour.
Signed-off-by: Damien George <damien@micropython.org>
The Thumb instruction set has special 16 bit encodings for PUSH involving
LR and POP involving PC, which are commonly used in nested functions.
Using this encoding is particularly important for ARMv6-M, where the more
general 32 bit encoding of PUSH and POP is unavailable.
This follows the CPython change: https://bugs.python.org/issue21455
Socket listen backlog defaults to 2 if not given, based on most bare metal
targets not having many resources for a large backlog. On UNIX it defaults
to SOMAXCONN or 128, whichever is less.
Specifying the option `--unsafe-links` (or `-l`) to `mpremote mount` will
allow symlinks to be followed in the local directory that point outside of
the base directory path.
For the unsafe case the `path_check()` method of `PyboardCommand` still
checks for a common path but without expanding symlinks. While this check
is currently redundant, it makes the purpose of the method clearer for
possible future uses or extensions.
Changes in this commit:
- Fix USB CDC RX handling to not block when unprocessed. The fix follows
5873390226.
- Fix dupterm rx.
- Remove some obsolete lines.
This commit changes the method of waiting for SPI being not busy. Instead
of the FIFO size, the TransferBusyFlag is probed.
Also, raise an error if the transfer failed.
Changes in this commit:
- Start the RTC Timer at system boot. Otherwise time.time() will advance
only if an RTC() object was created.
- Set the time to a more recent date than Jan 1, 1970, if not set. That is
2013/10/14, 19:53:11, MicroPython's first commit.
- Compensate an underflow in in timeutils_seconds_since_2000(), called by
time.time(), if the time is set to a pre-2000 date.
This is enabled at MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES, which is the
default for stm32. Not setting the value in mpconfigboard.h allows boards
to optionally configure it.
Signed-off-by: Damien George <damien@micropython.org>
Prior to this commit, the USB CDC OUT endpoint got NACK'd if a character
was received but not consumed by the application, e.g. via
sys.stdin.read(). This meant that USB CDC was blocked and no additional
characters could be sent from the host. In particular a ctrl-C could not
interrupt the application if another character was pending.
To fix the issue, the approach in this commit uses a callback tud_cdc_rx_cb
which is called by the TinyUSB stack on reception of new CDC data. By
consuming the data immediately, the endpoint does not stall anymore. The
previous handler tud_cdc_rx_wanted_cb was made obsolete and removed.
In addition some cleanup was done along the way: by adding interrupt_char.c
and removing the existing code mp_hal_set_interrupt_char(). Also, there is
now only one (stdin) ringbuffer.
Fixes issue #7996.