Set the position of new line tokens as the end of the preceding line
instead of the beginning of the next line. This is done by first moving
the pointer to the end of the current line to skip any whitespace, record
the position for the token, then finaly skip any other line and whitespace.
The previous behavior was to skip every new line and whitespace, including
the indent of the next line, before recording the token position.
(Note that both lex->emit_dent and lex->nested_bracket_level equal 0 if
had_physical_newline == true, which allows simplifying the if-logic for
MP_TOKEN_NEWLINE.)
And update the cmd_parsetree.py test expected output, because the position
of the new-line token has changed.
Fixes issue #12792.
Signed-off-by: Mathieu Serandour <mathieu.serandour@numworks.fr>
It's not worth the effort to update these ports to use boardgen.py, but
put a note just in case anyone uses this as a reference for a new port.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This removes previously unused functionality to generate pins_ad_const.h,
as well as the unused handling of pin AF in machine_pin.c.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Minor change to remove support for using numeric IDs for machine.Pin. This
was previously based on the index of the pin in the board csv, but this is
different (and incompatible) with other ports.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This replaces the previous make-pin-table.py with an implementation based
on boardgen.py.
- MICROPY_PY_MACHINE_PIN_BOARD_CPU macro is removed. This isn't optional
on other ports, so no need for it to be optional on SAMD.
- pin_af_table is removed, and lookups just search the cpu dict instead
(this saves N*wordsize bytes of firmware size to have this extra table).
- pins.csv is now BOARD,CPU to match other ports.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This fixes the H7 af.csv files to include the dual-pad information, by
listing the ADCs supported on the _C pad with a C_ADC prefix.
Minimal change to make-pins.py to ignore these entries. This will be
implemented later to emit constants (similar to ADC.CORE_TEMP) to access
these channels.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Requires additions to tools/boardgen.py for stm32 pin generation.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This is now consistent with other ports.
Also renamed `pin_{board/cpu}_pins_locals_dict` to
`machine_pin_{board/cpu}_pins_locals_dict`.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Changes are:
- Pad all cells to make them easier to read.
- Ensure all files have exactly 19 columns (Port,Pin,AF0-15,ADC)
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Fixes are:
- Comment out lines in pins.csv that do not have valid CPU pins.
It's useful to keep these in the file as "documentation" but in order to
make make-pins.py stricter they need to be commented out.
- Fix some typos (missing P prefix) in pins.csv.
This resulted in some missing board pins.
- Fix some typos in af.csv files.
Some typos of "ADC" and some other that were previously ignored.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
For now, this implements the functionality required for esp32 and rp2,
including support for numeric pins, rp2 alternate functions, and rp2
extended pins.
This also updates the rp2 port to use the same structure for pins.h and
pins.csv as for esp32, and moves the pin definitions directly into the
table (rather than having a table of pointers), which is a small code size
improvement.
Support for "hidden" pins in pins.csv is added (matching the stm32
implementation).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
All ports now use `--board-csv`, `--prefix`, `--output-souce`,
`--output-header` and no longer write to stdout. This matches the esp32
implementation.
Ports that have an AF input use `--af-csv` (to match `--board-csv`).
Any additional output files are now prefixed with `output-` (e.g.
`--output-af-const`).
Default arguments are removed (all makefiles should always specify all
arguments, using default values is likely an error).
Replaced the `af-defs-cmp-strings` and `hdr-obj-decls` args for stm32 with
just `mboot-mode`. Previously they were set on the regular build, now the
logic is reversed so mboot sets it.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
It's not supported on all ports, adds complexity to the build to generate
pins_af.py, and can mostly be replicated just by printing the pin objects.
Remove support for generating pins_af.py from all ports (nrf, stm32,
renesas-ra, mimxrt, rp2).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The output pins.c can be processed for qstrs like any other C file.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The output pins.c can be processed for qstrs like any other C file.
Also remove af_const from Makefile (unimplemented in make-pins.py) and fix
target dependency on ad_const.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The output pins.c can be processed for qstrs like any other C file.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Qstrs are picked up from the generated pin source files in the usual qstr
processing stage.
Similarly for the stm constant qstrs.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Also remove af-const header, as this is left over from the STM32 version
and unused.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This prevents each port Makefile from having to add an explicit rule for
`build-BOARD/pins_BOARD.c`.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This updates a small number of files that change with ruff-format's (vs
black's) rules.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
- Add config for [tool.ruff.format] to pyproject.toml.
- Update pre-commit to run both ruff and ruff-format (and only check C
files when running codeformat.py)
- Update CI.
- Simplify codeformat.py to remove all the Python-specific logic (just run
"ruff format" directly).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This improves (decreases) the latency on stdin, on SoCs with built-in USB
and using TinyUSB, like S2 and S3.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
ESP32-C3 is not Xtensa-based, so build settings are now tailored a bit
better following that fact. ESP-IDF 5.x already adds architecture-specific
modules by itself so there is no need to specify either the `xtensa` or the
`riscv` module in the build settings.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Commit c4e63ace66 enabled the SPI Ethernet
driver and that cost about 13k of firwmare size, pushing the firmware over
the limit of the D2WD and OTA board variants available size.
To fix, disable SPI Ethernet on the D2WD variant, and build the OTA variant
with size optimisation rather than performance optimisation.
Signed-off-by: Damien George <damien@micropython.org>
This port is largely unmaintained, has limited features (the only hardware
support is for GPIO and timer, and no machine module), only supports a
small number of Teensy boards, and can be confused with the mimxrt support
for Teensy 4.x.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Damien George <damien@micropython.org>
nic.isconnected() returns now "True", if a) the physical link is up and b)
an IP address is assigned. The latter happens often by DHCP, in which case
an active connection can be assumed. If the IP address is set manually,
nic.isconnected() would report "True" as well, if at least the physical
link is up. This matches WLAN behaviour which returns "True" when the WLAN
has an IP address.
Before, the behaviour of nic.isconneceted() was erratic, returning "True"
sometimes even without a Ethernet cable attached.
Fixes issue #12741.
Signed-off-by: robert-hh <robert@hammelrath.com>
SPI support was not enabled, and was not adapted for esp-idf v5.x. This
change enables SPI ethernet for all boards and adapts the code for esp-idf
v5.x. The change follows the sample implementation of @hemakumarm72, but
adds the changes for the other adapters as well. Further, it simplifies
the code by removing actions from netwwork_lan.c which are done in the
esp-idf drivers later, like setting the default values for .command_bits
and .address_bits, and registering the SPI interface.
Tested with a Wiznet W5500 breakout.
Signed-off-by: robert-hh <robert@hammelrath.com>
Reduces the CPU usage by the PPP thread by sleeping for one tick if
there was nothing to read; preventing the loop using 100% CPU when the
read operation has a zero timeout and immediately returns.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
Instead use the generic default defined in modbluetooth_nimble.c.
This then also allows custom boards to easily override the default
Bluetooth GAP name.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
If data is pushed over serial/JTAG too fast we may fill up stdin_ringbuf
and not be able to read all the data out of the serial/JTAG buffer. Thus
we need to explicitly poll and read the serial/JTAG RX buffer to prevent
blocking (since if the serial/JTAG buffer is already filled, we will not
get another interrupt to transfer it to the stdin ringbuffer).
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
PPP code assumes that IPv6 support is enabled. Whilst this is the default,
certain applications may want to disable IPv6 support if not needed (or to
reduce code size).
This makes the code build with CONFIG_LWIP_IPV6 disabled, reducing code by
about 30k in that case.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This provides a significant performance boost for qstr_find_strn, which is
called a lot during parsing and loading of .mpy files, as well as interning
of string objects (which happens in most string methods that return new
strings).
Also adds comments to explain the "static" qstrs. These are part of the
.mpy ABI and avoid needing to duplicate string data for QSTRs known to
already be in the firmware. The static pool isn't currently sorted, but in
the future we could either split the static pool into the sorted regions,
or in the next .mpy version just sort them.
Based on initial work done by @amirgon in #6896.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This test depends on the order in which qstrs are stored in ROM, which
affects the order in which `dir()` will probe the object to see what it
supports. Because of the lazy-loading in asyncio/__init__.py, if it
tries to do e.g. `wait_for_ms` before `funcs` then it will import funcs,
making `funcs` later succeed. But in the other way around, `funcs` will
initially not be found.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
These tests are designed to measure changes in performance relating to:
- string interning / searching for existing strings
- map lookup
- string operations
- string hashing
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The flags returned from `select()` were misinterpreted to mean an error had
occurred for the socket, when it's actually just an exceptional condition
for the socket, such as OOB data.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
`ASM_MOV_REG_IMM_FIX_U16` and `ASM_MOV_REG_IMM_FIX_WORD` are no longer
used anywhere in the code.
See discussion in #12771.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>