AnsweredAssumed Answered

Jump to bootloader and Read out protection conflict

Question asked by baranov.yury on Jun 23, 2017
Latest reply on Jun 23, 2017 by Uwe Bonnes

Hi everyone!

I'm using STM32F105 MCU , and I'd like to explore built-in DFU feature

When I set BOOT0/BOOT1 pins per datasheet and reboot the MCU, the feature always works ok no matter how read out protection is set in option bits

However, jump from application works only if read out protection is off

 

The jump code disables all IRQ sources used in my application, clears pending interrupts, sets stack top and jumps to system memory per AN2606

#define _DFU_START (0x1FFFB000)
static void (*_p_ldr)(void);

NVIC_DisableIRQ(TIM2_IRQn);
NVIC_DisableIRQ(TIM3_IRQn);
NVIC_DisableIRQ(TIM4_IRQn);
NVIC_DisableIRQ(DMA1_Channel1_IRQn);

NVIC_ClearPendingIRQ(TIM2_IRQn);
NVIC_ClearPendingIRQ(TIM3_IRQn);
NVIC_ClearPendingIRQ(TIM4_IRQn);
NVIC_ClearPendingIRQ(DMA1_Channel1_IRQn);

HAL_RCC_DeInit();
HAL_DeInit();
_p_ldr = ( void(*)(void)) (*((uint32_t *)(_DFU_START+4)));
__set_MSP(*(__IO uint32_t*) _DFU_START);
_p_ldr();

What may cause the problem?

Outcomes