February 2017 DocID030088 Rev 1 1/46
1
AN4968
Application note
Proprietary code read out protection (PCROP)
on STM32F72xxx and STM32F73xxx microcontrollers
Introduction
The software providers are developing complex middleware solutions (Intellectual Propriety
code, or IP-code). Protecting them is an issue of high importance for the microcontrollers.
In order to respond to this important requirement, the STM32F72xxx and STM32F73xxx
microcontrollers feature:
The Read Protection (RDP): the protection against read operations
The Write Protection: the protection against undesired write or erase operations
The Proprietary Code Read Out Protection (PCROP): the protection against read and
write operations.
This application note provides a description of these Flash memory protection techniques,
focusing on the Proprietary Code Read Out Protection (PCROP) on STM32F72xxx and
STM32F73xxx microcontrollers and providing a basic example of the PCROP protection.
The X-CUBE-PCROP embedded software package is delivered with this document
containing the source code of the PCROP example with all the embedded software modules
required to run the example.
This application note has to be read in conjunction with STM32F72xxx and STM32F73xxx
advanced ARM
®
-based 32-bit MCUs reference manual (RM0431) and the corresponding
datasheets available on www.st.com.
www.st.com
Contents AN4968
2/46 DocID030088 Rev 1
Contents
1 Memory protection description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1 Read out protection (RDP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.1 Read protection level 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.2 Read protection level 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.3 Read protection level 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.4 Internal Flash memory content updated on STM32F72xxx and
STM32F73xxx RDP protected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2 Write protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.3 Proprietary Code Read Out Protection (PCROP) . . . . . . . . . . . . . . . . . . . 8
1.3.1 PCROP protection overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.3.2 How to enable the PCROP protection . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3.3 How to disable the PCROP protection . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3.4 Placing and executing PCROP-ed IP-code . . . . . . . . . . . . . . . . . . . . . . 11
2 PCROP example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1 Example requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1.1 Hardware requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1.2 Software requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2 Example overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2.1 Scenario overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2.2 PCROP-ed IP-code: FIR lowpass filter . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.2.3 Software settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.3 STEP1: ST Customer level n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.3.1 Project flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.3.2 Generating an execute-only IP-code . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.3.3 Placing IP-code and data segments in Flash and RAM memories . . . . 23
2.3.4 Write protection of constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.3.5 Protecting the IP-code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.3.6 Executing PCROP-ed IP-code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.3.7 Creating header file and generating symbol definition file . . . . . . . . . . . 32
2.4 STEP2: ST Customer level n+1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.4.1 Project flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.4.2 Creating an end user project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.4.3 Including header file and adding symbol definition file . . . . . . . . . . . . . 37