2021-03-28 03:53 AM
Hi,
for a product I want to activate read-out-protection (ROP) via option byte, to prevent misuse via the SWIM interface. However, is it possible to disable it again from the application (given a "secret" condition)?
Page 50 in RM0016 indicates that ALL option bytes are read-only when ROP is active... :(
But there is a note in the revision history on page 459: "Moved all information related to temporary memory unprotection to dedicated application note". Unfortunately I cannot find this application note. Does anyone have information what this is and if it solves my problem?
Any other idea? For your support thanks a lot in advance!
2021-03-29 09:35 AM
The idea is that the ROP option can only be reset by erasing the Flash.
In reality, there are ways to hack around it: https://itooktheredpill.irgendwo.org/2020/stm8-readout-protection/, similar to the STM32.
However, the application note page 459 is referring to is most likely about a different kind of protection: Protecting Flash and EEPROM from being overwritten accidentially by bugs in a program: See section 3 ("Memory protection strategy") of PM0051.
2021-04-08 02:54 AM
Interesting! But unfortunately that doesn't solve my problem.
I am looking for a way to temporarily unprotect the ROP without external hardware (other than debugger). Basically something like the TMU feature, which allows access via SWIM if TMU is enabled via option byte and a key on the PC matches that on the STM8. But unfortunately that is only supported by a few devices, e.g. STM8AF62AA.
The background is simply that I want to enable the ROM bootloader with ROP enabled. According to page 50 in RM0016 this is not possible, as all OPT are then write protected. The alternative would be a custom bootloader, which I would like to avoid...
2021-04-19 10:16 PM
you can used this C code for enable read out protection .
FLASH_DUKR = 0xAE;
FLASH_DUKR = 0x56;
FLASH_CR2 |= 0x80;
FLASH_NCR2 &= 0x7F;
*((unsigned char*)0x4800) = 0xAA; /// write AA for this location
FLASH_CR2 &= 0x7F;
FLASH_NCR2 |= 0x80;
FLASH_IAPSR &= 0xF7;
and disable the ROP through STVD. or STVP during programming by the option byte.
2021-05-13 10:30 PM
hi,
thanks for your reply! I will look into this and check whether this solves my problem :)
Georg