Commit Graph

1296 Commits

Author SHA1 Message Date
iabdalkader
5974ac256b stm32/qspi: Wait for a free FIFO location before writing to DR.
Must always check the FIFO before writing to DR.  Without this, this
function hangs on the H747.
2022-04-26 22:32:48 +10:00
iabdalkader
b28839420d stm32/qspi: Support common flash sizes in MPU configuration.
Add MPU configuration for common flash sizes up to 256MiB.
2022-04-26 22:32:29 +10:00
Damien George
5c32111fa0 ports: Reformat more C and Python source code.
These files that are reformatted only now fall under the list of files to
apply uncrustify/black formatting to.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-20 16:17:35 +10:00
Damien George
707aaa350a stm32/boards/LEGO_HUB_NO6: Exclude BTstack code from formatting.
Signed-off-by: Damien George <damien@micropython.org>
2022-04-20 15:54:26 +10:00
iabdalkader
03c61916bc stm32/boards/ADAFRUIT_F405_EXPRESS: Use external SPI flash for storage.
Fixes issue #8553.
2022-04-20 15:37:14 +10:00
iabdalkader
71afed1a70 stm32/mphalport: Fix I/O glitches when switching GPIO mode to alt-func.
To avoid any I/O glitches in mp_hal_pin_config, make sure a valid alternate
function is set in AFR first before switching the pin mode.  When switching
from AF to INPUT or OUTPUT, the AF in AFR will remain valid up until the
pin mode is switched.
2022-04-20 15:31:14 +10:00
Chris Wilson
b50fe9a6da stm32/boards/SPARKFUN_MICROMOD_STM32: Fix incorrect UART and I2C config.
Based on testing with real hardware.
2022-04-19 10:42:37 +10:00
Damien George
8045ac07f5 stm32/mpbthciport: Switch scheduling callback to use node scheduler.
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14 12:33:31 +10:00
Dave Hylands
9d7c168bf5 stm32/boards/PYBD_SFx: Allow FROZEN_MANIFEST to be overridden.
Because mpconfigboard.mk used = rather then ?= it doesn't allow
FROZEN_MANIFEST to be overridden using a GNUmakefile or the manifest.
2022-04-11 16:19:45 +10:00
iabdalkader
a82fad7d8e stm32/system_stm32: Improve H7 PLL and OSC configuration.
- Allow boards to configure CSI, HSI48 and PLL2.
- Allow peripheral clock source configuration.
- Set H7 SYSCLKSource.
2022-04-11 16:12:53 +10:00
iabdalkader
36cac5e154 stm32/system_stm32: Allow boards to configure PLL VCI, VCO and FRACN.
This removes hard-coded PLL1/3 VCI, VCO and FRACN.
2022-04-11 16:12:53 +10:00
iabdalkader
a3e5a68c46 stm32/system_stm32: Set voltage scaling level 0 for H7 Rev-V devices.
This enables voltage scaling level 0 for H7 Rev-V devices, which allows the
CPU to run at the maximum supported operating frequency (480MHz).
2022-04-11 16:12:53 +10:00
iabdalkader
bdbc9b395f stm32/system_stm32: Add H7 switched-mode-power-supply support.
- Add board-level configuration option to set the SMPS supply mode.
- Wait for valid voltage levels after configuring the SMPS mode.
- Wait for external supply ready flag if SMPS supplies external circuitry.
2022-04-11 16:12:53 +10:00
iabdalkader
7b3adb5ce5 stm32/Makefile: Add H747 to Makefile's MCU flags. 2022-04-11 16:12:50 +10:00
iabdalkader
2a19c3cfe1 stm32/sdram: Add function to enable SDRAM power-down mode.
Add power-down mode for maximum power saving while in standby mode, to be
used by a board if needed.  Also fix a typo in a comment.
2022-04-11 16:00:40 +10:00
Damien George
cb0372b5bf stm32/mboot: Add macros for use in led_state_all().
Signed-off-by: Damien George <damien@micropython.org>
2022-04-11 15:52:41 +10:00
Damien George
b2deea6762 stm32/mboot: Consolidate all UI and add general state change hooks.
All user interface (LED, button) code has been moved to ui.c, and the
interface to this code with the rest of the system now goes through calls
to mboot_state_change().  This state-change function can be overridden by a
board to fully customise the user interface behaviour.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-11 15:52:41 +10:00
Damien George
66b5c4c770 stm32/machine_bitstream: Include all clobbered regs in Cortex-M0 impl.
These additional registers are used by the assembly code.

Thanks to Jim Mussared for the fix.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-07 21:17:51 +10:00
Damien George
43d50f006d stm32/mpconfigport.h: Let MICROPY_PY_IO_FILEIO take its default value.
This is enabled at MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES, which is the
default for stm32.  Not setting the value in mpconfigboard.h allows boards
to optionally configure it.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-07 13:25:48 +10:00
Andrew Leech
8db93dc016 stm32/Makefile: Allow overriding COPT in Makefile.
It can now be set in mpconfigboard.mk (as well as the make command line).
2022-04-04 23:12:15 +10:00
iabdalkader
5562ed3f43 stm32/pyb_can: Replace CAN.initfilterbanks with CAN.init keyword arg.
The CAN.initfilterbanks() class method is removed, and its functionality is
replaced with the "num_filter_banks" keyword argument to the CAN
constructor and CAN.init().  This configures the filter bank split.

This new approach provides more flexibility configuring the resources used
by a given CAN instance, allowing other MCUs like H7 to fit the API.  It
also brings CAN closer to how other machine peripherals are configured,
where everything is done in the constructor/init method.

This is a breaking change to the CAN API.
2022-04-02 22:42:00 +11:00
iabdalkader
a79706fb39 stm32/pyb_can: Define the maximum bit timing parameters.
Define the maximum parameters for CAN/FDCAN nominal bit timing, and for
FDCAN data bit timing, for bit timing calculations.
2022-04-02 22:41:37 +11:00
iabdalkader
95104c9f6e stm32/pyb_can: Return the filter ID and type of received messages.
CAN.recv() now returns a 5-tuple, with the new element in the second
position being a boolean, True if the ID is extended.

This is a breaking change of the API for CAN.recv().
2022-04-02 22:40:09 +11:00
iabdalkader
e7264e9532 stm32/pyb_can: Add support for bus with mixed Classic/FD nodes.
A CAN bus can have mixed classic/FD nodes.  Prior to this patch the CAN API
could be configured for either standard or extended ID, but not both/mixed
operation.

This patch allows extended IDs to be filtered and enabled on a per-message
basis, in send(), setfilter() and clearfilter().

This is a breaking change to the API: init() no longer accepts the extframe
keyword argument.
2022-04-02 22:37:52 +11:00
iabdalkader
3320ec44ed stm32/pyb_can: Add support for CAN FD extended frame ID. 2022-04-02 22:37:45 +11:00
iabdalkader
ff287d085f stm32/pyb_can: Enable CAN FD frame support and BRS.
- Enable CAN FD frame support and BRS.
- Optimize the message RAM usage per FDCAN instance.
- Document the usage and different sections of the Message RAM.
2022-04-02 22:37:27 +11:00
Andrew Leech
a41bc5a7ca stm32/modmachine: Add deepsleep support to reset_cause() for WB55. 2022-03-30 15:56:26 +11:00
Meriç SARIIŞIK
6b23f7d301 stm32/sdio: Use runtime calculation for clock divider of sdio on H7.
STM32H7 family has a different calculation compared to the current one for
the SDMMC clock divider configuration.
2022-03-30 15:40:59 +11:00
Damien George
6804a8a891 stm32/machine_i2s: Fix 16-bit stereo i2s_frame_map.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-29 11:44:08 +11:00
Damien George
2a91c8a888 stm32/machine_i2s: Allow I2S.deinit to be called multiple times.
In particular, it is called by the constructor if the instance already
exists.  So if the previous instance was deinit'd then it will be deinit'd
a second time.

Signed-off-by: Damien George <damien@micropython.org>
2022-03-29 11:44:08 +11:00
Damien George
c90dfba04c stm32/machine_i2s: Set FullDuplexMode to disabled on F4.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-29 11:44:08 +11:00
iabdalkader
fe8b47e29f ports: Allow boards to define additional network interfaces. 2022-03-24 17:23:28 +11:00
Damien George
66fe3d5cb5 stm32: Support building for STM32F745.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-22 16:01:09 +11:00
Andrew Leech
bb0ca00b77 stm32/mboot: Verify CRC32 of fsload DFU files before writing. 2022-03-22 15:04:41 +11:00
Andrew Leech
bc856a1e29 stm32/mboot: Verify signature of fsload packed DFU files before writing.
When verifying the DFU contents, the signature of signed/encrypted files is
also now checked in this initial, dry-run stage.
2022-03-22 15:04:37 +11:00
Damien George
80055c2cdc stm32/mboot/fwupdate.py: Simplify calculation of CRC32.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-22 14:14:31 +11:00
Damien George
bf89e336b9 stm32/boards/PYBD_SF2: Turn on SD card in mboot init if SD enabled.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-22 13:33:43 +11:00
Damien George
e316306546 stm32/mboot: Add support for reading from SD card.
Tested on PYBV10 and PYBD_SF6, with MBOOT_FSLOAD enabled and programming
new firmware from a .dfu.gz file stored on the SD card.

Signed-off-by: Damien George <damien@micropython.org>
2022-03-22 13:33:43 +11:00
Damien George
9b07d38c7e stm32/mboot: Add support for 64-bit mboot address space for reads.
If enabled via MBOOT_ADDRESS_SPACE_64BIT (it's disabled by default) then
read addresses will be 64-bit.

Signed-off-by: Damien George <damien@micropython.org>
2022-03-22 13:33:43 +11:00
Damien George
a92d45c3df stm32/mboot: Always check the magic number to enter filesystem loading.
Even if MBOOT_FSLOAD is disabled, mboot should still check for 0x70ad0080
so it can immediately return to the application if this feature is not
enabled.  Otherwise mboot will get stuck in DFU mode.

Signed-off-by: Damien George <damien@micropython.org>
2022-03-22 12:49:00 +11:00
Damien George
dc91024a73 stm32/mboot: Add pragma for GCC to ignore array bounds warning.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-22 12:44:10 +11:00
Damien George
f0be0de341 stm32/dma: Add option to disable auto-DMA-turn-off.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-22 12:43:53 +11:00
Damien George
63c7593df6 stm32/main: Support SD cards without a partition table.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-22 12:41:15 +11:00
Damien George
75d2bfcccf stm32/sdcard: Add sdcard_select_sd/mmc functions.
So that C code can select which of SD or MMC to use.

Signed-off-by: Damien George <damien@micropython.org>
2022-03-22 12:38:45 +11:00
Damien George
7a9cf1f0fb stm32/sdcard: Use mp_hal_pin_input instead of HAL function.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-22 12:15:36 +11:00
Peter Züger
95ee29f4f4 stm32/mbedtls: Add NULL pointer check in m_free_mbedtls.
According to the C standard the free(void *ptr) function: if ptr is a null
pointer, no action occurs.

Signed-off-by: Peter Züger <zueger.peter@icloud.com>
2022-03-17 13:11:22 +11:00
iabdalkader
a16dcc8136 stm32/boards: Convert F4xx and F7xx to new flash FS config.
Following on from 35e70c1698.

Fixes issue #8390.
2022-03-17 13:06:45 +11:00
Damien George
11b77263ef stm32/moduos: Convert module to use extmod version.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-09 10:03:23 +11:00
Damien George
94077c6402 samd/moduos: Convert module to use extmod version.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-09 10:03:23 +11:00
Damien George
5995fb5261 stm32/mboot: Allow a board more control over entry initialisation.
If MBOOT_BOARD_ENTRY_INIT is defined by a board then that function must now
make sure system clocks are configured, eg by calling mboot_entry_init().

Signed-off-by: Damien George <damien@micropython.org>
2022-02-18 14:59:35 +11:00
Damien George
2b62f12103 stm32/mboot: Allow a board to fully configure system clocks.
If a board wants to customise the clocks it can define the following:

    MBOOT_CLK_PLLM
    MBOOT_CLK_PLLN
    MBOOT_CLK_PLLP
    MBOOT_CLK_PLLQ
    MBOOT_CLK_PLLR (only needed on STM32H7)
    MBOOT_FLASH_LATENCY
    MBOOT_CLK_AHB_DIV
    MBOOT_CLK_APB1_DIV
    MBOOT_CLK_APB2_DIV
    MBOOT_CLK_APB3_DIV (only needed on STM32H7)
    MBOOT_CLK_APB4_DIV (only needed on STM32H7)

Signed-off-by: Damien George <damien@micropython.org>
2022-02-18 14:51:01 +11:00
Christophe Priouzeau
130f7db1fc stm32/boards/NUCLEO_WB55: Add Arduino pin alias definitions.
Fixes issue #8295.

Signed-off-by: Christophe Priouzeau <christophe.priouzeau@foss.st.com>
2022-02-18 14:45:49 +11:00
Damien George
a7530cbc03 stm32/boards/NUCLEO_L432KC: Disable MICROPY_OPT_COMPUTED_GOTO.
To save space, after recent fixes to L4 ADC made it overflow flash.

Signed-off-by: Damien George <damien@micropython.org>
2022-02-04 14:28:21 +11:00
iabdalkader
31f2440388 stm32/adc: Remove obsolete FIRST/LAST GPIO channel macros. 2022-02-04 10:45:11 +11:00
iabdalkader
e5df4a96fa stm32/adc: Fix L4 ADC channel numbers.
Use HAL macro to map decimal numbers to channel numbers.  This is needed
since updating L4 HAL v1.17.0 in a0f5b3148a.

Fixes issue #8233.
2022-02-04 10:42:38 +11:00
Peter D. Gray
ae5f647a2d stm32/system_stm32: Make SystemClock_Config() a weak symbol.
This allows boards to override as needed.
2022-02-04 10:29:53 +11:00
Damien George
e306f2285b stm32/boards/NUCLEO_WL55: Add new board definition.
Signed-off-by: Damien George <damien@micropython.org>
2022-02-04 09:43:43 +11:00
Damien George
e0a0719416 stm32: Add initial support for STM32WL MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2022-02-04 09:43:43 +11:00
Damien George
9127e63708 stm32/Makefile: Make stm32lib configurable.
The default stm32lib remains lib/stm32lib, but it can now be easily
overriden at build time by specifying STM32LIB_DIR, or STM32LIB_CMSIS_DIR
and STM32LIB_HAL_DIR.

Signed-off-by: Damien George <damien@micropython.org>
2022-02-04 09:43:43 +11:00
Damien George
e4f59a0020 stm32/rtc: Use LL_RTC functions to simplify some MCU-specific code.
This also fixes a possible race condition when exiting initialisation mode:
reading then writing to ISR (via ISR &= ~RTC_ISR_INIT) will clear any flags
that were set by the hardware between the read and the write.  The correct
way to clear just the INIT bit is to just do a single write via ISR =
~RTC_ISR_INIT, which will not clear any other flags (they must be written
to 0 to clear), and that is exactly what LL_RTC_DisableInitMode does.

Signed-off-by: Damien George <damien@micropython.org>
2022-02-04 08:35:14 +11:00
Damien George
26faf74d52 stm32/mboot: Add support for F469/479 MCUs in fwupdate.py.
And don't assert on the sector number in sector_erase, so it can support
erasing arbitrary sectors.

Signed-off-by: Damien George <damien@micropython.org>
2022-02-03 13:21:57 +11:00
Damien George
4f918f4b26 stm32/mboot: Add MBOOT_BOARD_ENTRY_INIT for a board to add entry code.
Also change the signature of stm32_main to uint32_t, which is what it
should be.

Signed-off-by: Damien George <damien@micropython.org>
2022-02-03 13:20:51 +11:00
Damien George
b8d55d4c52 stm32/mboot: Allow HSI to be used as the main clock source.
Signed-off-by: Damien George <damien@micropython.org>
2022-02-03 13:20:22 +11:00
Damien George
fbd47fc46c ports: Consolidate inclusion of umachine module in built-ins.
The inclusion of `umachine` in the list of built-in modules is now done
centrally in py/objmodule.c.  Enabling MICROPY_PY_MACHINE will include this
module.

As part of this, all ports now have `umachine` as the core module name
(previously some had only `machine` as the name).

Signed-off-by: Damien George <damien@micropython.org>
2022-02-03 10:08:54 +11:00
Herwin Grobben
8f68e26f79 stm32: Add support for G4 MCUs, and add NUCLEO_G474RE board defn.
This commit adds support for the STM32G4 series of MCUs, and a board
definition for NUCLEO_G474RE.  This board has the REPL on LPUART1 which is
connected to the on-board ST-link USB-UART.
2022-02-01 16:21:01 +11:00
Damien George
60e05ae84e stm32/mboot: Compute and check CRC32 of dfu file in fwupdate.py.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-31 18:49:08 +11:00
Damien George
ca1914fb47 stm32/mboot: Support H7 MCUs in fwupdate.py.
And optimise the speed of flash writing.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-31 18:26:55 +11:00
Damien George
29867a2439 stm32/mboot: Include hal_rcc_ex.c in source file list.
It's needed at least on F4 because this file overrides the weak function
HAL_RCC_DeInit() from hal_rcc.c.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-31 18:26:55 +11:00
Damien George
c8c229b96c stm32/mboot: Use PLL3 for USB clock source on H7 MCUs.
PLL3-Q is more reliable than PLL1-Q for the USB clock source when entering
mboot from various reset states (eg power on vs MCU reset).  (It was found
that if the main application used PLL3-Q then sometimes the USB clock
source would stay stuck on PLL3-Q and not switch to PLL1-Q after a reset.)

Other related changes:
- SystemCoreClockUpdate() should be called on H7 because the calculation
  can be involved in some cases.
- __set_PRIMASK(0) should be called because on H7 the built-in ST DFU
  bootloader exits with IRQs disabled.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-31 18:26:55 +11:00
Damien George
c99ed8d6fa stm32/powerctrl: Write bootloader-state as 64-bit word to work on H7.
H7 MCUs have ECC and writes do not go through to SRAM until 64-bits have
been written (on another location is written).  So use 64-bit writes for
the bootloader-state variable so it is committed before the system reset.

As part of this change, the lower byte of the bootloader address in
BL_STATE must now be the magic number 0x5a5 for the state to be valid
(previously this was 0x000 which is not as robust).

Signed-off-by: Damien George <damien@micropython.org>
2022-01-31 18:26:55 +11:00
Damien George
4a4f269a1a stm32/powerctrlboot: Set HAL uwTickPrio variable when needed.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-31 18:26:55 +11:00
Damien George
14becd80c9 stm32/usbd_conf: Set lpm_enable and battery_charging_enable on all MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-31 16:38:32 +11:00
Herwin Grobben
517e82eb6b stm32/fdcan: Fix naming with regards to G4 series. 2022-01-27 23:06:13 +11:00
Herwin Grobben
160e4d9a6d stm32/fdcan: Fix FIFO1 usage and handling of error interrupts.
The original code used a independent state with regards to the interrupt.
During heavy bus error conditions the internal state could become
out-of-sync with the interrupts.

Further explanation: during the development of an application using CAN
communication, a interrupt-run-away was found in some situations.  It was
found that the error interrupt triggered (Warning, Passive or Bus-Off, all
triggered it) the run-away.  The only recovery was a reset.

Two problems were found:
- the error interrupt is enabled but not cleared in the interrupt routine;
- an internal variable 'State' that was used to track the message received
  state (empty, new, full, overflow) that was not directly related to
  interrupt that indicated the state.

In this commit these issues are fixed by adding more values for the
interrupt reason (warning, passive, bus off) and clearing the error
interrupts, and making the internal state directly dependent on the
interrupt state for received messages.

Furthermore, introducing the FIFO1 in the CAN receive stage, another issue
existed.  Even if the messages are received into the FIFO1 (by selecting
message filtering for FIFO0 and FIFO1), the interrupt firing was indicating
FIFO0 Rx.  The configuration of the interrupts for this is now also fixed.
The CAN peripheral has 2 interrupt lines going into the NVIC controller.
The assignment of the interrupt reasons to these 2 interrupt lines was
missing.  Now the reception of FIFO1 messages triggers the second interrupt
line.  Other interrupts (Rx FIFO0 and bus error) are assigned to the first
interrupt line.

Tested on a Nucleo-G474, and also checked the HAL function to work with the
H7 family.
2022-01-27 23:01:08 +11:00
iabdalkader
a00e1e5735 stm32/dac: Deinit all DACs on soft reset.
DAC timed functions continue to run after a soft reset cycle, using
collected memory in the case of write_timed.
2022-01-27 17:10:39 +11:00
Damien George
79a3158de6 stm32/pin: Change remaining uses of "af" to "alt".
The keyword "af" has been deprecated for some time and "alt" should be used
instead (but "af" still works).

Signed-off-by: Damien George <damien@micropython.org>
2022-01-27 16:44:13 +11:00
Damien George
608d421752 stm32/mboot: Remove custom HAL_RCC_GetHCLKFreq and use HAL provided one.
So that a board can access other HAL_RCC functions if it needs them (this
was not possible previously by just adding hal_rcc.c to the src list for a
board because it would clash with the custom HAL_RCC_GetHCLKFreq function).

Signed-off-by: Damien George <damien@micropython.org>
2022-01-20 16:08:17 +11:00
Damien George
5e506567a3 stm32/mbedtls: Enable MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE.
This adds MBEDTLS_MD_SHA1 to the list of default hashes for TLS 1.2
handshake signatures.  Although SHA-1 is weak, this option is turned on in
the default mbedtls configuration file, and allows better compatibility
with older servers.  In particular it allows an stm32-mbedtls-based client
to connect to an axtls-based client (eg default unix port and esp8266).

Signed-off-by: Damien George <damien@micropython.org>
2022-01-17 17:35:04 +11:00
Damien George
1892d03740 mimxrt,stm32: Enable MICROPY_PY_USSL_FINALISER.
This is needed because these ports allocate mbedtls data on the MicroPython
heap, and SSL socket objects must be fully cleaned up when they are garbage
collected, to free this memory allocated by mbedtls.  As part of this,
gc_sweep_all() will now ensure that the MP_STATE_PORT(mbedtls_memory)
linked-list is fully deallocated on soft reset.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-08 00:02:04 +11:00
Damien George
df3f59ca4b ports: Update board.json files to link to new board images.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-07 11:33:28 +11:00
iabdalkader
8af9dbbde1 stm32/network_wiznet5k: Fix build error with wiznet5k and lwip enabled.
Commit 4dba04a50f refactored the network code
but the combination of MICROPY_PY_WIZNET5K=5500 and MICROPY_PY_LWIP=1
broke.
2021-12-30 11:54:19 +11:00
Matt Trentini
f2b5c99fde stm32/boards/OLIMEX_H407: Fix typo in OLIMEX H407 board.json.
Appears incorrectly as E407 in the download manager.
2021-12-20 12:32:46 +11:00
iabdalkader
bedd9c5463 stm32/boards/make-pins.py: Generate empty ADC table if needed.
If ADCx pins are hidden, print an empty table to prevent linker errors.
2021-12-20 09:41:46 +11:00
iabdalkader
1dc532019b stm32/qspi: Fix typo in address comment. 2021-12-19 17:48:00 +11:00
iabdalkader
f9e5b0d93d stm32/factoryreset: Init vfs flags before calling pyb_flash_init_vfs.
The vfs flags could have any random value from stack.  This bug was
introduced back in 7723dac337
2021-12-19 17:42:15 +11:00
Damien George
de43b500bd py/runtime: Allow initialising sys.path/argv with defaults.
If MICROPY_PY_SYS_PATH_ARGV_DEFAULTS is enabled (which it is by default)
then sys.path and sys.argv will be initialised and populated with default
values.  This keeps all bare-metal ports aligned.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-18 00:08:07 +11:00
Jim Mussared
86ce442607 ports: Add '.frozen' as the first entry in sys.path.
Frozen modules will be searched preferentially, but gives the user the
ability to override this behavior.

This matches the previous behavior where "" was implicitly the frozen
search path, but the frozen list was checked before the filesystem.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-12-18 00:08:07 +11:00
Jim Mussared
92353c2911 all: Remove support for FROZEN_DIR and FROZEN_MPY_DIR.
These have been deprecated for over two years in favour of FROZEN_MANIFEST
and manifest.py.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-12-17 23:54:05 +11:00
Damien George
6995cf03dd stm32/sdcard: Add config option to force MM card capacity.
The current ST HAL does not support reading the extended CSD so cannot
correctly detect the capacity of high-capacity cards.  As a workaround, the
capacity can be forced via the MICROPY_HW_MMCARD_LOG_BLOCK_NBR config
option.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-14 10:48:01 +11:00
Damien George
b26704aac5 stm32/sdcard: Support 8-bit wide SDIO bus.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-14 10:48:01 +11:00
Damien George
9a1ab2286d stm32/main: Call sdcard_init when only MICROPY_HW_ENABLE_MMCARD enabled.
Otherwise, if MMCARD is enabled and not SDCARD, then the GPIO will not be
configured for SDIO.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-14 10:48:01 +11:00
Damien George
88ac5a3116 stm32: Update L4 code to build with latest stm32lib and L4 HAL 1.17.0.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-14 10:48:01 +11:00
Damien George
0892ebe091 stm32/boards: Enable MICROPY_HW_ENABLE_SERVO on various boards.
Fixes issue #8059.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-10 23:19:20 +11:00
Damien George
5fc55999b2 stm32/boards: Remove unused MICROPY_HW_ENABLE_TIMER config.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-10 23:19:00 +11:00
Damien George
10c6f03cbe stm32/boards: Remove stray '+' characters at start of lines in ld files.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-10 23:15:25 +11:00
Damien George
c613f5bb49 stm32/boards/LEGO_HUB_NO6: Set filesystem label as HUB_NO6.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-09 16:51:35 +11:00
Jim Mussared
92f54fe8d9 stm32/boards/NUCLEO_WB55: Fix LED ordering.
These were commented correctly by their colour, but in the wrong order with
respect to the PCB silkscreen.

Fixes issue #8054.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-12-09 14:03:35 +11:00
Jim Mussared
3770fab334 all: Update Python formatting to latest Black version 21.12b0.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-12-09 12:09:40 +11:00
Damien George
23a150789d stm32/boards/make-pins.py: Use cpu pins to define static alt-fun macros.
Instead of board pins, so that pins which have only the CPU specified in
pins.csv can still be used with mp_hal_pin_config_alt_static().

Signed-off-by: Damien George <damien@micropython.org>
2021-11-30 10:25:41 +11:00
Damien George
0c9f5b388e stm32: Include HAL MMC code in F4 builds.
So that the MMC driver can be used on F4 MCUs.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-30 10:21:18 +11:00