- 13 Aug, 2024 1 commit
-
-
Peter Züger authored
`mbedtls_pk_parse_key()` expects `key_len` to include the NULL terminator for PEM data but not for DER encoded data. This also applies to `mbedtls_x509_crt_parse()` and `cert_len`. Since all PEM data contains "-----BEGIN" this is used to check if the data is PEM (as per mbedtls code). This can be done for both v2 and v3 of mbedtls since the fundamental behaviour/expectation did not change. What changed is that in v3 the PKCS#8 DER parser now checks that the passed key buffer is fully utilized and no bytes are remaining (all other DER formats still do not check this). Signed-off-by: Peter Züger <zueger.peter@icloud.com>
-
- 12 Aug, 2024 2 commits
-
-
Glenn Moloney authored
`get_lan()`: If the ethernet MAC address is uninitialised, set it to the address reserved by the ESP32 for the ETH interface. SPI LAN devices may be initialised with a MAC address of 00:00:00:00:00:00. So check that a valid unicast MAC address has been set (using `LAN.config(mac=...)`) when initialising the LAN interface. Fixes #15425. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
-
Glenn Moloney authored
This PR ensures that `network.LAN.active(True/False)` will succeed if the LAN is already in the desired state. Currently, `lan.active(True)` will raise an `OSError` exception if the LAN is already in the desired state. This is inconsistent with `network.WLAN.active(True/False)` and causes `lan.active(True)` to raise an exception after a soft reset (causing common network startup scripts to fail for LAN interfaces). Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
-
- 08 Aug, 2024 8 commits
-
-
iabdalkader authored
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
-
iabdalkader authored
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
-
iabdalkader authored
These are the new helper functions to use for polling/waiting. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
-
iabdalkader authored
The reason for this change is that it makes allows custom code, that needs to use an MPU region, to find a free one by using this macro or starting from the max number and downwards, without concern that it might change in the future. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
-
iabdalkader authored
The callback arg is not actually required. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
-
iabdalkader authored
Tested with two VMs each running on a different core. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
-
iabdalkader authored
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
-
iabdalkader authored
This causes multiple definition of symbols on some builds. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
-
- 07 Aug, 2024 10 commits
-
-
Alessandro Gatti authored
Add native gchelper support for 64 bits RISC-V RV64I targets. Now that RV64 is under CI, this also enables platform-specific ghelper in the Unix port. Also changes the data type holding the register contents to something more appropriate, so in the remote eventuality somebody wants to use this with RV128 all they have to do is update the `__riscv_xlen` check. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
-
Damien George authored
Gives the same output and keeps things consistent across the code base. Signed-off-by: Damien George <damien@micropython.org>
-
Damien George authored
Updating a set must use `.update()` rather than `.add()`. Also apply the same pattern to qemu-riscv to prevent the same issue when directories/files are added to that port's `tests_profile.txt` file. Signed-off-by: Damien George <damien@micropython.org>
-
Angus Gratton authored
Based on machine_i2s_rate, allows testing basic SPI functionality and timings. Implemented and confirmed working for rp2, esp32, and pyboard. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
-
Damien George authored
This was missed in 9ba04cc7Signed-off-by: Damien George <damien@micropython.org>
-
Damien George authored
Finalisers that run during `gc_sweep_all()` may run native code, for example if an open file is closed and the underlying block device is implemented in native code, then the filesystem driver (eg FAT) may call into the native code. Therefore, native code must be freed after the call to `gc_sweep_all()`. That can only be achieved if the GC heap is not used to store the list of allocated native code blocks. Instead, this commit makes the native code blocks a linked list. Signed-off-by: Damien George <damien@micropython.org>
-
Angus Gratton authored
Without this commit, math.gamma(-float("inf")) returns inf instead of raising a math domain ValueError. Needed for float/math_domain_special.py test to pass on esp32. Root cause is an upstream libm bug, has been reported to ESP-IDF. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
-
Angus Gratton authored
This is needed for a workaround on esp32 port (in child commit), which produces incorrect results otherwise. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
-
Damien George authored
The `emit_load_reg_with_object()` helper function will clobber `REG_TEMP0`. This is currently OK on architectures where `REG_RET` and `REG_TEMP0` are the same (all architectures except RV32), because all callers of `emit_load_reg_with_object()` use either `REG_RET` or `REG_TEMP0` as the destination register. But on RV32 these registers are different and so when `REG_RET` is the destination, `REG_TEMP0` is clobbered, leading to incorrectly generated machine code. This commit fixes the issue simply by using `REG_TEMP0` as the destination register for all uses of `emit_load_reg_with_object()`, and adds a comment to make sure the caller of this function is careful. Signed-off-by: Damien George <damien@micropython.org>
-
Phil Howard authored
Add `machine_i2s_deinit_all` to teardown any active I2S instances on soft reset. Prior to this fix, code using I2S required a try/finally in order to avoid a hard fault on soft reset. Fixes issue #14339. Signed-off-by: Phil Howard <phil@gadgetoid.com>
-
- 02 Aug, 2024 8 commits
-
-
Phil Howard authored
This change has no impact on vanilla MicroPython builds, but is intended to avoid RP2's PIO implementation from trampling PIO usage in USER_C_MODULES. This is consistent with PIOs tracking of used state machines and managed programs, and makes working with PIO in USER_C_MODULES much less of an uphill battle. Since PIO deinit runs before gc_sweep_all it's impossible to work around this wrinkle otherwise. A module finalizer does not get the opportunity to put the PIOs back into a state which wont crash rp2_pio_deinit. Changes are: - init: Avoid exclusive handlers being added to all PIOs and add them only when needed. - deinit: Only remove handlers we have set. - rp2_pio_irq: Add the exlusive handler if needed. - rp2_state_machine_irq: Add the exclusive handler if needed. Signed-off-by: Phil Howard <phil@gadgetoid.com>
-
Phil Howard authored
Reduce mimimum heap requirement. This value allows more room for large, static buffers in user C modules (such as graphics buffers or otherwise) which might be allocated outside of MicroPython's heap to guarantee alignment or avoid fragmentation. Signed-off-by: Phil Howard <phil@gadgetoid.com>
-
Phil Howard authored
Add an 8MB "PIMORONI_TINY2040" variant. Signed-off-by: Phil Howard <phil@gadgetoid.com>
-
Phil Howard authored
Combine the 4MB and 16MB "PIMORONI_PICOLIPO" variants into a single board. Signed-off-by: Phil Howard <phil@gadgetoid.com>
-
Phil Howard authored
Add MICROPY_DEF_BOARD as per esp32 port, allows board variants to override the board name with: list(APPEND MICROPY_DEF_BOARD MICROPY_HW_BOARD_NAME="New Board Name" ) Signed-off-by: Phil Howard <phil@gadgetoid.com>
-
Angus Gratton authored
This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
-
Angus Gratton authored
ESP-IDF driver always requires at least two DMA buffers, so ensure that's the case. Failures during initialisation were being lost because ESP_ERROR_CHECK is configured as a no-op, so the failure was deferred until read() or write() was called on the port. Raise an error from init, instead. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
-
Angus Gratton authored
Also rename the test to reflect that it's a soft timer test. Signed-off-by: Angus Gratton <angus@redyak.com.au>
-
- 01 Aug, 2024 3 commits
-
-
Tim Weber authored
Signed-off-by: Tim Weber <scy@scy.name>
-
George Hopkins authored
Introduce SRC_USERMOD_LIB_ASM to allow users to include assembly files as part of their user modules. It could be used to include optimized functions or outputs of other programming languages. Signed-off-by: George Hopkins <george-hopkins@null.net>
-
Angus Gratton authored
It seems like at some point Espressif NimBLE team changed nimble_port_init and nimble_port_deinit to manage HCI init internally: https://github.com/espressif/esp-nimble/commit/f8a79b04c9743543b8959727d7 This change is included in all the IDF versions that MicroPython supports. As a result, existing code that called esp_nimble_hci_deinit() explicitly would trigger a use-after-free bug and heap corruption (specifically this calls through to ble_transport_deinit() which calls os_mempool_free(). The second time this writes out to a bunch of memory pools where the backing buffers have already been freed.) Symptoms were intermittent random crashes after de-activating Bluetooth (running multi_bluetooth/ble_gatt_data_transfer.py could sometimes reproduce). Setting Heap Poisoning to Comprehensive in menuconfig caused the bug to be detected every time. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
-
- 31 Jul, 2024 3 commits
-
-
iabdalkader authored
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
-
iabdalkader authored
Swap FMC banks to remap the SDRAM bank1 address to 0x60000000. Arduino's M4 firmware uses address 0x60000000 by default. When the elf loader tries to load that it will fail because by default NOR/PSRAM is mapped at that address, not SDRAM bank1. (Note that the region at 0xC0000000 has an XN attribute by default, so switching the M4 firmware address will not work.) Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
-
Andrew Leech authored
Previously it was truncating the first digit of the version if the major number had more than one digit. Signed-off-by: Andrew Leech <andrew@alelec.net>
-
- 26 Jul, 2024 5 commits
-
-
Alessandro Gatti authored
The RV32 code emitter assumed that the arch-specific NLR was used instead of the setjmp/longjmp based NLR code. If the latter NLR provider was chosen, the emitter would allocate space on the stack for the NLR buffer but would not fill it in. This change turns off setjmp()-based NLR and GCREGS for the ESP32C3 target, in favour of more platform-tailored alternatives. As setjmp() NLR is now disabled by default, the RV32 emitter can be safely enabled by default as well for the target in question. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
-
robert-hh authored
Before, the input was still set to `pin.irq()` mode, only the handler was disabled. That prevented switching the pin between input and output mode. Signed-off-by: robert-hh <robert@hammelrath.com>
-
Andrew Leech authored
Signed-off-by: Andrew Leech <andrew@alelec.net>
-
Andrew Leech authored
Older gcc/binutils linker does not support lto with wrap. Signed-off-by: Andrew Leech <andrew@alelec.net>
-
Andrew Leech authored
Signed-off-by: Andrew Leech <andrew@alelec.net>
-