[FL-164] Add bootloader version (#417)

* Add bootloader versioning
* Move some logic to api-hal-version
* Backport to f4
* Dolphin: update version screen layout, make it more readable

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Albert Kharisov
2021-04-19 19:30:25 +03:00
committed by GitHub
parent 202673aed1
commit aa20a78b0e
21 changed files with 320 additions and 27 deletions

View File

@@ -55,7 +55,7 @@ _Min_Stack_Size = 0x400; /* required amount of stack */
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32K
RAM1 (xrw) : ORIGIN = 0x20000004, LENGTH = 0x2FFFC
RAM_SHARED (xrw) : ORIGIN = 0x20030000, LENGTH = 10K
}

View File

@@ -9,6 +9,8 @@
#include <stm32wbxx_ll_gpio.h>
#include <stm32wbxx_hal_flash.h>
#include <version.h>
// Boot request enum
#define BOOT_REQUEST_NONE 0x00000000
#define BOOT_REQUEST_DFU 0xDF00B000
@@ -128,6 +130,10 @@ void rtc_init() {
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_RTCAPB);
}
void version_save(void) {
LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR1, (uint32_t)version_get());
}
void lcd_backlight_on() {
LL_GPIO_SetOutputPin(BOOT_LCD_BL_PORT, BOOT_LCD_BL_PIN);
}
@@ -142,6 +148,7 @@ void target_init() {
clock_init();
gpio_init();
rtc_init();
version_save();
usb_wire_reset();
// Errata 2.2.9, Flash OPTVERR flag is always set after system reset

View File

@@ -24,6 +24,10 @@ CFLAGS += -I$(CUBE_DIR)/Drivers/STM32WBxx_HAL_Driver/Inc
LDFLAGS += -T$(TARGET_DIR)/stm32wb55xx_flash_cm4.ld
# Version generation
CFLAGS += -I../lib/version
C_SOURCES += ../lib/version/version.c
ASM_SOURCES += $(wildcard $(TARGET_DIR)/*.s)
C_SOURCES += $(wildcard $(TARGET_DIR)/*.c)
CPP_SOURCES += $(wildcard $(TARGET_DIR)/*.cpp)

View File

@@ -55,7 +55,7 @@ _Min_Stack_Size = 0x400; /* required amount of stack */
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32K
RAM1 (xrw) : ORIGIN = 0x20000004, LENGTH = 0x2FFFC
RAM_SHARED (xrw) : ORIGIN = 0x20030000, LENGTH = 10K
}

View File

@@ -9,6 +9,7 @@
#include <stm32wbxx_ll_gpio.h>
#include <stm32wbxx_hal_flash.h>
#include <version.h>
#include <api-hal.h>
// Boot request enum
@@ -110,6 +111,10 @@ void rtc_init() {
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_RTCAPB);
}
void version_save(void) {
LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR1, (uint32_t)version_get());
}
void usb_wire_reset() {
LL_GPIO_ResetOutputPin(BOOT_USB_PORT, BOOT_USB_PIN);
LL_mDelay(10);
@@ -122,6 +127,7 @@ void target_init() {
api_hal_init();
target_led_control("RGB");
rtc_init();
version_save();
usb_wire_reset();
// Errata 2.2.9, Flash OPTVERR flag is always set after system reset

View File

@@ -37,6 +37,9 @@ C_SOURCES += $(DRIVERS_DIR)/lp5562.c
CFLAGS += -I$(TARGET_DIR)/api-hal
C_SOURCES += $(wildcard $(TARGET_DIR)/api-hal/*.c)
# Version generation
CFLAGS += -I../lib/version
C_SOURCES += ../lib/version/version.c
ASM_SOURCES += $(wildcard $(TARGET_DIR)/*.s)
C_SOURCES += $(wildcard $(TARGET_DIR)/*.c)