2023-12-12 08:22 PM
Board :- Custom board with STM32F105RCT6
Description :- I am trying to Jump to internal bootloader when Option Byte for Read Out Protection is set to 1 (RDP Level 1).
void __attribute__((section(".RamFunc"))) JumpToBootloader(void) {
FLASH_OBProgramInitTypeDef OptionsBytesStruct;
while(HAL_FLASH_Unlock() != HAL_OK);
while(HAL_FLASH_OB_Unlock() != HAL_OK);
HAL_RCC_DeInit();
__disable_irq();
OptionsBytesStruct.OptionType = OPTIONBYTE_RDP ;
OptionsBytesStruct.RDPLevel = OB_RDP_LEVEL_0;
while(HAL_FLASHEx_OBProgram(&OptionsBytesStruct) != HAL_OK);
void (*SysMemBootJump)(void);
volatile uint32_t addr = 0x1FFFB000;
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));
__set_MSP(*(uint32_t *)addr);
SysMemBootJump();
}
2023-12-12 10:08 PM
Hello @Abhishek4 and welcome to the Community :)
Please have a look at this FAQ: How to change the Read Out Protection on STM32F1 - STMicroelectronics Community., this will help you on how to properly configure the option bytes for the STM32F1 series and change the Read-Out Protection feature.
Hope this helps you!
Imen
2023-12-13 04:50 PM
Enabling a "ReaD out Protection" doesn't allow reading the flash... what a surprise! Then setting the RDP=0 and therefore doing a mass erase doesn't allow the (erased) firmware to run... again what a surprise! Maybe read the reference manual first?
2023-12-14 10:51 PM
Thank you for the reply......
I already followed the same link what you have mention....but not getting expected output for this....So please help me out with this.... Thank you
2024-01-03 08:19 AM
Hi @Abhishek4
The forum moderator had marked your post as needing a little more investigation and direct support. An online support case has been created on your behalf, please stand by for just a moment and you will hear from us.
Regards,
Billy