cancel
Showing results for 
Search instead for 
Did you mean: 

CrossStudio + Read Protection

budde2
Associate II
Posted on May 04, 2009 at 09:01

CrossStudio + Read Protection

1 REPLY 1
budde2
Associate II
Posted on May 17, 2011 at 13:11

I am just testing the ''Read Protection'' feature of the STM32. I am using Rowley's CrossStudio 1.7 IDE.

To enable the ''Read Protection'' I am using the following code:

if (FLASH_GetReadOutProtectionStatus() == RESET)

{

FLASH_ClearFlag (FLASH_FLAG_BSY | FLASH_FLAG_EOP |

FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);

FLASH_EnableWriteProtection (FLASH_WRProt_Pages2to3 |

FLASH_WRProt_Pages4to5 |

FLASH_WRProt_Pages6to7 |

FLASH_WRProt_Pages8to9);

FLASH_ClearFlag (FLASH_FLAG_BSY | FLASH_FLAG_EOP |

FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);

FLASH_ReadOutProtection (ENABLE);

NVIC_GenerateSystemReset();

}

This seems to work (tested with the Flash Loader Demo).

But after enable the ''Read Protection'' the start up code of CrossStudio seems to be no longer working. I am getting a ''Hard Fault Exception'' in ''thumb_crt0.s''. I think it happens, when the default values of the variables are copied from the Flash to the SRAM.

Any ideas?