Commit Graph

8 Commits

Author SHA1 Message Date
Damien George
9b158d60e1 stm32/mboot: Always use a flash latency of 1WS to match 48MHz HCLK. 2018-06-26 00:06:04 +10:00
Damien George
967123d42e stm32/mboot: Only compile in code for the USB periph that is being used.
Prior to this patch, if both USB FS and HS were enabled via the
configuration file then code was included to handle both of their IRQs.
But mboot only supports listening on a single USB peripheral, so this patch
excludes the code for the USB that is not used.
2018-06-26 00:02:36 +10:00
Damien George
37c4fd3b50 stm32/mboot: Fix bug with invalid memory access of USB state.
Only one of pcd_fs_handle/pcd_hs_handle is ever initialised, so if both of
these USB peripherals are enabled then one of these if-statements will
access invalid memory pointed to by an uninitialised Instance.  This patch
fixes this bug by explicitly referencing the peripheral struct.
2018-06-25 23:39:46 +10:00
Damien George
ec7982ec6d stm32/mboot: Add support for erase/read/write of external SPI flash.
This patch adds support to mboot for programming external SPI flash.  It
allows SPI flash to be programmed via a USB DFU utility in the same way
that internal MCU flash is programmed.
2018-06-22 15:30:34 +10:00
Damien George
5962c210c5 stm32/mboot: Define constants for reset mode cycling and timeout.
And fix timeout value so that it does actually finish with reset_mode=1.
2018-06-19 23:23:17 +10:00
Damien George
ceff433fcc stm32/mboot: Adjust user-reset-mode timeout so it ends with mode=1.
If the user button is held down indefinitely (eg unintenionally, or because
the GPIO signal of the user button is connected to some external device)
then it makes sense to end the reset mode cycle with the default mode of
1, which executes code as normal.
2018-06-18 12:23:27 +10:00
Damien George
24c416cc66 stm32/mboot: Increase USB rx_buf and DFU buf sizes to full 2048 bytes.
The DFU USB config descriptor returns 0x0800=2048 for the supported
transfer size, and this applies to both TX (IN) and RX (OUT).  So increase
the rx_buf to support this size without having a buffer overflow on
received data.

With this patch mboot in USB DFU mode now works with dfu-util.
2018-06-08 15:29:52 +10:00
Damien George
15ddc20436 stm32: Add new component, the mboot bootloader.
Mboot is a custom bootloader for STM32 MCUs.  It can provide a USB DFU
interface on either the FS or HS peripherals, as well as a custom I2C
bootloader interface.
2018-05-24 23:21:19 +10:00