cancel
Showing results for 
Search instead for 
Did you mean: 

How can I protect my microgontroller against hacking or overwrite

CMahe.1
Associate II

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

7 REPLIES 7
WilkoL
Senior

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).0693W00000AMiyxQAD.jpg

CMahe.1
Associate II

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?

WilkoL
Senior

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.

CMahe.1
Associate II

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:

CMahe.1
Associate II

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?

WilkoL
Senior

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.

CMahe.1
Associate II

Ok thanks for your help I will analyse the datasheet to find the good and useful information