84 LogPrint(
"\n\n--------------------------------------------\n");
85 LogPrint(
"Power up, Boot started\n");
90 LogPrint(
"--------------------------------------------\n");
95 LogPrint(
"Note: OBL flag is active\n");
96 #if (CLEAR_RESET_FLAGS)
111 LogPrint(
"Entering the built-in system memory boot mode...\n");
118 LogPrint(
"Starting the firmware update process...\n");
122 LogPrint(
"Application space in flash is write protected\n");
123 LogPrint(
"Press button to disable flash write protection...\n");
127 LogPrint(
"Disabling write protection and generating system "
129 LogPrint(
"Note: The button must be pressed again after "
130 "the reset to perform the update\n");
135 "Error: Write protection could not be disabled\n");
141 LogPrint(
"Warning: Button was not pressed, write "
142 "protection is still active\n");
143 LogPrint(
"Note: Firmware update is skipped\n");
151 LogPrint(
"Error: Firmware update failed\n");
155 #if (USE_WRITE_PROTECTION)
157 LogPrint(
"Enablig flash write protection and generating system "
161 LogPrint(
"Error: Failed to enable write protection\n");
167 LogPrint(
"Error: Invalid user command\n");
175 LogPrint(
"Launching application...\n");
192 LogPrint(
"Error: No application in flash\n");
209 uint8_t buttonCounter = 0U;
213 if (buttonCounter == 10U)
215 LogPrint(
"Release button now to update the firmware...\n");
217 if (buttonCounter == 40U)
220 "Release button now to enter the built-in system memory boot "
224 if (buttonCounter < 10U)
229 else if (buttonCounter == 10U)
234 else if (buttonCounter < 40U)
238 else if (buttonCounter == 40U)
255 if (buttonCounter < 90U)
257 if (buttonCounter > 40U)
261 else if (buttonCounter > 10U)
272 LogPrint(
"Note: Button is pressed too long\n");
280 bool isPressed =
false;
284 for (uint_fast8_t i = 0U; i < 100U; ++i)
This file contains the board-specific GPIO pin definitions, peripheral configurations,...
This file contains the bootloader configuration parameters, function prototypes, and other required d...
This file contains the CRC peripheral driver function prototypes for initialization,...
This file contains the delay function prototypes.
This file contains the error handling function prototypes.
This file contains the MCU internal flash driver function prototypes for read, write,...
bool BootloaderUpdateFirmware(void)
This function performs the complete application update procedure.
bool BootloaderCheckForApplication(void)
This function checks whether a valid application exists in flash.
void BootloaderJumpToApplication(void)
This function performs the jump to the user application in flash.
void BootloaderJumpToSysMem(void)
This function performs the jump to the microcontroller System Memory (ST built-in bootloader).
void ErrorHandler(void)
This function is executed in case of error occurrence.
#define BOOTLOADER_VERSION_MAJOR
#define BOOTLOADER_VERSION_MINOR
static BootloaderCommand WaitForUserCommand(void)
Wait for a user command by monitoring the button press duration.
int main(void)
The main function.
#define BOOTLOADER_VERSION_PATCH
static bool WaitForSingleButtonPress(void)
Wait for a single button press within a timeout period.
@ BL_CMD_LAUNCH_APPLICATION
@ BL_CMD_ENTER_SYSMEM_BOOT
void BoardDeInit(void)
De-initialize the board hardware and peripherals.
void BoardInit(void)
Initialize the board hardware and peripherals.
void DelayMs(const uint32_t delayMs)
Blocking delay for the specified number of milliseconds.
bool FlashEnableWriteProtection(const uint32_t address, const uint32_t length)
Enable flash write protection for the specified region.
bool FlashCheckIfWriteProtectionEnabled(const uint32_t address, const uint32_t length)
Check if flash write protection is enabled for the specified region.
bool FlashDisableWriteProtection(void)
Disable flash write protection for the application area.
void LedGreen1Off(void)
Turn off the 1st green LED (LD2).
void LedGreen2Toggle(void)
Toggle the 2nd green LED (LD3).
void LedGreen1Toggle(void)
Toggle the 1st green LED (LD2).
void LedGreen2On(void)
Turn on the 2nd green LED (LD3).
void LedGreen2Off(void)
Turn off the 2nd green LED (LD3).
void LedGreen1On(void)
Turn on the 1st green LED (LD2).
void LogPrint(const char *format,...)
Print a formatted log message over the UART interface.
void RccResetFlagsClear(void)
Clear all RCC reset flags.
bool RccResetFlagOblIsSet(void)
Check if the option byte loader reset flag is set.
This file contains the LED driver function prototypes for controlling the green LEDs on the STM32L496...
This file contains the UART-based logging function prototypes for the debug output.
This file contains the main application header with bootloader version definitions.
This file contains the RCC (Reset and Clock Control) driver function prototypes for enabling and disa...
This file contains the SD card disk I/O driver interface for the FatFs middleware.
This file contains the SDMMC peripheral driver function prototypes for SD card initialization,...