Skip to main content
Associate
December 13, 2023
Question

Jumping from to internal bootloader with Option Byte set to Read out protection (RDP Level  1) .

  • December 13, 2023
  • 4 replies
  • 2743 views

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).

  1. When I am jumping to internal bootloader by Disabling the Read out protection I am able to Jump to SRAM and able to bootloader over UART and I can read the Device memory.

Abhishek4_0-1702441068942.png

 

 

  1. When I am jumping to internal bootloader Enabling Read out protection then I am not able to Jump to SRAM and not able to bootloader over UART and it is asking for Disable the RDP and try again.

Abhishek4_1-1702441068953.png

 

 

  1. After that again I am jumping to internal bootloader and Disabling the Read out protection by software (mention below) after that also I am not able to Jump to SRAM and not able to bootloader over UART and I cannot read the Device memory.

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();

                }

Abhishek4_2-1702441068962.png

 

 

 

 

 

This topic has been closed for replies.

4 replies

ST Technical Moderator
December 13, 2023

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

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
Abhishek4Author
Associate
December 15, 2023

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 

Piranha
Principal III
December 14, 2023

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?

Billy OWEN
ST Employee
January 3, 2024

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