refactor: IWDG driver and EM trigger (#3846)
This commit is contained in:
@@ -41,6 +41,8 @@ set(BOOTLOADER_SRC
|
||||
../stm32_gpio_driver.cpp
|
||||
../stm32_timer.cpp
|
||||
../stm32_dma.cpp
|
||||
../watchdog_driver.cpp
|
||||
../abnormal_reboot.cpp
|
||||
init.c
|
||||
boot.cpp
|
||||
bin_files.cpp
|
||||
@@ -137,11 +139,17 @@ remove_definitions(-DLUA)
|
||||
remove_definitions(-DCLI)
|
||||
remove_definitions(-DSEMIHOSTING)
|
||||
remove_definitions(-DUSB_SERIAL)
|
||||
remove_definitions(-DWATCHDOG)
|
||||
remove_definitions(-DUSE_WATCHDOG)
|
||||
|
||||
add_definitions(-DBOOT)
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-mcpu=${MCU} -mthumb -nostartfiles -lm -T${RADIO_SRC_DIR}/targets/${TARGET_DIR}/stm32_ramboot.ld -Wl,-Map=bootloader.map,--cref,--no-warn-mismatch,--gc-sections")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-mcpu=${MCU} -mthumb -nostartfiles -lm")
|
||||
|
||||
set(LINKER_DIR ${RADIO_SRC_DIR}/boards/generic_stm32/linker)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -T${LINKER_DIR}/bootloader.ld -L${LINKER_DIR} -L${LINKER_DIR}/${TARGET_LINKER_DIR}")
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Map=bootloader.map,--cref,--no-warn-mismatch,--gc-sections")
|
||||
|
||||
# use smaller nano libc
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --specs=nano.specs")
|
||||
|
||||
|
||||
@@ -35,8 +35,7 @@
|
||||
#include "debug.h"
|
||||
|
||||
#include "timers_driver.h"
|
||||
#include "watchdog_driver.h"
|
||||
|
||||
#include "hal/abnormal_reboot.h"
|
||||
#include "hal/rotary_encoder.h"
|
||||
|
||||
#if defined(DEBUG_SEGGER_RTT)
|
||||
@@ -80,8 +79,6 @@ const uint8_t bootloaderVersion[] __attribute__ ((section(".version"), used)) =
|
||||
{'B', 'O', 'O', 'T', '1', '0'};
|
||||
#endif
|
||||
|
||||
#define SOFTRESET_REQUEST 0xCAFEDEAD
|
||||
|
||||
volatile tmr10ms_t g_tmr10ms;
|
||||
volatile uint8_t tenms = 1;
|
||||
|
||||
@@ -309,13 +306,10 @@ int bootloaderMain()
|
||||
|
||||
#if defined(PWR_BUTTON_PRESS)
|
||||
// wait until power button is released
|
||||
while (pwrPressed()) {
|
||||
WDG_RESET();
|
||||
}
|
||||
while (pwrPressed()) {}
|
||||
#endif
|
||||
|
||||
for (;;) {
|
||||
WDG_RESET();
|
||||
|
||||
if (tenms) {
|
||||
tenms = 0;
|
||||
@@ -560,10 +554,6 @@ int bootloaderMain()
|
||||
if (state == ST_REBOOT) {
|
||||
sdDone();
|
||||
#if !defined(SIMU)
|
||||
#if defined(RTC_BACKUP_RAM)
|
||||
rtcInit();
|
||||
RTC->BKP0R = SOFTRESET_REQUEST;
|
||||
#endif
|
||||
blExit();
|
||||
NVIC_SystemReset();
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user