The resulting `firmware.zip` file is self contained with everything needed
to deploy the firmware, eg over SE UART.
Signed-off-by: Damien George <damien@micropython.org>
The H7 has a hardware UART FIFO, so it's worth enabling it, to reduce the
chance of missed incoming characters. Note that `HAL_UART_Init(&huart)`
does not activate the FIFO, it must be done explicitly by calling
`HAL_UARTEx_EnableFifoMode(&huart)`.
Signed-off-by: ennyKey <ennyKey@fn.de>
Add support for defining additional GC blocks via linker scripts. A board
would need to define `_gc_blocks_table_start` and `_gc_blocks_table_end`
and within that region have pairs of (address, length) for each GC block
to add.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This pin is used for the camera clock on Portenta carrier, and vision
shield but it doesn't need to be reserved.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
CPython math.nan is positive with regards to copysign. The signaling bit
(aka sign flag) was incorrectly set.
In addition, REPR_C and REPR_D should only use the _true_ nan to prevent
system crash in case of hand-crafted floats. For instance, with REPR_C,
any nan-like float following the pattern
`01111111 1xxxxxxx xxxxxxxx xxxxx1xx` would be switched to an immediate
object or a qstr string. When the qstr index is too large, this would
cause a crash.
This commit fixes the issue, and adds the relevant test cases.
Signed-off-by: Yoctopuce dev <dev@yoctopuce.com>
Since MicroPython supports Zephyr v4.0.0, no need for overlay to enable
PWM. It is enabled by default for a while now.
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Only the board.json files are affected. No other file uses the
style "Sparkfun". The documentation is fine.
Signed-off-by: robert-hh <robert@hammelrath.com>
Add `MICROPY_BOARD_LINKER_SCRIPT` to specify a custom linker script for rp2
boards/variants.
This may, for example, include a PSRAM region so that C buffers or
otherwise can be allocated into PSRAM.
Signed-off-by: Phil Howard <github@gadgetoid.com>
Allow `mpconfigboard.cmake` to specify a custom `MICROPY_BOARD_PINS` to
override `${MICROPY_BOARD_DIR}/pins.csv`.
Signed-off-by: Phil Howard <github@gadgetoid.com>
Set a default MICROPY_HW_FLASH_MAX_FREQ if PICO_FLASH_SPI_CLKDIV
is unset.
Use a divider of 4, which is the default in boot2_generic_03h.S.
Signed-off-by: Phil Howard <github@gadgetoid.com>
Assuming a 133MHz capable flash in 91cff8e4f1
caused `rp2_flash_set_timing_internal` to set out of range dividers for
some boards (anything with value of 4 and flash that doesn't tolerate
higher speeds).
This affected (at least) the XIAO RP2350 board, making it non-bootable.
Since Pico SDK's `PICO_FLASH_SPI_CLKDIV` is entirely unreliable on a system
with a variable system clock (users can change it at runtime) then use it
only to work out a default `MICROPY_HW_FLASH_MAX_FREQ`.
This value can be overridden in board config.
Note that RP2350's default clock is 150MHz, RP2040's is 125MHz and it has
been certified at 200MHz so it's quite possible that
`PICO_FLASH_SPI_CLKDIV` is unreliable even at standard RP2 clocks.
(If flash timings are marginal then this can manifest as instability rather
than outright failure.)
Fixes issue #17375.
Signed-off-by: Phil Howard <github@gadgetoid.com>
In different functions `machine_rtc_config.ext0_pin` is accessed where
SOC_PM_SUPPORT_EXT0_WAKEUP is not defined, fix that.
Signed-off-by: Meir Armon <meirarmon@gmail.com>
Unlike some boards like stm32, timer callbacks on the rp2 port are
unconditionally dispatched via mp_sched_schedule(), behaving like
soft IRQs with consequent GC jitter and delays.
Add a 'hard' keyword argument to the rp2 Timer constructor and init.
This defaults to False but if it is set True, the timer callback will
be dispatched in hard IRQ context rather than queued.
Signed-off-by: Chris Webb <chris@arachsys.com>
Basic update to the renesas-ra port to replace the traditional
`MICROPY_EVENT_POLL_HOOK` with the newer mp_event_wait API as appropriate.
Signed-off-by: Andrew Leech <andrew@alelec.net>
The `esp32.wake_on_ext1()` method should only be available on boards that
have SOC_PM_SUPPORT_EXT1_WAKEUP=y. And update docs to reflect this.
Signed-off-by: Meir Armon <meirarmon@gmail.com>
The `esp32.wake_on_ext0()` method should only be available on boards that
have SOC_PM_SUPPORT_EXT0_WAKEUP=y. And update docs to reflect this.
Signed-off-by: Meir Armon <meirarmon@gmail.com>
The `esp32.wake_on_touch()` method should only be available on boards that
have SOC_TOUCH_SENSOR_SUPPORTED=y. And update docs to reflect this.
Signed-off-by: Meir Armon <meirarmon@gmail.com>
In the case where an mpz number is zero, its `len` is 0 and its `dig` is
NULL. In that case, decrementing NULL via `d--` is undefined behavior
according to the C specification.
Restructuring the loops in this way avoids undefined behavior.
Also, ensure that these cases are tested in the coverage test. This
doesn't make much difference now, but would otherwise cause errors later
when the undefined behavior sanitizer is employed in CI.
Signed-off-by: Jeff Epler <jepler@gmail.com>
The `esp32.wake_on_ulp()` method should only be available on boards that
have SOC_ULP_SUPPORTED=y. Update docs to reflect this.
Signed-off-by: Meir Armon <meirarmon@gmail.com>
Remove the "vfs" entry from all partitions-*.csv files, and then remove
duplicated files.
And remove the ESP32_GENERIC_S3-FLASH_4M variant, because it's no longer
needed.
Signed-off-by: Damien George <damien@micropython.org>
Currently in the esp32 port the size of the SPI flash must be configured at
build time, eg 4MiB, 8MiB, etc. Also, the esp32 partition table must be
configured at build time, which depends on the size of the SPI flash. A
bigger flash means more can be allocated to the user filesystem.
This commit makes it so the SPI flash size is automatically determined at
runtime, and the filesystem size is automatically set to take up as much
room as possible (a "vfs" partition is created automatically if it doesn't
exist).
This works by:
- Setting the SPI flash size to be 4MiB in the build (or some other value,
as long as the firmware app fits).
- Removing the vfs partition from the esp32 partition table (only nvs,
phy_init and firmware, and maybe romfs, remain in the partition table).
- At boot, query the physical size of the SPI flash and use that as the
actual size in the code.
- If it doesn't already exist, automatically create a "vfs" partition which
takes up the flash from the end of all existing partitions to the end of
flash.
This allows simplifying a lot of board configurations, and removing some
board variants that just change the flash size (to be done in a following
commit).
It's also fully backwards compatible, in the following sense:
- Existing boards with MicroPython firmware will continue to work with the
same filesystem, ie the filesystem won't be erased when the firmware is
updated.
- If a user has a custom esp32 partition table and installs MicroPython as
a bare app into the app partition, the new MicroPython firmware will
honour the esp32 partition table and use either "vfs" or "ffat"
partitions as the filesystem.
Signed-off-by: Damien George <damien@micropython.org>
Testing shows that for frequencies which the esp8266 can handle -- up to
about 1kHz -- `machine.time_pulse_us()` now gives more accurate results.
Prior to this commit it would measure on average about 1us lower, but now
the average is much closer to the true value. For example a pulse that is
1000us long, it would measure between 998 and 1000us. Now it measures
between 999us and 1001us.
Signed-off-by: Damien George <damien@micropython.org>
This commit fixes CI test runs for the `nanbox` target, which were
broken by the unconditional native emitter code output changes in the
test runner.
The `nanbox` configuration does not enable native emitters of any kind,
and with a full test run that includes executing emitted native code
things would break when doing CI runs.
This is worked around by introducing a common subset of tests that do
not involve the native emitter, and a more comprehensive set of tests
that include both non-emitter and emitter tests. The `nanbox` CI test
run will stop at the first subset, whilst other configurations will run
that and execute further tests.
Function names have been kept the same for steps that involve native
code, with the `nanbox` subset having another one. This should not
trigger any breakage in existing CI configurations or external scripts.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Most extmod network drivers were being defined on a per-port basis,
duplicating code and making enabling a driver on a new port harder.
This consolidates extmod driver declarations and removes the existing
per-port definitions of them.
This commit has been verified to be a no-op in terms of firmware change.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
This commit updates the ADC to use the new driver `esp_adc/adc_oneshot.h`.
There are several errata notes about not being able to change the bit-width
of the ADCs certain chips. The only chip that can switch resolution to a
lower one is the normal ESP32. ESP32 C2 and S3 are stuck at 12 bits, while
S2 is at 13 bits.
On the S2, you can change the resolution, but it has no effect on the
resolution, rather, it prevents attenuation from working at all!
The resolution is set to the maximum possible for each SoC, with the ESP32
being the only one not throwing errors when trying to set the bit-width to
9, 10, 11 or 12 bits using `ADC.width(bits)`.
Signed-off-by: Damian Nowacki (purewack) bobimaster15@gmail.com
If the interrupt is not freed but merely disabled, instead of reallocating
it every time the timer is enabled again we can instead just re-enable it.
That means we're no longer setting the handler every time, and we need to
ensure it does not change. Doing so by adding an additional wrapper
function does not only solve that problem, it also allows us to remove
some code duplication and simplify how machine_uart uses the timer.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
esp_intr_free is not safe to call from the timer ISR because it requires
the current task (the one the ISR interrupted) to be pinned to the same
core as the interrupt was allocated on. Merely disabling the ISR however is
safe since that only requires that we're currently running on the same core
(which the ISR always is), regardless of the current task.
This was causing deadlocks in machine_uart when the ISR happened to
interrupt a task that was not pinned to a specific core.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
This commit adds an optional configuration option for the ESP8266 port
that, if the board rebooted due to a crash, will print to stdout some
information about the error that triggered the issue.
It is not possible using regular SDK functions to intercept errors and
print information at that stage, and the only error response from the
board is to reboot itself. This is the next best thing, print some
error information just once at boot time after the crash - the least
invasive option given the situation we're in.
This is disabled by default, and can be enabled by enabling
MICROPY_HW_HARD_FAULT_DEBUG in the port configuration - obviously with a
small increase in the firmware code footprint.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Test modified to reschedule itself based on a flag setting. Without the
change in the parent commit, this test executes the callback indefinitely
and hangs but with the change it runs only once each time
mp_handle_pending() is called.
Modified-by: Angus Gratton <angus@redyak.com.au>
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
If the BLE radio stops responding before deinit is called the function can
get stuck waiting for an event that is never received, particularly if the
radio is external or on a separate core.
This commit adds a timeout, similar to the timeout already used in the init
function. Updated for nimble, btstack, esp32 and zephyr bindings.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
The vendor and product fields in the `board.json` files were somewhat
inconsistent. Remove any duplication of the vendor name in the product
field so that `f"{vendor} {product}"` reads well.
In addition to that, update most of the URL's for `board.json` files that
are modified here, and match case and spacing used by the manufacturers for
the vendor and product names.
Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
Implements MSG_PEEK and MSG_DONTWAIT (both passed through to LWIP
sockets API).
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Add support for the boards:
- SparkFun SAMD21 Dev Breakout
- SparkFun RedBoard Turbo
Both boards are SAMD21 based and actively sold by SparkFun.
Signed-off-by: robert-hh <robert@hammelrath.com>
Adding a QSPI memory chip on a STM32G4 does not work due to some small
issues, which are fixed in this commit:
- Rename QUADSPI1_xxx alt-func names to QUADSPI_xxx, to match the static
names used in `qspi.c`.
- Enable `mpu.h` macros on G4.
- Don't include I- and D-cache invalidation on G4.
Signed-off-by: Damien George <damien@micropython.org>
This reverts commit 62e0fa04a7.
Reverting as the only linker wrap needed for nrf port was removed
in the parent commit.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Previously MicroPython ports would linker-wrap dcd_event_handler
in order to schedule the USB task callback to run when needed.
TinyUSB 0.16 added proper support for an event hook to do the
same thing without the hacky linker wrapping.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Changes are:
- Refactor the open-drain macros, add GPIO_ENABLE/DISABLE_OPEN_DRAIN, and
move them to `mphalport.h`.
- Only use `uint64_t` for the open-drain mask if there are more than 32
GPIOs (saves code size).
- Ensure we're shifting a `uint64_t` by using 1ULL constants.
Signed-off-by: Phil Howard <github@gadgetoid.com>
Replace custom macros with Pico SDK functions, enabling support for RP2350B
variant chips with > 32 GPIOs.
Fixes issue #17241.
Signed-off-by: Phil Howard <github@gadgetoid.com>