2016-10-12 06:07 AM
Hi!
I work on a Nucelo 144, with STM32F4 I try to make a jump starting from the start application (sector 1, address 0x8000000, bank 1) to another application contained in Sector 17 ( address 0x8120000, bank 2). I made a code by helping me an example of IAP with jump_to_app function. The jump is not working. The problem might be for the management of the vector table ? main.c#define SECTOR_5_ADDRESS 0x08020000 //PROG #2
#define SECTOR_17_ADDRESS 0x08120000 //PROG #1
/* Jump_Sector17 Parameters */
typedef
void
(*pFunction)(
void
);
pFunction Jump_to_application;
uint32_t Jump_address;
void
Jump_Sector17(
void
);
int
main(
void
)
{
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize GPIO peripherals */
MX_GPIO_Init();
HAL_GPIO_WritePin(GPIOB, LD2_Pin, GPIO_PIN_SET);
Jump_Sector17();
#endif
}
void
Jump_Sector17(
void
)
{
/* Set system control register SCR->VTOR */
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x12000);
/* Jump to user app */
Jump_address = (*(__IO uint32_t*) (SECTOR_17_ADDRESS + 4));
Jump_to_application = (pFunction) Jump_address;
/* Initialize to user application */
__set_MSP(*(__IO uint32_t*) SECTOR_17_ADDRESS);
Jump_to_application();
}
system_stm32f4xx.c
#define BL
/* #define VECT_TAB_SRAM */
#ifdef BL
#define VECT_TAB_OFFSET 0x12000 /*!< Vector Table base offset app. */
#else
#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset boot. */
#endif
/* This value must be a multiple of 0x */
I hope that my explanation was clear, english is not my native language. Thank you in advance for your help.
2016-10-12 10:49 AM
The problem might be for the management of the vector table ?
Or what is in the Vector Table. Make sure you built it for the address you have placed it.Consider using a debugger and stepping across the transition and into the startup code on the other side. Perhaps you can refine ''not working'' into something more specific about what IS happening.