2021-04-26 08:13 AM
I would like to protect my firmware and my microcontroller in the case of a user want to extract the hex file or if the user want to overwire my firmware. For the first case, I saw I must play with 2 registers before to compile and program my code. How can I play on it? With a bootloader? At the start of my code? I need to write this code in a specific area in the memory?
For test it, I'm using a STM8AF5288 MCU.
Thanks for your help
2021-04-28 12:02 AM
I do not have that mcu or its datasheet at hand but have a look in the datasheet, search for Read Out Protection. You can set it with the ST_Visual_Programmer (or during programming the code).
2021-04-28 12:51 AM
Hello WilkoL ! Thanks for your answer. But If I can do this with ST Visual Programmer, someone who have my product can do the same no? and turn off this byte?
2021-04-28 12:55 AM
Yes, and end up with a nice clean (empty) mcu.
From the Datasheet for a STM8S105:
Read-out protection (ROP)
The read-out protection blocks reading and writing the Flash program memory and data EEPROM memory in ICP mode (and debug mode). Once the read-out protection is activated, any attempt to toggle its status triggers a global erase of the program and data memory. Even if no protection can be considered as totally unbreakable, the feature provides a very high level of protection for a general purpose microcontroller.
2021-04-28 01:08 AM
Thanks you so much I didn't understand that! If ROP is activated and erase the program and data of my memory is the solution of the half of my problem :thumbs_up:
2021-04-28 01:14 AM
The other part of my probleme is : I would like to keep my code in if someone try to overwrite it, it is possible with only use this uc or I must put an external EEPROM for check a data to see if I have the permission to overwrite or to update the code?
2021-04-28 01:20 AM
I think that you cannot prevent someone from erasing the mcu when they have access to the mcu (and STVP).
But have good look at the Datasheet (and Reference Manual), you can set Write Protection to certain parts of the memory. Maybe that's good enough for you.
2021-04-28 01:31 AM
Ok thanks for your help I will analyse the datasheet to find the good and useful information