Skip to main content
shikha
Associate
December 12, 2019
Question

I have enabled level 1 rop in stm32f030c8, now my code is not working in device and m not able to load fresh code or debuge it using attolics true studio.

  • December 12, 2019
  • 1 reply
  • 1112 views

here's my code for RDPprotection:

void Flash_SetRDPLevel(uint8_t ReadProtectLevel) //level 1 (0xBB)

{

 uint32_t tmp_reg;

 Unlock();

 OB_unlock();

  /* Read RDP level bits */

  tmp_reg = (FLASH->OBR & (FLASH_OBR_RDPRT1 | FLASH_OBR_RDPRT2));

  //if (tmp_reg == 0U)

  {

  /* proceed to erase the option bytes */

  FLASH->CR |= FLASH_CR_OPTER;

  FLASH->CR |= FLASH_CR_STRT;

  /* If the erase operation is completed, disable the OPTER Bit */

  FLASH->CR &= ~FLASH_CR_OPTER;

  /* Enable the Option Bytes Programming operation */

  FLASH->CR |= FLASH_CR_OPTPG;

   OB->RDP = ReadProtectLevel;

  /* if the program operation is completed, disable the OPTPG Bit */

   FLASH->CR &= ~FLASH_CR_OPTPG;

  }

  Flash_OB_launch();

  OB_lock();

  Lock();

}

at the moment  Flash_OB_launch() is called debugger stops,nothing to do further.

void Flash_OB_launch(void)

{

 /* Set the OBL_Launch bit to launch the option byte loading */

  SET_BIT(FLASH->CR, FLASH_CR_OBL_LAUNCH);

}.

in main i called  Flash_SetRDPLeve() before any other peripheral initialization.

please help asap. thanks in advance.

This topic has been closed for replies.

1 reply

Ozone
Principal
December 12, 2019

Most RDP levels can be undone by booting into system mode (BOOT0/BOOT1 pins), and doing a Flash mass erase.

Cube should come with a tool that supports the system bootloader protocol, and do exactly that.

I'm no Cube user, so check the documentation, or wait for people more proficient in Cubism...

shikha
shikhaAuthor
Associate
December 12, 2019

hey I solved that issue.

thanks for reply:)

TAshe
Visitor II
April 1, 2020

Hi, can you post the solution?