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>
Frozen identifiers now include their full name hierarchy, eg their class
name. This makes it easier to understand the generated code.
Signed-off-by: Damien George <damien@micropython.org>
The sys.tracebacklimit feature has changed semantics a bit from CPython 3.7
(in the way it modifies the output), so provide a .exp file for the test so
it doesn't rely on CPython.
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>
Now that the native qstr link table is gone, merging a native .mpy file
with a bytecode .mpy file is not as simple as concatenating the .mpy data.
The qstr_table and obj_table tables from all merged .mpy files must now be
joined together, because they are global to the .mpy file (and hence global
to the merged .mpy file). This means the bytecode needs to be be decoded,
qstr_table and obj_table indices updated to point to the correct entries in
the new tables, and then the bytecode re-encoded.
This commit makes this change to the merging feature in mpy-tool.py. This
can now merge an arbitrary number of bytecode .mpy files, and up to one
native .mpy file.
Signed-off-by: Damien George <damien@micropython.org>
This was made redundant by f2040bfc7e, which
also did not update this function for the change to qstr-opcode encoding,
so it does not work correctly anyway.
Signed-off-by: Damien George <damien@micropython.org>
Support for architecture-specific qstr linking was removed in
d4d53e9e11, where native code was changed to
access qstr values via qstr_table. The only remaining use for the special
qstr link table in persistentcode.c is to support native module written in
C, linked via mpy_ld.py. But native modules can also use the standard
module-level qstr_table (and obj_table) which was introduced in the .mpy
file reworking in f2040bfc7e.
This commit removes the remaining native qstr liking support in
persistentcode.c's load_raw_code function, and adds two new relocation
options for constants.qstr_table and constants.obj_table. mpy_ld.py is
updated to use these relocations options instead of the native qstr link
table.
Signed-off-by: Damien George <damien@micropython.org>
This works if your network is pre-configured in boot.py as an object called
"nic". Without this, multitests expects to access the WLAN/LAN class which
isn't always correct.
Signed-off-by: Andrew Leech <andrew@alelec.net>
Otherwise this is essentially an infinite loop on ports that do not use
interrupts to service network interfaces.
Signed-off-by: Andrew Leech <andrew@alelec.net>
Originally based on both stm32/network_wiznet5k and stm32/modnwwiznet5k.
If MICROPY_PY_LWIP is enabled it uses the lwIP TCP stack in MicroPython,
communicating with the Wiznet controller in MACRAW mode. In this mode it
supports using the INTN pin from Wiznet controller to receive data from an
interrupt trigger.
If lwIP is not enabled, it runs in modnetwork/socket mode providing an
interface to the TCP stack running on the Wiznet controller chip. In this
mode it includes some updates by @irinakim12 from #8021, most notably
bringing in DHCP support.
Supports defining hardware pins in board config or dynamically set at
runtime. Sets a default MAC address in the random namespace from board
unique-id.
Signed-off-by: Andrew Leech <andrew@alelec.net>
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.
This fixes the cases where the task being waited on finishes just before or
just after the wait_for itself is cancelled.
Fixes issue #8717.
Signed-off-by: Damien George <damien@micropython.org>
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>