7285 views|4 replies

11

Posts

6

Resources
The OP
 

Use STVP to encrypt and remove write protection for STM8 [Copy link]

1. Download and install ST-LINK driver and STVP software - STVP and STVD are both in sttoolset: http://www.st.com/st-web-ui/static/active/en/st_prod_software_internet/resource/technical/software/sw_development_suite/sttoolset.zip - ST-LINK driver seems to be in sttoolset as well. 2. Power on the board and connect the ST-LINK. 3. Open STVP: Run "Start" -> ST Toolset -> Development Tools -> ST Visual Programmer 4. Connect and configure: Run Configure -> Configure ST Visual Programmer Select ST-LINK, USB, SWIM, STM8S003F3 5. Select the program: Run File->Open and select the .hex or .srec file to download. 6. Download the program: Run Program -> All tabs and execute the download. Hardware: Burning tool. Port: USB. Programming mode: SWIM. Device: Select the model to be burned. Open the target file to be burned "File -> Open...". DATA MEMORY: EEPROM data area. The interface for configuring OPTION BYTE options is shown in Figure 2-67. Figure 2-67 Configuring OPTION BYTE Value: You can directly enter the configured OPTION BYTE value in this box, and the OPTION BYTE content will be automatically configured according to the value of Value. Take STM8S105S4 as an example to illustrate the configuration of OPTION BYTE. As shown in Figure 2-68. Figure 2-68 OPTION BYTE configuration example ROP: Readout protection setting. If set to ON, the program cannot be read out. UBC [7:0]: User startup code area. Generally, when users do IAP, they need to protect the code part. AFR[7:0]: Alternative function remapping option. Use this to set the required function. For example, the same pin can have different functions. You can use this option to set the required function. HSITRIM: High speed internal clock adjustment register size. LSI_EN: Low speed internal clock enable. IWDG_HW: Independent watchdog. WWDG_HW: Window watchdog activation. WWDG_HALT: Reset action of window watchdog when the chip enters shutdown mode. EXT_CLK: External clock selection. CKAWUSEL: Automatic wake-up unit/clock. PRSC[1:0]: AWU clock pre-division. HSECNT[7:0]: HSE crystal oscillator stabilization time. BOOTLOADER ENABLE: If the user uses UART to download the program, this option bit can be set. For more information, please refer to the data sheet of STM8S105S4. Select "Program>All tabs (on action sectors if any)". This option can burn "PROGRAMM MEMORY, DATA MEMORY and OPTION BYTE" into STM8 together. As shown in Figure 2-69. There are three programming areas: Program area Data area Option area. Click on any of the three. A bold font will appear to indicate that it is activated. Program area: FLASH area for writing programs Data area: EEPROM area for saving data Option area: Encryption and other functions Encryption settings Step 1: Click to enter the option area and set the ROP item to Read Out Pretection ON Step 2: Execute the red middle item in the current window to write the encryption bit. In this way, the chip is encrypted and the contents can no longer be read. Unencrypt the chip If the chip is already encrypted and you want to rewrite the program, you must first erase the confidentiality bit Step 1: Click to activate the option area and set ROP to Read Out Pretection OFF Step 2: Execute the red middle item in all windows to erase the chip encryption bit. You can rewrite the program, but all the contents will be cleared
This post is from stm32/stm8

Latest reply

Didn't see the picture.   Details Published on 2019-12-23 14:51
 

11

Posts

6

Resources
2
 
Reply yourself
This post is from stm32/stm8
 
 

172

Posts

0

Resources
3
 
Thanks for sharing!
This post is from stm32/stm8
 
 

32

Posts

0

Resources
4
 

Using id for software encryption

1. If there is an external memory on the board, you can first write a program, use the algorithm to calculate the ID to get some values and store them in the external memory, and then burn the real program. The real program can verify whether the data in the external memory is legal.

2. Use the key combination on the board, or press certain keys when powered on. The program uses the algorithm to calculate the ID and store some values in the program area. When the program is running, verify whether the data in the program area is correct.

3. Xuanwei programmer has the function of software encryption. The programmer will read the chip ID and directly rewrite the buffer according to the algorithm to achieve the function of software encryption.

4. The read ID is passed through a certain algorithm, such as XOR plus a number, and the obtained data is stored in the flash (only run once, and the flag bit is also stored in the flash after running). The next time this flag bit is read, the program will not be run. //QQ9272078

4. Pay attention when encrypting software

1. Do not directly use the ID address in the program, for example, 1FFFF7E8 1FFFF7EC 1FFFF7F0 for stm32

stm8:0x4865~0x4870

2. Use checksum or CRC to check the program area to prevent program modification

This post is from stm32/stm8
 
 
 

10

Posts

0

Resources
5
 

Didn't see the picture.

This post is from stm32/stm8
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list