2013-11-12 08:36 AM
2013-11-12 09:39 AM
The debugger will be useless, purposefully so. You can run stuff from RAM if that helps. You can mass erase the part, either from your own app, or via the System Loader and USART. (Speaking from an F1/F2/F4 perspective, I'm not using the F0).
Your own code should be able read, and output FLASH content if you choose. ie if you coded your own monitor/diagnostic app. ROP is designed to limit exfiltration via SWD/JTAG or Serial/System Loader. You shouldn't even need external tools, put code paths in your own application to test the ROP state, and if not set, set it and reset. ie First boot after programming it locks down the device. If you're using the System Loader to program you could use that too.2013-11-13 02:06 AM
Hi Clive,
Thanks for that. There is a utility s/w that we can use to program the option bytes (works through jtag and fine for development purposes), but for bulk programming this is no use. We need to set these option bytes in s/w, so when board boots, these are already set. Is there some source example available that I can add to the project? I had a quick read of the docs, but we are under severe pressure to meet our production slot so any examples would be great. Many Thanks Bob2013-11-13 05:21 PM
STM32F0xx_StdPeriph_Lib_V1.1.0\Project\STM32F0xx_StdPeriph_Examples\FLASH\Write_Protection\main.c
STM32F0xx_AN4065_FW_V1.0.0\Project\STM32F0xx_IAP\src\flash_if.c This is a blind stab at what the F0 would need, perhaps you can donate some gearvoid SetRDP(void)
{
FLASH_Status FLASHStatus = FLASH_COMPLETE;
/* Unlock the Flash Program Erase controller */
FLASH_Unlock();
FLASH_OB_Unlock();
/* Clear all FLASH flags */
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR | FLASH_FLAG_BSY);
if (!FLASH_OB_GetRDP())
{
FLASH_Status = FLASH_OB_RDPConfig(OB_RDP_Level_1); // Locks Chip (Lvl 2 Toasts)
if (FLASH_Status == FLASH_COMPLETE)
{
/* Generate System Reset to load the new option byte values */
FLASH_OB_Launch();
}
} // sourcer32@gmail.com
}
2013-11-14 01:38 AM
2013-11-17 04:19 PM
Hi Clive,
It had to happen!! Your code worked...very well indeed !! Yep everyone, Clive does know his stuff. Now I cannot reprogram the board. Is there anyway of getting back to being able to program the unit again? I'm using ULink2 and uVision4? Bob2013-11-17 05:14 PM
There are two techniques I've used, one is via the System Loader (USART1) and issuing the commands to Mass Erase, or change the RDP/ROP, the other is to implement similar to nuke the part via a specific internal command sequence.
2013-11-18 06:45 AM
If you accidently set the read protection level to 2 then you can't recover. JTAG and bootloader are disabled. If you can't get the JTAG to connect that's the problem.
Jack Peacock