Read Protection with bootloader error - Can anyone help?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2009-07-25 11:23 AM
Posted on July 25, 2009 at 20:23
Read Protection with bootloader error - Can anyone help?
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 4:18 AM
Posted on May 17, 2011 at 13:18
Hi,
I have a propriatory bootloader which switches between application and bootloader via setting a couple of variables in the backup register ram which does not get erased on a reset. The problem in question is that when i use the read protection below when the bootloader has loaded a application into the flash starting at 0x8008000 the chip erases the flash (so both bootloader and application) on reset. When in debug, I can read protect and unprotect the bootloader as expected - the erase only happens when the application is loaded. I have tried doing the read protect at different points (before loading the application, after loading the application and in the application) all to the same conclusion - the flash gets fully erased. This is my read protect/unprotect code: void Debug_Read_Protection(FunctionalState u8Enable) { u32 u32iDelay; CommsDebug_TxString(''\n\rP1''); FLASH_Unlock(); if((FLASH->CR & CR_LOCK_Set) == 0) {CommsDebug_TxString(''\n\rUnlocked'');} else{CommsDebug_TxString(''\n\rLocked'');} FLASH_ReadOutProtection(u8Enable); FLASH_Lock(); // insert a delay here // u32iDelay = (u32)70000000; Debug_Print_FlashRegisters(); do {u32iDelay--;} while(u32iDelay!=0); NVIC_GenerateSystemReset(); }// Debug_Read_Protection() // void Debug_Print_FlashRegisters(void) { CommsDebug_TxString(''\n\rOBR = ''); CommsDebug_TxU32(FLASH->OBR); CommsDebug_TxString(''\n\rCR = ''); CommsDebug_TxU32(FLASH->CR); }// Debug_Print_FlashRegisters() // Can anyone help??Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 4:18 AM
Posted on May 17, 2011 at 13:18
Hi Simon,
You can refer to for more details regarding Protections, Go the Section 2.4, then subsections 2.4.1 Read protection and 2.4.2 Write protection. You should not remove the Read-out protection when you have your own boot-loader else it will be erased too. Cheers, STOne-32.