Add bootloader

This commit is contained in:
2022-12-06 08:55:42 +01:00
parent 9830c36543
commit 4e3b086afd
7 changed files with 43 additions and 9 deletions

View File

@ -91,7 +91,24 @@ void vDefaultTask(void *argument);
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
/**
* @brief Vector base address configuration. It should no longer be at the start of
* flash memory but moved forward because the first part of flash is
* reserved for the bootloader. Note that this is already done by the
* bootloader before starting this program. Unfortunately, function
* SystemInit() overwrites this change again.
* @return none.
*/
static void VectorBase_Config(void)
{
/* The constant array with vectors of the vector table is declared externally in the
* c-startup code.
*/
extern const unsigned long g_pfnVectors[];
/* Remap the vector table to where the vector table is located for this program. */
SCB->VTOR = (unsigned long)&g_pfnVectors[0];
}
/* USER CODE END 0 */
/**
@ -101,7 +118,7 @@ void vDefaultTask(void *argument);
int main(void)
{
/* USER CODE BEGIN 1 */
VectorBase_Config();
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/