When MICROPY_PY_MACHINE_I2C_TRANSFER_WRITE1 is enabled the port's hardware
I2C transfer functions should support the MP_MACHINE_I2C_FLAG_WRITE1
option, but software I2C will not. So add a flag to the I2C protocol
struct so each individual protocol can indicate whether it supports this
option or not.
Fixes issue #8765.
Signed-off-by: Damien George <damien@micropython.org>
Both led_init and led_state are configurable via MBOOT_BOARD_LED_INIT and
MBOOT_BOARD_LED_STATE respectively, so don't need to be MP_WEAK.
Furthermore, led_state and led0_state are private to ui.c so can be made
static.
Signed-off-by: Damien George <damien@micropython.org>
This IO was enabled in IDF commit 68f8b999bb69563f2f3d1d897bc073968f41f3bf,
which is available in IDF release v4.3.2 and above.
Signed-off-by: Damien George <damien@micropython.org>
Otherwise include directories are added unconditionally to the build
variables if the component (submodule) is checked out. This can lead to,
eg, the esp32 build using lib/lwip header files, instead of lwip header
files from the IDF.
Fixes issue #8727.
Signed-off-by: Damien George <damien@micropython.org>
System config block contains hardware unrelated to USB. So calling
`__SYSCFG_CLK_DISABLE()` during `HAL_PCD_MspDeInit()` has an adverse effect
on other system functionality.
Removing call to `__SYSCFG_CLK_DISABLE()` to rectify this issue.
This call was there since the beginning of the USB CDC code, added in
b30c02afa0.
According to ST Errata ES0206 Rev 18, Section 2.2.1, on STM32F427x,
STM32F437x, STM32F429x and STM32F439x.
If the system tick interrupt is enabled during stop mode while certain
bits are set in the DBGMCU_CR, then the system will immediately wake
from stop mode.
Suggested workaround is to disable system tick timer interrupt when
entering stop mode.
According to ST Errate ES0394 Rev 11, Section 2.2.17, on STM32WB55Cx and
STM32WB35Cx.
If the system tick interrupt is enabled during stop 0, stop 1 or stop 2
while certain bits are set in DBGMCU_CR, then system will immediately
wake from stop mode but the system remains in low power state. The CPU
therefore fetches incorrect data from inactive Flash, which can cause a
hard fault.
Suggested workaround is to disable system tick timer interrupt when
entering stop mode.
This was added by mistake in 8f68e26f79 when
adding support for G4 MCUs, which does not using this get_bank() function.
FLASH_OPTR_DBANK is only defined on G4 and L4 MCUs, so on H7 this
FLASH_BANK_2 code was being wrongly excluded.
Signed-off-by: Damien George <damien@micropython.org>
Also remove redundant modusocket.c and modnetwork.c sources, they are
already added by extmod/extmod.cmake.
Signed-off-by: Damien George <damien@micropython.org>
The callback passed to add_alarm_in_ms must return microseconds, even
though the initial delay is in milliseconds. Fix this use, and to avoid
further confusion use the add_alarm_in_us function instead.
Signed-off-by: Damien George <damien@micropython.org>
The nxp_driver v2.10 allows for/requires some changes to the code:
- Remove some part of pwm_backlog.*, which is provided by the lib now.
- Change eth.c: the newer versions have additional parameters of the
library versions.
- Change sdcard.c: use TransferBlocking instead of TransferNonblocking.
- Add some support for the MIMXRT1176 device.
- Set the clocks for UART, I2C, Timer.
- Integrate the I2S module and fix a rebase error.
- Use blocking transfer only for SPI. It's faster and interferes less with
other modules.
- Use the clock_config.c files of library v2.8.5. The mimxrt files keeps
the clock_config.c files from Verson 2.8.5. With clock_config.c from
v2.10, the boards do not work. Refactoring of the clock set-up is on the
to-do list.
- Enable expiry timers for UART, I2C and SPI, avoiding a stall in library
code.
- The clock_config.* files are moved from the board-specific directories to
the boards directory and given a MCU related name.
It's no longer needed because this macro is now processed after
preprocessing the source code via cpp (in the qstr extraction stage), which
means unused MP_REGISTER_MODULE's are filtered out by the preprocessor.
Signed-off-by: Damien George <damien@micropython.org>
This cleans up the parsing of MP_REGISTER_MODULE() and generation of
genhdr/moduledefs.h so that it uses the same process as compressed error
string messages, using the output of qstr extraction.
This makes sure all MP_REGISTER_MODULE()'s that are part of the build are
correctly picked up. Previously the extraction would miss some (eg if you
had a mod.c file in the board directory for an stm32 board).
Build speed is more or less unchanged.
Thanks to @stinos for the ports/windows/msvc/genhdr.targets changes.
Signed-off-by: Damien George <damien@micropython.org>
The following changes are made:
- Use software SPI for external SPI flash access when building mboot.
- Enable the mboot filesystem-loading feature, with FAT FS support.
- Increase the frequency of the CPU when in mboot to 96MHz, to increase the
speed of SPI flash accesses and programming.
Signed-off-by: Damien George <damien@micropython.org>
This allows a board to modify initial_r0 if needed.
Also make default board behaviour functions always available, named as
mboot_get_reset_mode_default and mboot_state_change_default.
Signed-off-by: Damien George <damien@micropython.org>