__GPIOI_CLK_ENABLE is defined in hal/l4/inc/Legacy/stm32_hal_legacy.h
as __HAL_RCC_GPIOI_CLK_ENABLE, and that latter macro is not defined
anywhere else (because the L4 does not have port GPIOI). So the test
for GPIOI is needed, along with the test for the CLK_ENABLE macro.
Use the machine.deepsleep() function to enter the sleep mode. Use the
RTC to configure the alarm to wake the device.
Basic use is the following:
import machine
# configure RTC's ALARM0 to wake device from deep sleep
rtc = machine.RTC()
rtc.irq(trigger=rtc.ALARM0, wake=machine.DEEPSLEEP)
# do other things
# ...
# set ALARM0's alarm to wake after 10 seconds
rtc.alarm(rtc.ALARM0, 10000)
# enter deep-sleep state (system is reset upon waking)
machine.deepsleep()
To detect if the system woke from a deep sleep use:
if machine.reset_cause() == machine.DEEPSLEEP_RESET:
print('woke from deep sleep')
Flash size as seen by vendor SDK doesn't depend on real size, but rather on
a particular value in firmware header, as put there by flash tool. That means
it's user responsibility to know what flash size a particular device has, and
specify correct parameters during flashing. That's not end user friendly
however, so we try to make it "flash and play" by detecting real size vs
from-header size mismatch, and correct the header accordingly.
E.g. for stmhal, accumulated preprocessed output may grow large due to
bloated vendor headers, and then reprocessing tens of megabytes on each
build make take couple of seconds on fast hardware (=> potentially dozens
of seconds on slow hardware). So instead, split once after each change,
and only cat repetitively (guaranteed to be fast, as there're thousands
of lines involved at most).
If make -B is run, the rule is run with $? empty. Extract fron all file in
this case. But this gets fragile, really "make clean" should be used instead
with such build complexity.
When there're C files to be (re)compiled, they're all passed first to
preprocessor. QSTR references are extracted from preprocessed output and
split per original C file. Then all available qstr files (including those
generated previously) are catenated together. Only if the resulting content
has changed, the output file is written (causing almost global rebuild
to pick up potentially renumbered qstr's). Otherwise, it's not updated
to not cause spurious rebuilds. Related make rules are split to minimize
amount of commands executed in the interim case (when some C files were
updated, but no qstrs were changed).
A port which uses lib/utils/pyexec.c but which does not enable garbage
collection should not need to implement the gc_collect function.
This patch also moves the gc_collect call to after printing the qstr
info. Since qstrs cannot be collected it should not make any difference
to the printed statistics.
To use: .setsockopt(SOL_SOCKET, 20, lambda sock: print(sock)). There's a
single underlying callback slot. For normal sockets, it serves as data
received callback, for listening sockets - connection arrived callback.
L4 does not have UART6, and has similar registers to the F7.
Original patch was authored by Tobias Badertscher / @tobbad, but it was
reworked to split UART edits from USB edits.
64-bit integer division brings a dependency on library functions. It is
avoided here by dividing fck and baud by a common divisior. The error
is the better (1/(2*0x300)) as with 64 bit division (1/(0x300)).
These files come from STM32Cube_FW_L4_V1.3.0, with Windows line endings
converted to unix. Only basic HAL files are added. In addition the QSPI
support is included to support later external QSPI flash as mass storage.