summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-10-24tests/extmod: Add test to compare time_ns with time.Damien George
They should be close together. Signed-off-by: Damien George <damien@micropython.org>
2024-10-24tests/extmod: Use time_ns instead of time in lfs mtime test.Damien George
Because VfsLfs2 uses time_ns to create timestamps for files, and for the test to give consistent results it also needs to use this same function. Signed-off-by: Damien George <damien@micropython.org>
2024-10-24rp2/modmachine: Re-sync time_ns offset when coming out of lightsleep.Damien George
Prior to this fix, `tests/extmod/vfs_lfs_mtime.py` would fail when run after the `tests/ports/rp2/rp2_lightsleep.py` test, because `time.time_ns()` would have a large and constant offset from `time.time()`. Fix this by re-syncing the time-ns offset when coming out of lightsleep. Signed-off-by: Damien George <damien@micropython.org>
2024-10-24tests/extmod: Fix access of RTC class in machine.RTC test.Damien George
This previously passed on some targets that automatically import the `machine` module in `boot.py`. Signed-off-by: Damien George <damien@micropython.org>
2024-10-24tests/extmod: Add a simple test for machine.RTC.Damien George
Tests at least that the datetime can be set and get correctly. Signed-off-by: Damien George <damien@micropython.org>
2024-10-24rp2/datetime_patch: Fix year and month offset for mktime wrapper.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-10-24shared/timeutils: Document the range of year/month/day etc input values.Damien George
These differ to, eg, the standard `mktime()` function. Signed-off-by: Damien George <damien@micropython.org>
2024-10-23extmod/network_wiznet5k: Reset mDNS when interface is brought up.Jared Hancock
The LwIP interface is removed in wiznet5k_deinit() which is called as part of the init sequence. Therefore, if using mDNS, then the interface will need to be re-added when bringing the interface up. Additionally, this allows to set the hostname from MicroPython code prior to bringing the interface up and mDNS responding to the (new) hostname. This allows the hostname to be configured and saved on the flash or be based on dynamic information such as the MAC or unique_id(). Signed-off-by: Jared Hancock <jared.hancock@centeredsolutions.com>
2024-10-22tests/extmod: Support esp32,mimxrt,stm32,samd ports in UART TX test.Damien George
Getting this test running on stm32- and mimxrt-based boards requires adding a small delay after constructing the UART so that the initial idle frame has time to be transmitted before the test starts. Also, the timing margin needs to account for an additional 1-bit worth of time on some MCUs. Thanks to @robert-hh for the esp32, mimxrt and samd settings. Signed-off-by: Damien George <damien@micropython.org>
2024-10-22rp2/mpconfigport: Leave callable pointers alone on RV32.Alessandro Gatti
The port configuration file tagged callable pointers' LSB on both Arm and RISC-V variants. This is needed on Arm due to Thumb/Thumb2 code addresses having their LSB set, but on RISC-V this is not required. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-10-22qemu/mcu/rv32: Fix test of mcause value in lookup_cause.Plaque FCC
Signed-off-by: Plaque FCC <plaque-fcc@github>
2024-10-22esp32/modmachine: Allow building with USB CDC disabled.Volodymyr Shymanskyy
Signed-off-by: Volodymyr Shymanskyy <vshymanskyi@gmail.com>
2024-10-22tests/extmod: Make invalid-blockdev test work consistently on all ports.Damien George
Some ports (eg stm32) configure the FAT driver differently (eg with multi-partition support) and that leads to a slightly different sequence of block reads, compared to other configurations (eg rp2). Comment out the printing in `readblocks()` so the tests are deterministic (the printing is still useful for debugging). Signed-off-by: Damien George <damien@micropython.org>
2024-10-22tests/run-tests.py: Skip large viper test on esp8266.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-10-22tests/micropython: Tweak ringio test for targets with terse errors.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-10-22tests/extmod: Adjust ssl/tls tests to run on targets with axTLS.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-10-22tests/extmod: Config SPI test for esp8266 and skip SoftTimer test.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-10-22extmod/modframebuf: Fix FrameBuffer size check for stride corner-cases.Corran Webster
This is a fix for issue #15944, and handles corner cases in the FrameBuffer code when using stride values where the last line's stride may extend past the end of the underlying buffer. This commit includes extra tests for these corner cases. For example a GS8 format FrameBuffer with a width of 8, height of 2 and stride of 10 should be able to fit into a buffer of size 18 (10 bytes for the first horizontal line, and 8 bytes for the second -- the full 10 bytes are not needed). Similarly a 1 by 9 FrameBuffer in MONO_VLSB format with a stride of 10 should be able to fit into a buffer of length 11 (10 bytes for the first 8 lines, and then one byte for the 9th line. Being able to do this is particularly important when cropping the corner of an existing FrameBuffer, either to copy a sprite or to clip drawing. Signed-off-by: Corran Webster <cwebster@unital.dev>
2024-10-22Revert "stm32/machine_uart: Allow changing only the baudrate."Damien George
This reverts commit c94a3205b044fb27fa703d5c280fb02a094f12e3. The idea behind this reverted commit was that it allowed to reconfigure the UART to change only the baudrate, which is important in the context of a PPP connection where the baudrate may be changed as part of the protocol. Also, other ports like the rp2 port have this behaviour, where individual parameters of the UART can be changed with the `.init()` method. But this commit was no good for a few reasons: 1. It's a subtle breaking change to the UART API, because existing code that constructs or initialises a UART with just the baudrate would expect all other parameters to be reset to their defaults. But with this commit those parameters would remain unchanged. 2. Constructing a UART like `UART(1, 9600)` also hits this code path of only changing the baudrate and does not reset other parameters, which is unexpected. 3. It doesn't support setting the baudrate via keyword, eg `UART.init(baudrate=9600)`. 4. The `timeout_char` field is not updated when changing only the baudrate, which can lead to unexpected timeouts when reading/writing. Due to point (4), this commit broke the `tests/ports/stm32/uart.py` test, the `uart.writechar(1)` has a timeout because the `uart.init(2400)` does not set the `timeout_char` for the new baudrate. Points (2)-(4) could be fixed, but point (1) (being a breaking change) would remain as an issue. So the commit is reverted. Signed-off-by: Damien George <damien@micropython.org>
2024-10-22rp2/machine_uart: Make it so TX is done only when no longer busy.Damien George
Prior to this commit, when flushing a UART on the rp2 port, it returns just before the last character is sent out the wire. Fix this by waiting until the BUSY flag is cleared. This also fixes the behaviour of `UART.txdone()` to return `True` only when the last byte has gone out. Updated docs and tests to match. The test now checks that UART TX time is very close to the expected time (prior, it was just testing that the TX time was less than the expected time). Signed-off-by: Damien George <damien@micropython.org>
2024-10-16py/objtype: Don't delegate lookup of descriptor methods to __getattr__.Damien George
When descriptors are enabled, lookup of the `__get__`, `__set__` and `__delete__` descriptor methods should not be delegated to `__getattr__`. That follows CPython behaviour. Signed-off-by: Damien George <damien@micropython.org>
2024-10-16esp32/mphalport: Always poll stdin ring-buffer to include UART use.Andrew Leech
This fixes a regression introduced in commit 4247921c4ebfced79aa7ccfbb835c9f60ad6f0fc, where this ring-buffer polling was accidentally put inside the `#if MICROPY_HW_ESP_USB_SERIAL_JTAG`. Signed-off-by: Andrew Leech <andrew@alelec.net>
2024-10-15unix/main: Add --version command-line option.Damien George
CPython also has this option. Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2/machine_uart: Clear timeout_char when UART is first constructed.Damien George
Otherwise a previous value of `timeout_char` may be left over after a soft reset. Signed-off-by: Damien George <damien@micropython.org>
2024-10-15tests/run-tests.py: Only run inlineasm tests on rp2 ARM targets.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-10-15tests/ports/rp2: Update lightsleep/machine_idle to skip on RP2350.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-10-15tests/ports/rp2: Add simple rp2-specific UART test.Damien George
To test construction of UART instances. Signed-off-by: Damien George <damien@micropython.org>
2024-10-15tests/ports/rp2: Update DMA test to work on RP2350.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-10-15tools/ci.sh: Add RPI_PICO2 to CI.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2/boards/RPI_PICO2: Add new RPI_PICO2 board definition.Peter Harper
This is the same form-factor as the Pico but with an RP2350. Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2/main: Set CPU frequency to default for the MCU.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2/machine_pwm: Add RP2350 slices to machine.PWM.Phil Howard
Signed-off-by: Phil Howard <phil@gadgetoid.com>
2024-10-15rp2: Workaround pico_aon_timer timezone binary size increase.Angus Gratton
Provide stub implementations of localtime_r() and mktime() to avoid code size increase. Reported upstream at https://github.com/raspberrypi/pico-sdk/issues/1810 This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-10-15rp2/machine_bitstream: Implement bitstream for RISC-V using mcycle.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2/mphalport: Implement mp_hal_ticks_cpu for RISCV using mcycle.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2/machine_uart: Allow new TX/RX pins on RP2350.Dryw Wade
Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2/machine_bitstream: Set SysTick reset value.Dryw Wade
In case it doesn't have the correct value. Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2/Makefile: Allow CMAKE_ARGS to be set by user.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2: Add support for RP2350 in RISCV mode.Damien George
As part of this change, the RV32I native emitter is enabled on RISCV board variants. Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2/machine_adc: Add ADC support for RP2350B.Phil Howard
Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2/clocks_extra: Update runtime_clocks_init based on new pico-sdk.Peter Harper
Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2/machine_pin: Generalise gpio_irq handler for pins >32.Phil Howard
Fix the gpio_irq function so that it looks at all six iobank0_hw->intr[n] registers, for up to 48 IOs. Signed-off-by: Phil Howard <phil@gadgetoid.com>
2024-10-15rp2/machine_pin: Use 64-bit gpio functions to allow gpios >=32 to work.Peter Harper
Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2/boards/make-pins.py: Pass num-gpios/num-ext-gpios into make-pins.Peter Harper
NUM_GPIOS amd NUM_EXT_GPIOS are currently hardcoded in make-pins.py, which makes it difficult to support SoCs with different pin count. This commit generalises make-pins.py by passing in the pin count in via the new arguments `--num-gpios` and `--num-ext-gpios`. These default to the current values supported by Pico, namely 30/10. This can be changed with PICO_NUM_GPIOS and PICO_NUM_EXT_GPIOS in `mpconfigboard.cmake`. Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2/rp2_pio: Add support for RP2350A/B variants in PIO interface.Phil Howard
Add support for 32 and 48 pin variants of RP2350. Add new `PIO.gpio_base()` method, mirroring the Pico SDK. Signed-off-by: Phil Howard <phil@gadgetoid.com> Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2/machine_pin: Move decl of machine_pin_obj_table to public header.Damien George
So other code can include `machine_pin.h` and use the pin name macros such as `pin_GPIO0`. Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2: Add support for 48-pin RP2350 variant.Phil Howard
Update NUM_GPIOS to match NUM_BANK0_GPIOS, and increase bit-width of variables that store pin numbers. Signed-off-by: Phil Howard <phil@gadgetoid.com>
2024-10-15rp2: Integrate RP2350 and use aon_timer instead of rtc API.Peter Harper
This commit separates various build settings and include files that are specific to RP2040 and RP2350, and uses the aon_timer interface instead of rtc, to work across both MCU variants. Signed-off-by: Damien George <damien@micropython.org> Signed-off-by: Phil Howard <phil@gadgetoid.com>
2024-10-15rp2/rp2_dma: Generalise DMA for RP2350.Peter Harper
Two new bits were added to the ctrl register, and existing bits were shifted, so use DMA_CH0_CTRL_TRIG_xxx constants to generalise the code. Signed-off-by: Damien George <damien@micropython.org>
2024-10-15rp2/modmachine: Implement lightsleep for RP2350.Peter Harper
This isn't fully working, the CPU often wakes up early. That will be fixed when a newer version of pico-sdk is released. Signed-off-by: Damien George <damien@micropython.org>