Commit Graph

1361 Commits

Author SHA1 Message Date
Angus Gratton
fdfe4eca74 ports: Always include debug information in the ELF.
For bare metal ARM & xtensa targets, passing -g will make the ELF file
larger but doesn't change the binary size.  However, this means tools like
gdb, addr2line, etc can extract source-level information from the ELF.

Also standardise -ggdb to -g, these produce the exact same ELF file on
arm-none-eabi-gcc and will use DWARF format for all these ports.
2022-07-29 11:24:00 +10:00
Jim Mussared
092784da19 ports: Remove unused mp_type_{fileio/textio} macros in mpconfigport.h.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-26 18:07:22 +10:00
Tim Gates
f736afb577 drivers,ports: Fix a few typos in comments.
Fixes:
- Should read `definitions` rather than `defintions`.
- Should read `resolution` rather than `resoultion`.
- Should read `inefficient` rather than `inefficent`.
- Should read `closed` rather than `closded`.

Signed-off-by: Tim Gates <tim.gates@iress.com>
2022-07-23 23:24:24 +10:00
robert-hh
c781899438 stm32/softtimer: Switch to use softtimer code from shared/runtime. 2022-07-19 12:33:19 +10:00
Damien George
b89422ceaa extmod: Always use custom mbedtls error message code.
All ports that use mbedtls use the custom error messages in
mp_mbedtls_errors.c.  This commit simplifies the build so that ports don't
need to explicitly add this file, it's now used by default when mbedtls is
enabled.

Signed-off-by: Damien George <damien@micropython.org>
2022-07-18 22:55:22 +10:00
Angus Gratton
1d23c01dd6 stm32/Makefile: Workaround LTO linker order bug in binutils <2.35.
Assembly files with weak symbols need to be linked first to avoid issues
with the weak symbols being incorrectly linked instead of strong ones.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83967 and
https://bugs.launchpad.net/gcc-arm-embedded/+bug/1747966

This is the workaround suggested in comment 10 of the gcc-arm-embedded bug.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2022-07-18 16:12:08 +10:00
David Lechner
7e4b205cb0 py/mpstate: Drop MICROPY_PORT_ROOT_POINTERS from mp_state_vm_t.
All in-tree uses of MICROPY_PORT_ROOT_POINTERS have been replaced with
MP_REGISTER_ROOT_POINTER(), so now we can remove both
MICROPY_PORT_ROOT_POINTERS and MICROPY_BOARD_ROOT_POINTERS from the code
and remaining config files.

Signed-off-by: David Lechner <david@pybricks.com>
2022-07-18 13:51:16 +10:00
David Lechner
816e4537f2 stm32: Use MP_REGISTER_ROOT_POINTER().
This uses MP_REGISTER_ROOT_POINTER() to register all port-specific root
pointers in the stm32 port.

Signed-off-by: David Lechner <david@pybricks.com>
2022-07-18 13:50:34 +10:00
David Lechner
a3703584fe extmod/modnetwork: Use MP_REGISTER_ROOT_POINTER().
This uses MP_REGISTER_ROOT_POINTER() to register mod_network_nic_list and
removes the same from all mpconfigport.h.

Signed-off-by: David Lechner <david@pybricks.com>
2022-07-18 13:50:25 +10:00
David Lechner
e531b72b56 extmod/nimble: Use MP_REGISTER_ROOT_POINTER().
This uses MP_REGISTER_ROOT_POINTER() to register bluetooth_nimble_memory
and bluetooth_nimble_root_pointers and removes the same from all
mpconfigport.h.

Signed-off-by: David Lechner <david@pybricks.com>
2022-07-18 13:50:14 +10:00
David Lechner
8fa6191f95 extmod/btstack: Use MP_REGISTER_ROOT_POINTER().
This uses MP_REGISTER_ROOT_POINTER() to register
bluetooth_btstack_root_pointers and removes the same from all
mpconfigport.h.

Signed-off-by: David Lechner <david@pybricks.com>
2022-07-18 13:49:51 +10:00
David Lechner
81dbea1ce3 shared/readline: Use MP_REGISTER_ROOT_POINTER().
This uses MP_REGISTER_ROOT_POINTER() to register the readline_history root
pointer array used by shared/readline.c and removes the registration from
all mpconfigport.h files.

This also required adding a new MICROPY_READLINE_HISTORY_SIZE config option
since not all ports used the same sized array.

Signed-off-by: David Lechner <david@pybricks.com>
2022-07-18 13:48:49 +10:00
David Lechner
fc3d7ae11b py/make_root_pointers: Add MP_REGISTER_ROOT_POINTER parser/generator.
This adds new compile-time infrastructure to parse source code files for
`MP_REGISTER_ROOT_POINTER()` and generates a new `root_pointers.h` header
file containing the collected declarations.  This works the same as the
existing `MP_REGISTER_MODULE()` feature.

Signed-off-by: David Lechner <david@pybricks.com>
2022-07-18 13:48:23 +10:00
Damien George
1329155b96 stm32/sdram: Include boardctrl.h for fatal-error handler.
Signed-off-by: Damien George <damien@micropython.org>
2022-07-11 14:47:46 +10:00
Damien George
9af6a275dd stm32/boardctrl: Allow boards to override fatal-error handler.
To override it a board must define MICROPY_BOARD_FATAL_ERROR to a function
that takes a string message and does not return.

Signed-off-by: Damien George <damien@micropython.org>
2022-07-08 23:47:29 +10:00
Damien George
d27e58449b stm32/mboot: Remove redundant code in mboot_state_change function.
This code was made redundant in 87fbceef26

Signed-off-by: Damien George <damien@micropython.org>
2022-07-05 23:47:54 +10:00
Jim Mussared
6519b1b95e stm32/Makefile: Fix setting of define that enables WIZNET5K driver.
Commit 9670a156da missed one renaming of
MICROPY_PY_WIZNET5K to MICROPY_PY_NETWORK_WIZNET5K which prevented the
Wiznet interface from being enabled.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-02 00:21:36 +10:00
Angus Gratton
dd77dbd4f7 stm32/boards: Enable LTO by default on boards with smaller flash size.
Signed-off-by: Angus Gratton <gus@projectgus.com>
2022-06-28 10:32:39 +10:00
Angus Gratton
e76d88b531 stm32/Makefile: Enable link-time-optimisation via LTO=1 make option.
When tested, this reduces default MP binary sizes by approx 2-2.5%, and
very marginally increases performance in benchmarks. Build times seem very
similar to non-LTO when using gcc 12.

See #8733 for further discussion.

Signed-off-by: Angus Gratton <gus@projectgus.com>
2022-06-28 10:31:32 +10:00
Angus Gratton
2c015375d1 stm32: Use a separate symbol name for the bootloader state pointer.
Prerequisite for enabling Link Time Optimisation.

The _bl_state address is the same as _estack, but _estack is referred to as
a uint32_t elsewhere in the code. LTO doesn't like it when the same symbol
has two different types.

Signed-off-by: Angus Gratton <gus@projectgus.com>
2022-06-28 10:25:08 +10:00
Koen De Vleeschauwer
432b65f178 stm32/usb: Expose USB HID device instance via usbd_hid_get().
This is needed to implement a HID device in user C modules.
2022-06-24 18:33:26 +10:00
iabdalkader
6c1495b5fe stm32/usbd_cdc_interface: Add support for Arduino 1200bps touch.
If the serial port is closed with baudrate at 1200 then the board will
enter its bootloader.
2022-06-23 14:30:07 +10:00
David Lechner
c118b5d0e4 extmod/extmod.mk: Separate out extmod file list from py.mk to extmod.mk.
This separates extmod source files from `py.mk`.  Previously, `py.mk`
assumed that every consumer of the py/ directory also wanted to include
extmod/.  However, this is not the case.  For example, building mpy-cross
uses py/ but doesn't need extmod/.

This commit moves all extmod-specific items from `py.mk` to `extmod.mk` and
explicitly includes `extmod.mk` in ports that use it.

Signed-off-by: David Lechner <david@pybricks.com>
2022-06-21 00:14:34 +10:00
Damien George
1842efbdd9 stm32/Makefile: Set CSUPEROPT to -Os for F0 and G0 MCUs to save space.
Saves 1804 bytes on NUCLEO_F091RC, and 1080 bytes on NUCLEO_G0B1RE.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-20 23:37:38 +10:00
chrismas9
868f23b362 stm32/boards/NUCLEO_F091RC: Enable LFS1 filesystem.
And disable some less common features to make space for it.

Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
2022-06-17 21:27:41 +10:00
chrismas9
fdbca3c143 stm32/boards/stm32f091xc.ld: Allocate space for a small filesystem.
Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
2022-06-17 21:27:32 +10:00
Damien George
d8e7ecd231 stm32/modmachine: Factor out mboot enter code to a function.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-17 13:57:47 +10:00
iabdalkader
0adf0dd3d7 stm32/modmachine: Allow boards to provide custom bootloader code.
And expose the machine_bootloader() C function so it can be used elsewhere.
2022-06-17 13:36:55 +10:00
Damien George
096954337f stm32/mboot: Only include UI code if at least one board LED is defined.
Otherwise the board must provide dummy definitions of MBOOT_LED1.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-16 14:31:09 +10:00
Damien George
3452ee58d3 stm32/boards/LEGO_HUB_NO6: Add comment to readme about powering off.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-09 13:24:08 +10:00
Damien George
45a0c6da5b stm32/mboot: Remove MP_WEAK on led funcs and make some of them static.
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>
2022-06-09 13:24:08 +10:00
Damien George
bd5152c928 stm32/mboot: Add board-configurable SysTick hook.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-09 13:24:08 +10:00
Clayton Mills
767f2ce9a7 stm32/usbd_conf: Remove disable of SYSCFG clock.
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.
2022-06-07 18:09:58 +10:00
Clayton Mills
0d8d911950 stm32/powerctrl: Disable sys tick interrupt in stop mode on some STM32s.
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.
2022-06-07 18:08:02 +10:00
Damien George
14105ff5b1 stm32/machine_i2c: Enable timingr constructor keyword on H7 MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-07 17:05:05 +10:00
Damien George
a0dae1dda2 stm32/flash: Remove FLASH_OPTR_DBANK condition in L4, H7 get_bank func.
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>
2022-06-07 16:55:18 +10:00
Damien George
9670a156da all: Rename MICROPY_PY_WIZNET5K to MICROPY_PY_NETWORK_WIZNET5K.
To match MICROPY_PY_NETWORK_CYW43 and MICROPY_PY_NETWORK_NINAW10.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-07 16:55:18 +10:00
Andrew Leech
8fb01be6cf stm32/rfcore: Remove extra layer of buffering on BLE IPCC.
Whole packets are now pushed up to the higher layer of the BLE stack,
instead of buffering the packets so individual bytes can be requested.
2022-06-03 11:58:43 +10:00
Damien George
efe23aca71 all: Remove third argument to MP_REGISTER_MODULE.
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>
2022-06-02 16:31:37 +10:00
Damien George
340872cfdd stm32/boards/LEGO_HUB_NO6: Add helper scripts to update app firmware.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 15:22:16 +10:00
Damien George
87ca431f3f stm32/boards/LEGO_HUB_NO6: Implement robust filesystem-load updates.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
Damien George
d84ebc31f7 stm32/boards/LEGO_HUB_NO6: Use multi-colour LED for mboot status.
This gives more information to the user when doing updates from SPI flash.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
Damien George
fae9205594 stm32/boards/LEGO_HUB_NO6: Add support for mboot to access SPI flash.
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>
2022-06-02 14:30:51 +10:00
Damien George
36211baf0e stm32/boards/LEGO_HUB_NO6: Make all SPI flash transfers use 32-bit addr.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
Damien George
87fbceef26 stm32/mboot: Pass initial_r0 to early-init and get-reset-mode funcs.
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>
2022-06-02 14:30:51 +10:00
Damien George
e64947dc90 stm32/mboot: Make 0x70ad0000 values named constants with macros.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
Damien George
9246099935 stm32/mboot: Add update_app_elements to return mboot fsload elements.
In case the elements should not be passed directly to machine.bootloader.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
Damien George
1296a01f4c stm32/mboot: Move remaining led_state_all call into mboot_state_change.
This was missed in b2deea6762

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
Damien George
54f1694ab6 drivers/bus: Rename MP_SPI_ADDR_IS_32B to MICROPY_HW_SPI_ADDR_IS_32BIT.
And allow it to be configured externally, if needed.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
Damien George
6e71cde6aa ports: Use default VFS config for import_stat and builtin_open.
For ports with MICROPY_VFS and MICROPY_PY_IO enabled their configuration
can now be simplified to use the defaults for mp_import_stat and
mp_builtin_open.

This commit makes no functional change, except for the following minor
points:
- the built-in "open" is removed from the minimal port (it previously did
  nothing)
- the duplicate built-in "input" is removed from the esp32 port
- qemu-arm now delegates to VFS import/open

Signed-off-by: Damien George <damien@micropython.org>
2022-05-25 13:04:45 +10:00
Damien George
26b1d31eda Revert "stm32/rfcore: Intercept addr-resolution HCI cmd to work arou..."
This reverts commit 2668337f36.

The issue with potential breaking of the BLE RX path in the radio is fixed
since WS v1.12.0.

Signed-off-by: Damien George <damien@micropython.org>
2022-05-25 11:02:35 +10:00
Jim Mussared
0a92469c10 stm32: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:56:30 +10:00
Jim Mussared
bb794f05b7 extmod: Make port-included extmod modules use MP_REGISTER_MODULES.
_onewire, socket, and network were previously added by the port rather
than objmodule.c.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:49:12 +10:00
Jim Mussared
4eab44a1ec extmod: Make extmod modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:49:12 +10:00
Damien George
5b700b0af9 all: Reformat remaining C code that doesn't have a space after a comma.
Signed-off-by: Damien George <damien@micropython.org>
2022-05-05 13:30:40 +10:00
Damien George
b0a1b60a9b extmod: Move font_petme128_8x8.h from ports/stm32 to extmod.
And add spaces after commas so it is consistently formatted.

Signed-off-by: Damien George <damien@micropython.org>
2022-05-05 13:30:40 +10:00
Damien George
39c96b543f stm32/mbedtls: Use core-provided tracked alloc instead of custom funcs.
Signed-off-by: Damien George <damien@micropython.org>
2022-05-05 10:31:50 +10:00
Jim Mussared
0e7bfc88c6 all: Use mp_obj_malloc everywhere it's applicable.
This replaces occurences of

    foo_t *foo = m_new_obj(foo_t);
    foo->base.type = &foo_type;

with

    foo_t *foo = mp_obj_malloc(foo_t, &foo_type);

Excludes any places where base is a sub-field or when new0/memset is used.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-03 22:28:14 +10:00
Asensio Lorenzo Sempere
9d08eb0247 stm32/boards/NUCLEO_G0B1RE: Add NUCLEO_G0B1RE board definition.
This commit adds a board definition for NUCLEO_G0B1RE. This board has the
REPL on UART2 which is connected to the on-board ST-link USB-UART.

Signed-off-by: Asensio Lorenzo Sempere <asensio.aerospace@gmail.com>
2022-04-28 11:56:15 +10:00
Asensio Lorenzo Sempere
010012c7c3 stm32: Add support for G0 MCUs.
This commit adds support for the STM32G0 series of MCUs.

Signed-off-by: Asensio Lorenzo Sempere <asensio.aerospace@gmail.com>
2022-04-28 11:56:15 +10:00
Asensio Lorenzo Sempere
3587d8e808 stm32/storage: Add support for internal storage on Cortex-M0 MCUs.
This implements self-triggering of the Flash NVIC interrupt on Cortex-M0
devices, which allows enabling internal storage on those MCUs.

Signed-off-by: Asensio Lorenzo Sempere <asensio.aerospace@gmail.com>
2022-04-28 11:56:15 +10:00
iabdalkader
96ad86ed2b stm32/boards/ARDUINO_PORTENTA_H7: Add support for Arduino Portenta H7. 2022-04-28 10:42:47 +10:00
iabdalkader
1f33ec140a stm32/ulpi: Include missing py/mperrno.h header. 2022-04-28 10:34:56 +10:00
iabdalkader
014912daae stm32/ulpi: Add USB3320 ULPI low-power functions.
This driver allows switching USB3320 ULPI to low-power mode.  It is ported/
adapted from ST code, stm32f7xx_lp_modes.c, which is BSD-3 licensed code.
2022-04-26 23:11:50 +10:00
iabdalkader
32914c53ef stm32/qspi: Workaround for SR set immediately after setting AR.
See issue #5441.  This issue is now reproducible on the Arduino Portenta
H747, QSPI flash PN MX25L12833F.
2022-04-26 22:33:05 +10:00
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