AnsweredAssumed Answered

NVIC_systemReset issue - Interrupts remapping with Bootloader for STM32F0xx

Question asked by kumar.rajeev.004 on Apr 26, 2017
Latest reply on Apr 26, 2017 by Clive One

Hi,

I am developing bootloader for STM32F030ccT6 to upgrade my Main Application through OTA. There are two application within my controller flash one is BOOTLOADER( @ 0x08000000) and other is Main Application( @ 0x08001000 ) .

Now I have done Jump from Bootloader to Application and running one 2 USART and 2 Timer Interupts of main application correctly. But here is a problem with NVIC_SystemReset and IWDG may be some other also but i checked only these two.

Actually when I reset Main Application using NVIC_SystemReset then it calls reset handler of Bootloader. But as i think it should call reset handler of Main Application rather than Bootloader.

 Please give me suggestion for this different bahaviour with NVIC_SystemReset.

 

/******************* Jump from Bootloader to Application *******************/

void Execute_MainApplication(void)

{
__disable_irq();
STM32F0xx_DiableIRQ(USART1_IRQn); //! \RTU_Port
STM32F0xx_DiableIRQ(TIM16_IRQn); //! \Timer
RCC_DeInit();


uint32_t StartAddress = 0x08001000;
uint32_t MemoryAddr = (uint32_t)StartAddress;
uint32_t *pMem = (uint32_t *)MemoryAddr;
//! \First address is the stack pointer initial value
__set_MSP(*pMem); // Set stack pointer
//! \Now get main app entry point address
pMem++;
void (*pMainApp)(void) = (void (*)(void))(*pMem);
//! \Jump to main application (0x0800 0004)
pMainApp();

}

 

/******************* Vector remapping To RAM  *******************/
void Remap_Table(void)
{
uint32_t ui32_VectorIndex = 0;
volatile uint32_t *VectorTable = (volatile uint32_t *)0x20000000;

/*Copy interrupt vector table to the RAM.*/
for(ui32_VectorIndex = 0; ui32_VectorIndex < 48; ui32_VectorIndex++)
VectorTable[ui32_VectorIndex] = *(__IO uint32_t*)((uint32_t)0x08001000 + (ui32_VectorIndex << 2));

/* Enable the SYSCFG peripheral clock*/
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); // Not Reset, Clock

/* Remap SRAM at 0x00000000 */
SYSCFG_MemoryRemapConfig(SYSCFG_MemoryRemap_SRAM);
}

"Calling of Reset handler in Bootloader when it was called from Main application" is this beaviour okey or it should be called reset handler of Main application itself.

Outcomes