Commit Graph

322 Commits

Author SHA1 Message Date
Mike Causer
c24003abec stm32/boards: Add VCC_GND_F407VE board. 2021-05-20 23:15:56 +10:00
David Lechner
ca0c75f504 stm32/boards: Change default LSI_VALUE to 32000 for F4 MCUs.
In the STM32 HAL libraries, the default value for LSI_VALUE for F4 MCUs is
32 kHz.

Signed-off-by: David Lechner <david@pybricks.com>
2021-05-04 16:53:40 +10:00
iabdalkader
baa712b7f0 stm32/boards/PYBD_SF2: Enable RF switch compile option. 2021-04-30 10:16:15 +10:00
Damien George
cf7e71fa43 stm32/sdcard: Allow configuring the SDMMC periph used for SD/MMC card.
This can now be selected by setting MICROPY_HW_SDCARD_SDMMC, which defaults
to 1, ie SDMMC1.  This commit also renames the SD pin configuration macros
from MICROPY_HW_SDMMC2_xxx to MICROPY_HW_SDCARD_xxx, as well as renaming
MICROPY_HW_SDMMC_BUS_WIDTH to MICROPY_HW_SDCARD_BUS_WIDTH.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 00:58:17 +10:00
Damien George
6e0f9b9262 stm32/boards/pllvalues.py: Support wider range of PLL values for F413.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-20 23:33:33 +10:00
Damien George
25c029ce9f stm32/boards: Split UARTx_RTS_DE into UARTx_RTS/UARTx_DE in pin defs.
So these alternate functions can be parsed by the build scripts and used in
application code.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-13 23:58:20 +10:00
aziubin
7546d3cf73 stm32/boards/NUCLEO_L476RG: Add 5 remaining UARTs.
STM32L476RG MCU of NUCLEO_L476RG board has 6 UART/USART units in total
(USART1, USART2, USART3, UART4, UART5 and LPUART1), but only UART2,
connected to REPL, was defined and available in Python code.
Defined are all 5 remaining UART/USART units including LPUART1.

Signed-off-by: Alexander Ziubin aziubin@googlemail.com
2021-04-09 15:00:55 +10:00
Damien George
cb396827f5 stm32/boards/pllvalues.py: Relax PLLQ constraints on STM32F413 MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-07 12:47:21 +10:00
Damien George
25ae169e6e stm32: Include .ARM section in firmware for C++ exception handling.
Support for C++ was added in 97960dc7de but
that commit didn't include the C++ exception handling table in the binary
firmware image.  This commit fixes that.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-06 12:11:15 +10:00
Damien George
03a64f2077 stm32/boards/NUCLEO_WB55: Enable LPUART1 on PA2/PA3.
Signed-off-by: Damien George <damien@micropython.org>
2021-02-21 15:49:33 +11:00
Chris Mason
9d674cf7ab stm32/uart: Add support for LPUART1 on L0, L4, H7 and WB MCUs.
Add LPUART1 as a standard UART.  No low power features are supported, yet.
LPUART1 is enabled as the next available UART after the standard U(S)ARTs:

    STM32WB:      LPUART1 = UART(2)
    STM32L0:      LPUART1 = UART(6)
    STM32L4:      LPUART1 = UART(6)
    STM32H7:      LPUART1 = UART(9)

On all ports: LPUART1 = machine.UART('LP1')

LPUART1 is enabled by defining MICROPY_HW_LPUART1_TX and
MICROPY_HW_LPUART1_RX in mpconfigboard.h.

Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
2021-02-21 15:49:32 +11:00
Damien George
301fe805ca stm32/mpbtstackport: Allow chipset and secondary baudrate to be set.
Signed-off-by: Damien George <damien@micropython.org>
2021-02-17 15:47:17 +11:00
Damien George
5c92ff53fe stm32/boards: Disable onewire module on boards with small flash.
Signed-off-by: Damien George <damien@micropython.org>
2021-02-17 14:42:46 +11:00
Damien George
d2a34c62e7 stm32/uart: Add uart_set_baudrate function.
This allows changing the baudrate of the UART without reinitialising it
(reinitialising can lead to spurious characters sent on the TX line).

Signed-off-by: Damien George <damien@micropython.org>
2021-02-14 18:30:49 +11:00
Damien George
0efa0b5437 stm32/mboot: Add ELEM_TYPE_STATUS element so application can get status.
This new element takes the form: (ELEM_TYPE_STATUS, 4, <address>).  If this
element is present in the mboot command then mboot will store to the given
address the result of the filesystem firmware update process.  The address
can for example be an RTC backup register.

Signed-off-by: Damien George <damien@micropython.org>
2021-01-29 15:02:55 +11:00
Damien George
f6e6ef69e0 stm32/boards/NUCLEO_WB55: Enable MBOOT with packing mode.
To have at least one board configured with MBOOT_ENABLE_PACKING, for CI
testing purposes and demonstration of the feature.

Signed-off-by: Damien George <damien@micropython.org>
2021-01-18 12:43:01 +11:00
Damien George
e715a8fb9b stm32/boards/PYBD_SF2: Disable SPIFLASH_ENABLE_CACHE for mboot builds.
Mboot builds do not use the external SPI flash in caching mode, and
explicitly disabling it saves RAM and a small bit of flash.

Signed-off-by: Damien George <damien@micropython.org>
2020-12-18 13:39:32 +11:00
Damien George
e43a74a4db drivers/memory/spiflash: Add MICROPY_HW_SPIFLASH_ENABLE_CACHE option.
This only needs to be enabled if a board uses FAT FS on external SPI flash.
When disabled (and using external SPI flash) 4k of RAM can be saved.

Signed-off-by: Damien George <damien@micropython.org>
2020-12-18 13:39:32 +11:00
Damien George
80883a82c0 stm32/adc: Deselect VBAT after reading to prevent battery drain.
Signed-off-by: Damien George <damien@micropython.org>
2020-12-18 13:32:02 +11:00
Reinhard Feger
032e095620 stm32/boards/NUCLEO_H743ZI: Enable ethernet peripheral. 2020-12-08 15:27:51 +11:00
Reinhard Feger
cd61fc8e44 stm32/boards/stm32h743.ld: Enable D2 RAM and add eth-buffer section. 2020-12-08 15:27:27 +11:00
Damien George
cc2a35b7b2 stm32/rtc: Validate the RTC prescaler on boot and change if incorrect.
Devices with RTC backup-batteries have been shown (very rarely) to have
incorrect RTC prescaler values.  Such incorrect values mean the RTC counts
fast or slow, and will be wrong forever if the power/backup-battery is
always present.

This commit detects such a state at start up (hard reset) and corrects it
by reconfiguring the RTC prescaler values.

Signed-off-by: Damien George <damien@micropython.org>
2020-11-13 11:23:52 +11:00
Damien George
97960dc7de stm32: Support C++ code and user C modules written in C++.
Also build user C modules as part of the stm32 CI.

Signed-off-by: Damien George <damien@micropython.org>
2020-10-29 23:35:36 +11:00
Damien George
df3b466d6c stm32/boards: Factor out common data/bss/heap/stack linker sections.
Signed-off-by: Damien George <damien@micropython.org>
2020-10-29 23:31:59 +11:00
Damien George
0118c07916 stm32/machine_adc: Fix ADC auto-calibration to run when ADC not enabled.
Prior to this commit, the ADC calibration code was never executing because
ADVREGEN bit was set making the CR register always non-zero.

This commit changes the logic so that ADC calibration is always run when
the ADC is disabled and an ADC channel is initialised.  It also uses the LL
API functions to do the calibration, to make sure it is done correctly on
each MCU variant.

Signed-off-by: Damien George <damien@micropython.org>
2020-10-29 11:09:43 +11:00
Jim Mussared
893f75546c stm32/boards/NUCLEO_WB55/rfcore_firmware.py: Increase GET_STATE timeout.
When installing WS firmware, the very first GET_STATE can take several
seconds to respond (especially with the larger binaries like
BLE_stack_full).

Allows stm.rfcore_sys_hci to take an optional timeout, defaulting to
SYS_ACK_TIMEOUT_MS (which is 250ms).

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2020-10-16 10:45:03 +11:00
Jim Mussared
dfb63b5613 stm32/boards/NUCLEO_WB55/rfcore_firmware.py: Fix bad variable name.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2020-10-16 10:44:58 +11:00
Jim Mussared
520bb88d70 stm32/boards/NUCLEO_WB55/rfcore_firmware.py: Fix flash unlock.
The flash can sometimes be in an already-unlocked state, and attempting to
unlock it again will cause an immediate reset.  So make _Flash.unlock()
check FLASH_CR_LOCK to get the current state.

Also fix some magic numbers for FLASH_CR_LOCK AND FLASH_CR_STRT.

The machine.reset() could be removed because it no longer crashes now that
the flash unlock is fixed.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2020-10-16 10:43:36 +11:00
Jim Mussared
222ec1a4a8 stm32/boards/NUCLEO_WB55: Add standalone WB55 FUS/WS firmware updater.
This commit adds a script that can be run on-device to install FUS and WS
binaries from the filesystem.  Instructions for use are provided in
the rfcore_firmware.py file.

The commit also removes unneeded functionality from the existing rfcore.py
debug script (and renames it rfcore_debug.py).
2020-10-08 17:39:15 +11:00
Damien George
3e16763201 stm32/rfcore: Fix FUS layout and size of ipcc_device_info_table_t.
The device info table has a different layout when core 2 is in FUS mode.
In particular it's larger than the 32 bytes used when in WS mode and if the
correct amount of space is not allocated then the end of the table may be
overwritten with other data (eg with FUS version 0.5.3).  So update the
structure to fix this.

Also update rfcore.py to disable IRQs (which are enabled by rfcore.c), to
not depend on uctypes, and to not require the asm_thumb emitter.

Signed-off-by: Damien George <damien@micropython.org>
2020-09-22 14:08:22 +10:00
Jim Mussared
632e3b7acc stm32/boards/NUCLEO_WB55: Add Python helper code for rfcore.
This allows prototyping rfcore.c improvements from Python.

This was mostly written by @dpgeorge with small modifications to work after
rfcore_init() by @jimmo.
2020-09-08 23:54:02 +10:00
Jim Mussared
9c9cc7a02f stm32/boards/USBDONGLE_WB55: Add USE_MBOOT support. 2020-09-08 23:53:12 +10:00
Jim Mussared
30e8162ac4 stm32/rfcore: Update rfcore.c to match how ST examples work.
- Split tables and buffers into SRAM2A/2B.
- Use structs rather than word offsets to access tables.
- Use FLASH_IPCCDBA register value rather than option bytes directly.
2020-09-08 23:53:02 +10:00
Damien George
06659077a8 all: Update Python code to conform to latest black formatting.
Updating to Black v20.8b1 there are two changes that affect the code in
this repository:

- If there is a trailing comma in a list (eg [], () or function call) then
  that list is now written out with one line per element.  So remove such
  trailing commas where the list should stay on one line.

- Spaces at the start of """ doc strings are removed.

Signed-off-by: Damien George <damien@micropython.org>
2020-08-29 15:18:01 +10:00
Damien George
67fd58bbd2 stm32/mboot: Add support for littlefs.
Mboot now supports FAT, LFS1 and LFS2 filesystems, to load firmware from.
The filesystem needed by the board must be explicitly enabled by the
configuration variables MBOOT_VFS_FAT, MBOOT_VFS_LFS1 and MBOOT_VFS_LFS2.
Boards that previously used FAT implicitly (with MBOOT_FSLOAD enabled) must
now add the following config to mpconfigboard.h:

    #define MBOOT_VFS_FAT (1)

Signed-off-by: Damien George <damien@micropython.org>
2020-06-26 21:17:02 +10:00
Damien George
717b5073aa stm32/boards: Enable LFS2 on PYBD_SF3 and PYBD_SF6.
This was missed in commit 120368ba1a

Signed-off-by: Damien George <damien@micropython.org>
2020-06-25 16:32:48 +10:00
Damien George
6f40e6e131 stm32/boards: Add build-time option for NUCLEO_WB55 to use mboot.
As an example of how to use mboot on a WB series MCU.

Signed-off-by: Damien George <damien@micropython.org>
2020-06-22 14:18:15 +10:00
Damien George
ce02d5e348 stm32/boards/NUCLEO_WB55: Add more CPU pins and aliases to SW1/2/3.
Signed-off-by: Damien George <damien@micropython.org>
2020-06-18 10:48:24 +10:00
Damien George
2b9900380a stm32/boards/STM32F769DISC: Use macro instead of const for flash size.
So that the flash size can be changed in just one place.  Also remove the
duplicate cache entry.
2020-06-12 10:28:26 +10:00
Damien George
246f3f640d stm32/boards/xxx_WB55: Enable pyb.ADC and hardware SPI on WB55 boards.
These features are now supported (although machine.ADC is recommended over
pyb.ADC).
2020-06-02 10:48:49 +10:00
Damien George
5210fc51ec stm32/adc: Add support to pyb.ADC for STM32WB MCUs. 2020-06-02 10:48:49 +10:00
Thomas Roberts
463c0fb2f4 stm32/boards: Add board config for Nucleo-F412ZG development board. 2020-05-15 10:48:48 +10:00
Thomas Roberts
d7399679de stm32: Add support for F412 MCUs. 2020-05-15 10:08:30 +10:00
Damien George
e2def200bf stm32/boards/PYBD_SF2: Put BTstack library in external QSPI XIP flash.
In the same way the nimble stack is put there.
2020-05-05 20:21:15 +10:00
Damien George
83461e37d4 stm32/boards: Disable pend_throw, uheapq, utimeq on small-flash boards.
These are mainly used by the previous version of uasyncio which is now
replaced by a newer version, with built-in C module _uasyncio.  Saves about
1300 bytes of flash.
2020-03-28 13:55:59 +11:00
Damien George
35e2dd0979 stm32: Enable and freeze uasyncio. 2020-03-26 01:25:45 +11:00
Damien George
51f8591097 stm32/boards/PYBD: Allow building with BTstack (via make command line).
Work done in collaboration with Jim Mussared aka @jimmo.
2020-03-10 01:53:42 +11:00
Damien George
69661f3343 all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-28 10:33:03 +11:00
Damien George
d6a1e45caa stm32/usbd_conf: Allow boards to configure USB HS ULPI NXT/DIR pins. 2020-02-04 23:15:55 +11:00
Andrew Leech
ff9a61b5a8 stm32/sdram: Expose the result of sdram startup test in stm32_main.
This means boards can choose to only use it for gc heap if the test passes.
2020-02-04 18:18:41 +11:00
Damien George
2c8c2b935e stm32/powerctrl: Improve support for changing system freq on H7 MCUs.
This commit improves pllvalues.py to generate PLL values for H7 MCUs that
are valid (VCO in and out are in range) and extend for the entire range of
SYSCLK values up to 400MHz (up to 480MHz is currently unsupported).
2020-01-31 23:25:18 +11:00
Damien George
31ba06ce84 stm32/boards/stm32f746_af.csv: Add ADC alt functions to correct pins. 2020-01-30 16:31:11 +11:00
Damien George
96a4435be1 stm32/boards/STM32F769DISC: Add config to use external SPI as filesys.
This board now has the following 3 build configurations:
- mboot + external QSPI in XIP mode + internal filesystem
- mboot + external QSPI with filesystem (the default)
- no mboot + external QSPI with filesystem
2020-01-30 14:40:38 +11:00
Damien George
e3187b052f stm32/boards/PYBD: Change RTC asynch prediv from 1 to 4.
This change has the following effects:
- Reduces the resolution of the RTC sub-second counter from 30.52us to
  122.07us.
- Allows RTC.calibration() to now support positive values (as well as
  negative values).
- Reduces VBAT current consumption in standby mode by a small amount.

For general purpose use 122us resolution of the sub-second counter is
good enough, and the benefits of full range calibration and minor reduction
in VBAT consumption are worth the change.
2020-01-07 23:59:29 +11:00
Damien George
7ac326c424 stm32/boards/PYBD: Include webrepl helper scripts in frozen manifest. 2019-12-20 13:20:20 +11:00
roland van straten
43b576d88d stm32/boards/NUCLEO_H743ZI: Add extra pins and peripheral definitions.
- Corrected pin assignments and checked with CubeMX.
- Added additional I2C and UARTs.
- Added Ethernet interface definitions with lwIP and SSL support (but
  Ethernet is currently unsupported on H7 MCUs so not fully enabled).
2019-12-19 16:54:33 +11:00
roland van straten
26a78edb49 stm32/boards/NUCLEO_F767ZI: Update pins, peripherals and total flash.
- Removed remarks on DFU/OCD in mpconfigboard.h because deploy-stlink works
  fine too.
- Added more UARTs, I2C, corrected SPI, CAN, etc; verified against CubeMX.
- Adapted pins.csv to remove errors, add omissions, etc. according to
  NUCLEO-144 User Manual.
- Changed linker file stm32f767.ld to reflect correct size of the Flash.
- Tested with LAN and SD card.
2019-12-19 11:43:19 +11:00
roland van straten
8af139e8a4 stm32/boards/NUCLEO_F767ZI: Add pins and config for using an SD card.
The Nucleo board does not have an SD card slot but does have the requisite
pins next to each other and labelled, so provide the configuration for
convenience.
2019-12-19 11:28:47 +11:00
Damien George
fb01415599 stm32/boards/PYBD_SF2: Configure LEDs as inverted, for LED.intensity(). 2019-12-13 17:28:24 +11:00
Damiano Mazzella
cc634b9e92 stm32/boards/xxx_WB55: Enable littlefs2 on WB55 boards. 2019-12-09 14:07:29 +11:00
Damien George
11c22430d4 stm32/boards/NUCLEO_L073RZ: Skip board-pin names for CPU only pins.
This board doesn't have much flash and removing these unneeded names saves
about 900 bytes of code size.
2019-11-27 21:59:47 +11:00
Damien George
120368ba1a stm32/boards: Enable LFS2 on PYBv1.x and PYBD boards. 2019-11-26 00:08:57 +11:00
Mike Causer
258b147830 stm32/boards/stm32f405_af.csv: Fix typo in ETH_RMII_REF_CLK on PA1. 2019-11-11 12:02:14 +11:00
Damien George
799b6d1e0c extmod: Consolidate FAT FS config to MICROPY_VFS_FAT across all ports.
This commit removes the Makefile-level MICROPY_FATFS config and moves the
MICROPY_VFS_FAT config to the Makefile level to replace it.  It also moves
the include of the oofatfs source files in the build from each port to a
central place in extmod/extmod.mk.

For a port to enabled VFS FAT support it should now set MICROPY_VFS_FAT=1
at the level of the Makefile.  This will include the relevant oofatfs files
in the build and set MICROPY_VFS_FAT=1 at the C (preprocessor) level.
2019-11-11 11:37:38 +11:00
Damien George
32eae53fbc stm32/boards: Enable support for bluetooth on WB55 boards. 2019-11-01 14:58:24 +11:00
Damien George
6a64b280d0 stm32: Add support for RF coprocessor on WB55 MCUs.
This requires a BLE wireless stack firmware to be already programmed in the
secure flash area of the device.
2019-11-01 14:52:17 +11:00
Jim Mussared
8ba963cfa3 tools/makemanifest.py: Eval relative paths w.r.t. current manifest file.
When loading a manifest file, e.g. by include(), it will chdir first to the
directory of that manifest.  This means that all file operations within a
manifest are relative to that manifest's location.

As a consequence of this, additional environment variables are needed to
find absolute paths, so the following are added: $(MPY_LIB_DIR),
$(PORT_DIR), $(BOARD_DIR).  And rename $(MPY) to $(MPY_DIR) to be
consistent.

Existing manifests are updated to match.
2019-10-21 23:01:41 +11:00
Frederic.Pierson
925f244ab3 stm32/boards: Add NADHAT_PYB405 board. 2019-10-18 11:41:22 +11:00
Damien George
287800d6e1 stm32: Convert to use FROZEN_MANIFEST to specify frozen code.
All symlinks are removed, frozen files are now referenced via
boards/manifest.py.
2019-10-15 21:36:24 +11:00
ladyada
06ae818f93 stm32/boards: Add new board ADAFRUIT_F405_EXPRESS. 2019-10-11 11:50:36 +11:00
Damien George
4a6974bea5 stm32/boards/PYBD_SF2: Put nimble library in external QSPI XIP flash.
The BLE stack is not performance critical, so put it in external
memory-mapped flash to save internal flash for other things (like frozen
bytecode).
2019-10-05 23:51:33 +10:00
Damien George
26e90a0514 stm32/boards: Enable MICROPY_HW_RTC_USE_LSE on L4 boards.
The previous commit changed the default configuration on L4 MCUs to use
LSI, so configure these boards to use LSE again.
2019-10-04 16:10:13 +10:00
Jim Mussared
fafa9d35dd stm32/boards/PYBD: Enable BLE for Pyboard D. 2019-10-01 09:51:02 +10:00
Chris Mason
eb12fa3862 stm32/powerctrlboot: Add support for HSI at 8MHz on F0 MCUs.
For use with F0 MCUs that don't have HSI48.  Select the clock source
explicitly in mpconfigboard.h.

On the NUCLEO_F091RC board use HSE bypass when HSE is chosen because the
NUCLEO clock source is STLINK not a crystal.
2019-09-26 17:34:04 +10:00
iabdalkader
4f78ba3cf4 stm32/boards/NUCLEO_H743ZI: Enable FDCAN on this board. 2019-09-23 17:00:54 +10:00
cristian
cfec054073 stm32/board/NUCLEO_F746ZG: Enable Ethernet periph, lwip and ussl. 2019-09-11 11:20:58 +10:00
Jim Mussared
c8c37ca407 stm32/boards/STM32F769DISC: Fix number of SDRAM row bits.
According to the schematic, the SDRAM part on this board is a
MT48LC4M32B2B5-6A, with "Row addressing 4K A[11:0]" (per datasheet).  This
commit updates mpconfigboard.h from 13 to 12 to match.
2019-09-10 23:13:52 +10:00
Christopher Wilson
f9d142523c stm32/boards/MIKROE_CLICKER2_STM32: Add MikroElektronika Clicker2 board.
- STM32F407VGT6 (1MB of Flash, 192+4 Kbytes of SRAM)
- 5V (via USB) or Li-Polymer Battery (3.7V) power input
- 2 x LEDs
- 2 x user switches
- 2 x mikroBUS sockets
- 2 x 1x26 mikromedia-compatible headers (52 pins)

https://www.mikroe.com/clicker-2-stm32f4
2019-09-10 13:57:01 +10:00
Damien George
2b07f56c2b stm32/boards/NUCLEO_L073RZ: Fix typo in MCU name. 2019-09-10 11:53:00 +10:00
Damien George
bd2e46e0a5 stm32/boards/stm32wb55_af.csv: Fix ADC pin-channel function mapping. 2019-09-06 17:56:34 +10:00
Damien George
5789558d60 stm32/boards/PYBD_SF2: Exclude certain things when building mboot. 2019-08-28 12:37:13 +10:00
Damien George
b1e04848ef stm32/mphalport: Put PYBD specific MAC code in board specific file. 2019-08-28 12:37:13 +10:00
Damien George
8485b72d0d stm32/boards/NUCLEO_L432KC: Add config for USB VCP support. 2019-08-15 12:46:34 +10:00
Damien George
ad0b7cb017 stm32/boards/xxx_WB55: Enable USB HID now that it works on WB MCUs. 2019-07-25 17:49:53 +10:00
badlyby
3b258ef213 stm32/boards/NUCLEO_F722ZE: Add definition files for new board. 2019-07-25 16:31:36 +10:00
badlyby
09267bb147 stm32/boards/stm32f722.ld: Provide memory regions for internal FS. 2019-07-25 16:31:36 +10:00
Damien George
0c12adca46 stm32/boards/USBDONGLE_WB55: Add definition files for new board. 2019-07-17 17:00:34 +10:00
Damien George
d2a8fb747f stm32/boards/NUCLEO_WB55: Add definition files for new board. 2019-07-17 17:00:34 +10:00
Damien George
9849567a06 stm32/boards: Add MCU support files for STM32WB55. 2019-07-17 16:50:42 +10:00
Damien George
02b2ad4fbd stm32/boards/STM32F769DISC: Fix length of FLASH_APP section.
Fixes issue #4924.
2019-07-17 16:19:50 +10:00
Damien George
baea43bba7 stm32/boards/B_L072Z_LRWAN1: Enable USB VCP support. 2019-07-16 14:50:44 +10:00
Damien George
a17b901a9e stm32/boards/B_L072Z_LRWAN1: Add definition files for new board. 2019-07-09 12:54:09 +10:00
Damien George
d43dd886a5 stm32/boards/NUCLEO_F413ZH: Remove STARTUP_FILE, it's defined globally.
The Makefile now defines this variable to the correct value (but it can
still be overridden by a board if necessary).
2019-07-09 11:32:12 +10:00
Chris Mason
c24d81119c stm32/boards/NUCLEO_L452RE: Add definition files for new board. 2019-07-08 16:50:45 +10:00
Chris Mason
64181b5f76 stm32: Add support for STM32L452 MCUs. 2019-07-08 16:50:19 +10:00
Damien George
eea61a09c4 stm32/boards/NUCLEO_F446RE: Enable DAC. 2019-07-08 16:08:40 +10:00
Damien George
7c2e83324b stm32/boards/NUCLEO_L073RZ: Add definition files for new board. 2019-07-05 17:28:54 +10:00
Damien George
9c096c190c stm32/boards: Add MCU support files for STM32L072. 2019-07-05 17:26:03 +10:00
Damien George
c1a8c7fc09 stm32/boards/PYBD_SFx: Automatically turn on EN_3V3 when powering SD/MMC 2019-07-04 11:11:11 +10:00
Damien George
1cd2bc066d stm32/boards/PYBD_SFx: Configure EN_3V3 pin as output on boot.
But leave it turned off, the application must turn it on if/when needed.
2019-07-04 11:03:10 +10:00
Damien George
7cf8285ac8 stm32/boards: Remove startup_stm32*.s files now they are in stm32lib. 2019-07-03 23:44:17 +10:00
Damien George
73e8b7e0e4 stm32: Update components to work with new H7xx HAL. 2019-07-03 23:40:49 +10:00
Damien George
3581deec81 stm32/boards/PYBD_SF2: Put mbedtls library code in external QSPI flash.
mbedtls is large and self contained so is a good candidate to be in
external XIP flash, to keep enough spare ROM in internal flash.
2019-07-03 16:50:02 +10:00
Damien George
d821a27b58 stm32/boards/PYBD_SFx: Put SPI flash to sleep during sleep modes. 2019-07-03 01:27:33 +10:00
Chris Mason
3786592097 stm32/boards: Optimise flash and RAM allocation for L4 boards.
Optimisations are:
- Remove FLASH_ISR section since devices with a small flash sector erase
  size don't need special FLASH_ISR handling.  This reduces flash image by
  approx 1.5k.
- Make SRAM2 contiguous with SRAM1 where possible.
- Simplify configuration of 2k RAM buffer used for flash filesystem.

RAM changes with this commit:
- L432: stack   6k -> 10k,  bss + heap   42k ->  52k
- L476: stack  16k -> 30k,  bss + heap   80k ->  96k
- L496: stack 206k -> 16k,  bss + heap  112k -> 302k
2019-07-01 16:57:20 +10:00
Damien George
009b1f6559 stm32/boards: Rework all stm32??xx_hal_conf.h files to use common code.
This eliminates a lot of duplicated code in these header files.
2019-06-25 14:18:24 +10:00
Damien George
f96f53cd97 stm32/boards: Add stm32??xx_hal_conf_base.h files with common settings.
These are intended to be used by all boards, to reduce the size of a
board's configuration.
2019-06-25 14:18:24 +10:00
Damien George
89ebb3325b stm32/boards/pllvalues.py: Support HSx_VALUE defined without uint32_t. 2019-06-25 14:18:24 +10:00
Damien George
04c7cdb668 stm32: Enter bootloader via a system reset.
Entering a bootloader (ST system bootloader, or custom mboot) from software
by directly branching to it is not reliable, and the reliability of it
working can depend on the peripherals that were enabled by the application
code.  It's also not possible to branch to a bootloader if the WDT is
enabled (unless the bootloader has specific provisions to feed the WDT).

This patch changes the way a bootloader is entered from software by first
doing a complete system reset, then branching to the desired bootloader
early on in the start-up process.  The top two words of RAM (of the stack)
are reserved to store flags indicating that the bootloader should be
entered after a reset.
2019-06-25 14:15:49 +10:00
Damien George
5da60ff9cb stm32/boards: Enable ussl module via mbedtls for boards with network. 2019-06-24 17:48:28 +10:00
Chris Mason
14cf91f704 stm32: In link script, define start of stack separately from heap end.
Previously the end of the heap was the start (lowest address) of the stack.
With the changes in this commit these addresses are now independent,
allowing a board to place the heap and stack in separate locations.
2019-06-14 15:29:24 +10:00
Damien George
fd839221fd stm32/boards/PYBD_SFx: Enable ussl module using mbedTLS. 2019-06-05 15:38:01 +10:00
Damien George
62fe47aa3a stm32/boards/PYBD_SFx: Enable CYW43 WLAN driver. 2019-06-03 17:14:34 +10:00
Damien George
8f55c74533 stm32/boards: Add board definition files for PYBD -SF2, -SF3, -SF6.
These are core configurations providing PYBv1.x-level features.
2019-05-31 22:44:25 +10:00
Damien George
34cae24e30 stm32/boards/pllvalues.py: Search nested headers for HSx_VALUE defines. 2019-05-31 21:44:53 +10:00
Damien George
f8274d5e7d stm32/boards/make-pins.py: Allow pins.csv to skip or hide board-pin name
If the board-pin name is left empty then only the cpu-pin name is used, eg
",PA0".  If the board-pin name starts with a hyphen then it's available as
a C definition but not in the firmware, eg "-X1,PA0".
2019-05-31 21:41:30 +10:00
iabdalkader
746fcea7f8 stm32/boards/NUCLEO_H743ZI: Enable SPI3 on this board. 2019-05-15 16:08:10 +10:00
Chris Mason
2a791170ce stm32/boards: Add NUCLEO_F413ZH board configuration.
The alternate function pin allocations are different to other NUCLEO-144
boards.  This is because the STM32F413 has a very high peripheral count:
10x UART, 5x SPI, 3x I2C, 3x CAN.  The pinout was chosen to expose all
these devices on separate pins except CAN3 which shares a pin with UART1
and SPI1 which shares pins with DAC.
2019-05-02 16:33:30 +10:00
Chris Mason
1b956ec817 stm32: Add support for F413 MCUs.
Includes:
- Support for CAN3.
- Support for UART9 and UART10.
- stm32f413xg.ld and stm32f413xh.ld linker scripts.
- stm32f413_af.csv alternate function mapping.
- startup_stm32f413xx.s because F413 has different interrupt vector table.
- Memory configuration with: 240K filesystem, 240K heap, 16K stack.
2019-05-02 16:26:53 +10:00
Damien George
3fbf32b947 stm32/powerctrl: Support changing frequency when HSI is clock source.
This patch makes pllvalues.py generate two tables: one for when HSI is used
and one for when HSE is used.  The correct table is then selected at
compile time via the existing MICROPY_HW_CLK_USE_HSI.
2019-05-02 13:00:00 +10:00
Damien George
11657f2f20 stm32/system_stm32f0: Add support for using HSE and PLL as SYSCLK.
To configure the SYSCLK on an F0 enable one of:

    MICROPY_HW_CLK_USE_HSI48
    MICROPY_HW_CLK_USE_HSE
    MICROPY_HW_CLK_USE_BYPASS
2019-04-18 16:00:45 +10:00
Damien George
358364b45e stm32/boards/NUCLEO_L432KC: Disable complex nos and default frozen mods.
To save space, since this board only hase 256k of flash.
2019-04-09 11:23:08 +10:00
Damien George
4831e38c7e stm32/boards/NUCLEO_H743ZI: Add config options to support mboot. 2019-04-08 14:34:37 +10:00
Damien George
9670b26526 stm32: Rename MICROPY_HW_HAS_SDCARD to MICROPY_HW_ENABLE_SDCARD.
For consistency with the majority of other MICROPY_HW_ENABLE_xxx macros.
2019-04-01 15:21:26 +11:00
Boris Vinogradov
1a608ce1e8 stm32/boards/STM32L476DISC: Enable servo support on STM32L476DISC board. 2019-03-28 15:35:58 +11:00
Francisco J. Manno
f938e70c69 stm32: Add compile-time option to use HSI as clock source.
To use HSI instead of HSE define MICROPY_HW_CLK_USE_HSI as 1 in the board
configuration file.  The default is to use HSE.

HSI has been made the default for the NUCLEO_F401RE board to serve as an
example, and because early revisions of this board need a hardware
modification to get HSE working.
2019-03-05 15:49:08 +11:00
Damien George
e61862d063 stm32/boards: Update to use new build config for lwip component. 2019-03-04 23:34:03 +11:00
Damien George
84479569de stm32/boards/STM32F769DISC: Use external QSPI flash to store some code.
This demonstrates how to use external QSPI flash in XIP (execute in place)
mode.  The default configuration has all extmod/ code placed into external
QSPI flash, but other code can easily be put there by modifying the custom
f769_qspi.ld script.
2019-03-04 22:40:15 +11:00
Damien George
823b31e528 stm32/boards/NUCLEO_F429ZI: Enable lwIP and Ethernet peripheral. 2019-02-26 23:32:19 +11:00
Damien George
ed0a530614 stm32/boards/STM32F769DISC: Enable lwIP and Ethernet peripheral. 2019-02-26 23:32:19 +11:00
Damien George
b3513f54d3 stm32/boards/STM32F7DISC: Enable lwIP and Ethernet peripheral. 2019-02-26 23:32:19 +11:00
Damien George
8daec24168 stm32/boards/NUCLEO_F767ZI: Enable lwIP and Ethernet peripheral. 2019-02-26 23:32:19 +11:00
Damien George
75a35448e1 stm32/boards/NUCLEO_F767ZI: Fix up comments about HCLK computation. 2019-02-26 22:44:27 +11:00
Damien George
c65e5c88b8 stm32/boards/stm32f429.ld: Increase uPy heap size by 64k for F429 MCU.
The F429 has 256k total RAM, with 64k already set aside for flash write
cache, so the uPy heap can be increased this much.
2019-02-18 13:18:59 +11:00
Damien George
7b2dc96251 stm32/boards/make-pins.py: Add cmdline options to support use by mboot. 2019-02-14 13:35:39 +11:00
Jolatomme
d1acca3c71 stm32/boards/NUCLEO_L476RG: Add support for RNG, DAC and CAN1.
PLLQ is changed to get CAN working, and I2C1 pins are changed to those
prescribed by the board.
2019-02-14 00:28:28 +11:00
Damien George
1669e049de stm32/boards/STM32F769DISC: Configure for use with mboot by default.
This is a good board to demonstrate the use of Mboot because it only has a
USB HS port exposed so the native ST DFU mode cannot be used.  With Mboot
this port can be used.
2019-02-07 16:28:01 +11:00
Damien George
be1b1835c3 stm32/boards/STM32F769DISC: Support the use of USB HS with external PHY. 2019-02-07 16:26:46 +11:00
Damien George
b367c425e4 stm32/boards/stm32h743_af.csv: Add ADC entries to pin capability table. 2019-02-06 13:34:53 +11:00
Damien George
02682d52ce stm32/boards/make-pins.py: Add basic support for STM32H7 ADC periphs. 2019-02-06 13:34:23 +11:00
Damien George
4bed17e786 stm32/boards/stm32f429_af.csv: Fix typos in UART defs Tx->TX and Rx->RX.
Fixes issue #4445.
2019-01-31 01:02:42 +11:00
Damien George
5146e79490 stm32/boards/NUCLEO_L432KC: Specify L4 OpenOCD config file for this MCU. 2018-12-13 13:45:16 +11:00
Damien George
59f409a787 stm32/boards: Allow OpenOCD stm_flash procedure to accept single FW img.
To support deplop-openocd on target boards that use TEXT0_ADDR only and
have their firmware in a single binary image.
2018-12-13 13:43:10 +11:00
boochow
69b7b8fa12 stm32/boards: Add NUCLEO_L432KC board configuration files. 2018-12-06 13:33:29 +11:00
boochow
1a8baad7ca stm32/boards: Add STM32L432KC chip configuration files.
The pin alternate function information is derived from ST's datasheet
https://www.st.com/resource/en/datasheet/stm32l432kc.pdf
In the datasheet, the line 2 of AF4 includes I2C2 but actually the chip
does not have I2C2 so it is removed.
2018-12-06 13:32:43 +11:00
Damien George
c040961e91 stm32/boards: Add configuration for putting mboot on PYBv1.x. 2018-12-04 23:48:18 +11:00
roland
10bddc5c28 stm32/boards/STM32F429DISC: Enable UART as secondary REPL.
The board(s) feature a VCOM through the ST-LINK, this feature is something
to keep around.
2018-12-01 17:30:48 +11:00
roland
30ed2b3cab stm32/system_stm32: Introduce configuration defines for PLL3 settings.
A board must be able to set the PLL3 values based on the HSE that it uses.
2018-11-01 13:25:47 +11:00
Damien George
d2c5496894 stm32/boards/stm32h743.ld: Fix total flash size, should be 2048k.
Fixes issue #4240.
2018-10-17 15:29:56 +11:00
Andrew Leech
338635ccc6 stm32/main: Add configuration macros for board to set heap start/end.
The macros are MICROPY_HEAP_START and MICROPY_HEAP_END, and if not defined
by a board then the default values will be used (maximum heap from SRAM as
defined by linker symbols).

As part of this commit the SDRAM initialisation is moved to much earlier in
main() to potentially make it available to other peripherals and avoid
re-initialisation on soft-reboot.  On boards with SDRAM enabled the heap
has been set to use that.
2018-10-05 17:30:18 +10:00