* Boot: switch to DFU routines. Implements #132 part 1 of 2. * Boot: boot to DFU shortcut, hard reset USB on each boot. Implements #132 part 2 of 2. * Deploy scripts: fix path for deploy dfu. * Bootloader: initial version. Target_f2: rebase, update deployment scripts. * Bootloader: cleanup, refactor switch2 proc. Readme,wiki: document bootloader. * Wiki: deploy symlinks as files, bootloader info. * Target_f2: valid flash size in linker script. * Github CI: bootloader build and artifacts. * Bootloader: rename platforms to targets. * Bootloader: change dfu/os colors. * disable set -e * lint code * add bootloader testing page Co-authored-by: Aleksandr Kutuzov <aku@plooks.com> Co-authored-by: aanper <mail@s3f.ru>
This commit is contained in:
@@ -44,6 +44,7 @@ C_DEFS =
|
||||
|
||||
C_SOURCES += \
|
||||
Src/main.c \
|
||||
Src/boot.c \
|
||||
Src/freertos.c \
|
||||
Src/stm32l4xx_it.c \
|
||||
Src/stm32l4xx_hal_msp.c \
|
||||
|
@@ -63,7 +63,7 @@ MEMORY
|
||||
{
|
||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
|
||||
RAM2 (xrw) : ORIGIN = 0x10000000, LENGTH = 32K
|
||||
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
|
||||
FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 992K
|
||||
}
|
||||
|
||||
/* Define output sections */
|
||||
|
19
target_f2/Src/boot.c
Normal file
19
target_f2/Src/boot.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "boot.h"
|
||||
#include "stm32l4xx_ll_bus.h"
|
||||
#include "stm32l4xx_ll_rcc.h"
|
||||
#include "stm32l4xx_ll_rtc.h"
|
||||
#include "stm32l4xx_ll_pwr.h"
|
||||
|
||||
#define BOOT_REQUEST_DFU 0xDF00B000
|
||||
|
||||
void boot_restart_in_dfu() {
|
||||
// Request DFU on boot
|
||||
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
|
||||
LL_PWR_EnableBkUpAccess();
|
||||
// Enable RTC
|
||||
LL_RCC_EnableRTC();
|
||||
// Write backup registry
|
||||
LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_DFU);
|
||||
// Reset
|
||||
NVIC_SystemReset();
|
||||
}
|
@@ -20,6 +20,7 @@
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
#include "boot.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "usb_device.h"
|
||||
|
||||
@@ -89,7 +90,6 @@ void StartDefaultTask(void const* argument);
|
||||
*/
|
||||
int main(void) {
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
|
||||
/* MCU Configuration--------------------------------------------------------*/
|
||||
|
@@ -123,6 +123,8 @@
|
||||
/*!< Uncomment the following line if you need to relocate your vector Table in
|
||||
Internal SRAM. */
|
||||
/* #define VECT_TAB_SRAM */
|
||||
#define VECT_TAB_OFFSET \
|
||||
0x8000 /*!< Vector Table base offset field.
|
||||
#define VECT_TAB_OFFSET \
|
||||
0x00 /*!< Vector Table base offset field.
|
||||
This value must be a multiple of 0x200. */
|
||||
|
3
target_f2/deploy-dfu.sh
Executable file
3
target_f2/deploy-dfu.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
dfu-util -D `dirname "$0"`/build/target_prod.bin -a 0 -s 0x08008000
|
@@ -1 +1,3 @@
|
||||
st-flash write `dirname "$0"`/build/target_prod.bin 0x08000000
|
||||
#!/bin/bash
|
||||
|
||||
st-flash --reset write `dirname "$0"`/build/target_prod.bin 0x08008000
|
||||
|
Reference in New Issue
Block a user