Application code at an offset address in the flash and vector table relocation

Blog Post created by fillon.nicolas Employee on Aug 25, 2017



When you are doing IAP you will need to have a project for your application code which is located at an address after the user bootlaoder and settable in the code. You also need to relocate the vector table.


This code example does that.


The zip file contains a set of sources files that build the application to be loaded into Flash memory using In-Application Programming (IAP, through USART for example).


To build such application, some special configuration has to be performed:


1. Set the program load address at 0x08004000, using your toolchain linker file
2. Relocate the vector table at address 0x08004000, using the "NVIC_SetVectorTable"


@note Care must be taken when using HAL_Delay(), this function provides accurate delay (in milliseconds)
based on variable incremented in SysTick ISR. This implies that if HAL_Delay() is called from
a peripheral ISR process, then the SysTick interrupt must have higher priority (numerically lower)
than the peripheral interrupt. Otherwise the caller ISR process will be blocked.
To change the SysTick interrupt priority you have to use HAL_NVIC_SetPriority() function.

@note The application need to ensure that the SysTick time base is always set to 1 millisecond
to have correct HAL operation.

Four LEDs are toggled with a timing defined by the Delay function.


Hope it helps.