3. System security
The STM32H503xx is designed with a comprehensive set of security features.
These security features simplify the process of evaluating IoT devices against security standards. They also significantly reduce the cost and complexity of software development for OEM and third-party developers, by facilitating the reuse, improving the interoperability, and minimizing the API fragmentation.
This section explains the different security features available on the STM32H503xx devices.
3.1 Key security features
- • Resource isolation using privilege mode of Cortex-M33, extended to privileged, memories, and peripherals
- • Secure debug control (regression control). The secure debug control can be personalized in OTP by OEMs thanks to provisioning tools
- • Temporal isolation: boot levels are isolated thanks to the HDPL (hide protect level) monotonic counter
- • Battery-powered volatile secure storage, automatically erased in case of tamper
- • Device 96-bit unique ID
- • HASH processor, supporting SHA-1 checksums and SHA-2 secure hash (SHA2-224, SHA2-256)
- • True random number generator (RNG), NIST SP800-90B precertified
- • New flexible lifecycle scheme that enables in-the-field product maintenance
- • Active tamper and protection against temperature, voltage, and frequency attacks
- – Active tamper available in different power modes (refer to TAMP low-power modes)
3.2 Resource isolation
3.2.1 Temporal isolation using secure hide protection (HDP)
The embedded flash memory allows an HDP area per watermarked-secure area of each bank (8-Kbyte sector granularity) to be defined. The code executed in this HDP area, with its related data and keys, can be hidden after boot until the next system reset. The hide protection principle is pictured on the figure below.
Figure 3. Flash memory secure HDP area

MSv68897V1
Activation of HDP area in user flash memory is related to HDPL1. It means that as soon as HDPL becomes equal or greater to 2, then data read, write, and instruction fetch (on the area defined by HDPx_PSTRT and HDPx_PEND in FLASH_HDPxR_PRG option bytes), are denied until the next device reset.
The END of the HDPx areas can be extended (dynamically by the application) thanks to FLASH_HDPEXTR flash memory register. This extension prevents access to protected sectors under HDPL3.
Note: Bank erase aborts when it contains a write-protected area (WRP or HDP area).
In the STM32H503xx devices, the hardware and software resources used to boot can be isolated. This is called temporal isolation.
It is based on a monotonic counter taking care of only incrementing the levels. When the counter is incremented, the resources of the previous levels become hidden (code and data) For more information, see Section 7: Embedded flash memory (FLASH).
3.2.2 Resource isolation using Cortex privileged mode
The hardware and software resources of STM32H503xx devices can be partitioned so that they are restricted to software running in Cortex privileged mode.
Thanks to this hardware isolation technology, critical code or data can be protected against intentional or unintentional tampering from the more exposed unprivileged code.
Memory and peripheral privileged allocation using MPU
The Cortex-M33 MPU divides the unified memory into eight regions, each aligned to a multiple of 32 bytes. Each memory region can be programmed to generate faults when accessed inappropriately by unprivileged software.
3.2.3 Resource isolation using GTZC privilege control
In the STM32H503 devices, the hardware and software resources can be partitioned so that they exist either in the privileged world or in the unprivileged world. Refer to Section 6: Global privilege controller (GTZC).
Memory and peripheral privileged allocation using GTZC
For the Cortex-M33 master, to complement the coarse isolation provided by the MPU, the GTZC reinforces, in a flexible way, the isolation between privileged and unprivileged tasks, for peripherals and selected memories.
For masters other than the Cortex-M33, the GTZC can assign them as unprivileged initiators, automatically protecting resources defined as privileged against this master.
- • Privileging peripherals with TZSC (privileged-only)
In the devices, a peripheral is either privileged-only through GTZC, or is natively privileged-aware:
- – A privileged-only peripheral or memory is protected by an AHB/APB firewall gate that is controlled by the TZSC.
- – A privileged-aware peripheral or memory is connected directly to AHB or APB interconnect, implementing a specific behavior such as a subset of registers or a memory area is privilege-only.
When such peripheral is made privileged-only with GTZC, if it is master on the interconnect (GPDMA), it automatically issues privileged transactions. Privilege-aware masters like GPDMA1 and GPDMA2, drive the privileged signal in the AHB interconnect according to their internal privileged mode, independently to the GTZC.
The list of privilege-aware and privilege-only peripherals can be found in Section 6: Global privilege controller (GTZC).
- • Privileging memories with TZSC and MPCBB (privileged-only)
The TZSC logic in GTZC provides the capability to manage the privilege level for BKPSRAM, programming the MPCWM resources defined in Section 3.2.2.
Similarly, the TZSC logic in GTZC provides the capability to configure the privilege level of embedded SRAM blocks, programming the MPCBB resources defined in Section 3.2.2.
- • Error management (privileged-only)
- – Any unprivileged transaction trying to access a privileged resource is considered as illegal. There is no illegal access event generated for illegal unprivileged read and write accesses.
- – The addressed resource follows a silent-fail behavior, returning all zero data for read and ignoring any write.
- – When an illegal unprivileged access occurs, no bus error is generated, except when this access is an instruction fetch, accessing a privileged memory or a peripheral register.
Managing privilege in privileged-aware peripherals
Privileged-aware peripherals also implement privileged-only access mode:
- • Embedded flash memory
By default all embedded flash memory registers can be read or programmed in both privileged and unprivileged modes.
When a privileged bit NSPRIV is set in FLASH_PRIVCFGR, reading and writing the flash memory registers are possible only in privileged mode.
Regarding privileged protection of the embedded flash memory, the devices offer the following features:
- – The system flash memory can be accessed both in privileged and unprivileged modes.
- – Each HDP area, is accessible in the privileged and unprivileged mode, if applicable.
- – Each 8-Kbyte sector of the embedded flash memory can be programmed on-the-fly as privileged only, using the block-based privileged configuration registers FLASH_PRIVBB1R1 and FLASH_PRIVBB2R1. An unprivileged sector is accessible by a privileged or unprivileged access.
Note: Switching a sector from privileged to unprivileged does not erase the content of the sector. When applicable, an erase or program operation is always available to privileged code, and is available to unprivileged code only for unprivileged sectors or unprivileged memory.
- • Direct memory access controllers (GPDMAx)
When a DMA channel x is defined as privileged (PRIVx = 1 in GPDMA_PRIVCFGR), special rules apply when accessing the privileged/unprivileged source or destination. Those rules are summarized on the table below.
Table 2. DMA channel use (privilege)
| Destination | Privileged DMA channel x (PRIVx = 1) | Unprivileged DMA channel y (PRIVy = 0) | ||
|---|---|---|---|---|
| Privileged source | Unprivileged source | Privileged source | Unprivileged source | |
| Privileged | OK | Transfer blocked(1) | ||
| Unprivileged | Transfer blocked | OK | ||
1. When a transfer is blocked, the transfer completes but the corresponding writes are ignored, and reads return zeros.
- • Power control (PWR)
By default, after a power-on or a system reset, all PWR registers but PWR_PRIVCFGR, can be read or written in both privileged and unprivileged modes. When the privileged bit NSPRIV is set in PWR_PRIVCFGR, reading and writing the PWR registers are possible only in privileged mode.
See Section 9: Power control (PWR) for details.
- • Reset and control block (RCC)
By default, after a power-on or a system reset, all RCC registers but RCC_PRIVCFGR can be read or written in both privileged and unprivileged modes.
When the privileged bit NSPRIV is set in RCC_PRIVCFGR, reading and writing the RCC bits are possible only in privileged mode.
See Section 10: Reset and clock control (RCC) for details.
- • Real time clock (RTC)
By default after any backup domain reset, all RTC registers but RTC_PRIVCFGR, can be read or written in both privileged and unprivileged modes.
When PRIV bit is set in privileged-only RTC_PRIVCFGR:
- – Writing the RTC registers is possible only in privileged mode.
- – Reading the RTC_PRIVCFGR, RTC_TR, RTC_DR, RTC_SSR, RTC_PRER and RTC_CALR is always possible in privileged and unprivileged modes.
All the other RTC registers can be read only in privileged mode.
When PRIV bit is cleared in privileged-only RTC_PRIVCFGR register, it is still possible to restrict access to privileged mode to some RTC registers by setting dedicated control bits: INITPRIV, CALPRIV, TSPRIV, WUTPRIV, ALRAPRV or ALRBPRIV.
See Section 32: Real-time clock (RTC) chapter for details.
- • Tamper and backup registers (TAMP)
By default after any backup domain reset, all TAMP registers but TAMP_PRIVCFGR can be read or written in both privileged and unprivileged modes.
When PRIV bit is set in privileged-only TAMP_PRIVCFGR:
- – Writing the TAMP registers is possible only in privileged mode, except for the backup registers and the monotonic counters that have their own protection setting.
- – Reading the TAMP_CFGR or TAMP_PRIVCFGR is always possible in privilege and unprivilege modes. All the other TAMP registers can be read only in privilege mode, except for the backup registers and the monotonic counters that have their own protection setting.
The application can also:
- – make TAMP_COUNT1R register read and write privileged-only by setting the CNTPRIV bit in TAMP_PRIVCFGR
- – increase security for two of the three protection zones in backup registers, using BKPRWPRIV and BKPWPRIV bits in TAMP_PRIVCFGR:
- – make protection zone 1 read privileged, write privileged.
- – make protection zone 2 read privileged or unprivileged, write privileged.
- – protection zone 3 is always read and write privileged or unprivileged.
- • General-purpose I/Os (GPIO)
All GPIO registers can be read and written by privileged and unprivileged accesses. - • Extended interrupts and event controller (EXTI)
The EXTI peripheral is able to protect event register bits from being modified by unprivileged accesses. The protection is individually activated per input event via the register bits in the privileged-only EXTI_PRIVCFGRx registers. When an input event is configured as privileged, only a privileged application can change the configuration, change the masking or clear the status of this input event.
See Section 17: Extended interrupts and event controller (EXTI) for more details. - • System configuration boot and security (SBS)
All SBS registers can be read and written in both privileged and unprivileged modes, except:- – SBS registers for CPU configuration: SBS_FPUIMR, SBS_CNSLCKR, and SBS_ECCNMIR
3.3 Secure execution
Through a mix of special software and hardware features, the devices ensure the correct operation of their functions against abnormal situations caused by programmer errors, software attacks through network access or local attempt for tampering code execution.
This section describes the hardware features specifically designed for secure execution.
3.3.1 Memory protection unit (MPU)
The Cortex-M33 includes a memory protection unit (MPU) that can restrict the read and write accesses to memory regions (including regions mapped to peripherals), based on one or more of the following parameters:
- • Cortex-M33 operating mode (privileged, unprivileged)
- • data/instruction fetch
The memory map and the programming of the MPU split memory into up to eight regions.
3.3.2 Embedded flash memory write protection
The write protection (WRP) prevents illegal or unwanted write/erase to selected sectors of the embedded flash-memory user area (system area is permanently write protected).
Write-protected sectors can be modified through option byte changes only when PRODUCT_STATE = open.
Note: Bank erase aborts when it contains a write-protected area (WRP or HDP area) For more information, see Section 7.5.6: Write protection.
3.3.3 Tamper detection and response
Principle
The devices include active protection of critical security assets against temperature, voltage and frequency attacks, with the following features:
- • erasure of device secrets upon tamper detection
- • improved guarantee of safe execution for the CPU and its associated security peripherals, including:
- – out-of-range voltage (example: \(V_{BAT}\), \(V_{DDA}\)), temperature and clocking (LSE) detection
- – security watchdog IWDG clocked by the internal oscillator LSI
- – possible selection of internal oscillator HSI as system clock
- • power supply protection
- – RTC/TAMP domain powered automatically with \(V_{DD}\) or \(V_{BAT}\)
See Section 33: Tamper and backup registers (TAMP) for more details.
Tamper detection sources
The devices support two active input/output pins, which allow one independent active-tamper mesh.
The active pins are clocked by the LSE, and are functional in different system operating modes (run, sleep, stop, or standby), and in VBAT mode. Refer to TAMP pins functionality over modes for list of tamper pins and their availability across power modes.
Detection time is programmable, and a digital filtering is available (tamper triggered after two false comparisons in four consecutive comparison samples).
Note: Timestamps are automatically generated when a tamper event occurs.
The internal tamper sources are listed in the table below.
Table 3. Internal tampers in TAMP
| Tamper input | NOER bit number in TAMP_CR3 | Tamper source |
|---|---|---|
| itamp1 | 0 | Backup domain voltage continuous monitoring, functional in VBAT mode |
| itamp2 | 1 | Temperature monitoring, functional in VBAT mode |
| itamp3 | 2 | LSE monitoring(1), functional in VBAT mode |
| itamp4 | 3 | HSE monitoring |
| itamp5 | 4 | RTC calendar overflow (rtc_calovf) |
| itamp6 | 5 | JTAG/SWD access |
| itamp7, 12, 13 | 6, 11, 12 | Voltage monitoring (\(V_{CORE}\)), through ADC analog watchdog |
| itamp8 | 7 | Monotonic counter overflow (generated internally) |
Table 3. Internal tampers in TAMP (continued)
| Tamper input | NOER bit number in TAMP_CR3 | Tamper source |
|---|---|---|
| itamp9 | 8 | Fault generation for RNG peripheral |
| itamp11 | 10 | IWDG timeout and potential tamper (IWDG reset when at least one enabled tamper flag is set) |
| itamp15 | 14 | System fault detection |
1. LSE missing or over frequency detection (> 2 MHz), glitch filter (> 2 MHz).
Response to tampers
Each source of tamper in the device can be configured to trigger the following events:
- • Generate an interrupt, capable of waking up the device from Stop mode and Standby modes (see TAMPxMSK bits in TAMP_CR2 register).
- • Generate a hardware trigger for the low-power timers.
- • Erase device secrets if the corresponding TAMPxNOER bit is cleared in TAMP_CR2 (for tamper pins) or TAMP_CR3 (for internal tamper). These erasable secrets are:
- – symmetric keys stored in backup registers (x32), and in HASH
- – other secrets stored in SRAM2 and CPU instruction cache memory (SRAM2 erased when \(V_{DD}\) is present)
- – 2-Kbyte backup SRAM (depending on configuration bit), erased when \(V_{DD}\) is present
Read/write accesses by software to all these secrets can be blocked, by setting the BKBLOCK bit in TAMP_CR2. The device secrets access is possible only when BKBLOCK is cleared, and no tamper flag is set for any enabled tamper source.
If \(V_{DD}\) is not present, the secrets that are erased when \(V_{DD}\) is present, are only erased at the next \(V_{DD}\) power on.
Note: Device secret erase is also triggered by setting the BKERASE bit in TAMP_CR2, or by performing a PRODUCT_STATE regression as defined in Section 3.5.1.
Device secrets are not reset by system reset or when the device wakes up from Standby mode.
Software filtering mechanism
Each tamper source can be configured not to launch an immediate erase, by setting the corresponding TAMPxNOER bit in TAMP_CR2 (for external tamper pin) or TAMP_CR3 (for internal tamper).
In such situation, when the tamper flag is raised, access to below secrets is blocked until all tamper flags are cleared:
- • Backup registers, backup SRAM, SRAM2: read-as-zero, write-ignored
- • HASH peripherals: automatically reset by RCC
Once the application, notified by the tamper event, analyzes the situation, there are two possible cases:
- • The application launches secrets erase with a software command (confirmed tamper).
- • The application just clears the flags to release secrets blocking (false tamper).
Note: If the tamper software fails to react to such a tamper flag, an IWDG reset triggers automatically the erase of secrets.
Tamper detection and low-power modes.
The effect of low-power modes on a tamper detection are summarized on the table below.
Table 4. Effect of low-power modes on TAMP
| Mode | Description |
|---|---|
| Sleep | No effect on tamper detection features TAMP interrupts cause the device to exit the Sleep mode. |
| Stop | No effect on tamper detection features, except for level detection with filtering and active tamper modes that remain active only when the clock source is LSE or LSI. Tamper events cause the device to exit the Stop mode. |
| Standby | No effect on tamper detection features, except for level detection with filtering and active tamper modes. They remain active only when the clock source is LSE or LSI. Tamper events cause the device to exit the Standby mode. |
3.4 Unique ID
The devices store a 96-bit ID that is unique to each device (see Section 42.1: Unique device ID register (96 bits)).
Application services can use this unique identity key to identify the product in the cloud network, or make it difficult for counterfeit devices or clones to inject untrusted data into the network.
3.5 Product life-cycle
A typical IoT device life-cycle is summarized in the figure below. For each step, the devices propose secure life-cycle management mechanisms embedded in the hardware.
Figure 4. Device life-cycle security

graph TD; Virgin([Virgin device]) -- "Chip manufacturing" --> STM32([STM32 personalized device]); STM32 -- "Vendor manufacturing" --> Platform([Platform]); Platform -- "User provisioning" --> DevPlatform([Development platform]); Platform -- "Productization" --> Deployed([Deployed product]); Deployed -- "Debug" --> DebugAuth([Debug authentication Control]); DebugAuth -- "Full regression" --> Deployed; Deployed -- "Field return" --> RMA([RMA product]); RMA -- "Decommissioning" --> Decommissioned([Decommissioned product]);
More details on the various phases and associated transitions, found either at the vendor or end-user premises, are summarized in the table below.
Table 5. Main product life-cycle transitions
| Transitions | Description |
|---|---|
| Device manufacturing | STMicroelectronics creates new STM32 devices, always checking for manufacturing defects. During this process, STM32 is provisioned with ROM firmware. |
| Vendor manufacturing | One (or more) vendor is responsible for the platform assembly, initialization, and provisioning before delivery to the end user. This end user can use the final product (“production” transition) or he/she can use the platform for software development (“user provisioning” transition). |
| Productization | The end user gets a product ready for use. All security functions of the platform are enabled. the debugging/testing features are restricted/disabled. |
| Transitions | Description |
|---|---|
| User provisioning | Platform vendor prepares an individual platform for development, not to be connected to a production cloud network. |
| Field return | The product is returned for analysis to field return centers. Analysis is possible by launching a full regression. Such access requires provisioning the hash of the password provided by the vendor. |
3.5.1 Life-cycle management
The product life-cycle allows to control access to different assets (code and data) of the product, including during development, manufacturing, and after sales.
It allows the provisioning of the product with different distribution models taking care on the code and data provisioned.
Table 6. Typical product life-cycle phases| PRODUCT_STATE + DebugState | Debug (default configuration) | Comments | |
|---|---|---|---|
| Open | Device open | Full available | This state allows the development of the product, as it provides the debug of the code. Using the boot pin enables the launch of the bootloader. |
| Provisioning | Debug partially opened | HDPL3 | This state allows the management of the provisioning of the product (partial or full). It permits the launch, or bootloader to provision the product. |
| iROT- Provisioned | Debug partially opened | HDPL3 | This state considers that an immutable root of trust is installed, including its configuration (code, option bytes). |
| Closed | Debug closed | NoDebug + debug authentication control | This state considers the product configuration finalized. It allows the support of a debug authentication for in-the-field repair (read the dedicated application note). |
| Locked | Debug locked | None | This state considers the product configuration finalized. The debug authentication is not permitted. The product is definitively in this state. |
| Regression | Debug closed | NoDebug | This state is a temporal state (but nonvolatile) to manage the full regression to an open state. It removes all user flash-memory code and data including the hide protected areas (HDP). |
The supported transitions, summarized in the figure below, can be requested (when available) through the debug interface or via the system bootloader.
Figure 5. Product life-cycle

The diagram illustrates the product life-cycle across three main phases: Product Development, Product manufacturing, and In-the-field return.
- Product Development: Starts with the Open state (blue box). An annotation indicates this is the "Product delivered by ST State used for development".
- Product manufacturing:
- From Open, the process moves to Provisioning (yellow box). Annotations here include "Provisioning the DebugAuthent" and "Provisioning the OEMiRoT (optional)".
- From Provisioning, it moves to iRoT-Provisioned (yellow box). An annotation states "State used when iRoT is fully provisioned".
- From iRoT-Provisioned, the process can lead to either Closed or Locked (grey boxes). An annotation for this stage is "State used when the device is fully provisioned".
- From Closed, the process moves to the In-the-field return phase.
- In-the-field return:
- Contains a Debug authentication decision diamond (pink).
- If authentication fails, it leads to Regression (grey box).
- From Regression, the process loops back to Provisioning in the manufacturing phase.
- If authentication succeeds, the process loops back to Open in the development phase.
Additional notes and a legend are provided on the right:
- Annotation: "Debug Authentication Method = Password"
- Legend:
- Blue box: Initial state: fully open for development
- Yellow box: Initial provisioning (OEMiRoT)
- Grey box: Product configuration finalised
Reference: MSv71927V2
3.5.2 Recommended product settings
To ease the product maintenance (in-the-field), it is recommended to take benefit of the feature called debug authentication control. This enables the maintenance of product activating the debug and makes possible to manage regressions while considering the security of the sensible information. This implies the following actions:
- • the first important step is to provision the HASH of the authentication password.
- • set the PRODUCT_STATE in closed state when the product has been configured.
- • the HASH of the authentication password (assume already provisioned by user in OTP) should be used for debug authentication in order to launch a full regression of the product.
Caution: The user must ensure to provision the HASH of the authentication password before changing the product state from OPEN to any other one (Provisioning, iRoT-Provisioned or Closed).
The user must take care that changing product state to Locked is irreversible so once changed debugging the device is definitively lost.
3.6 Software intellectual property protection and collaborative development
Thanks to software intellectual property protection and collaborative model, the devices allow the design of solutions integrating innovative third-party libraries.
Collaborative development is summarized on the figure below. Starting from a personalized device sold by STMicroelectronics, a vendor A can integrate a portion of hardware and software on a platform A. Platform A can be used by a vendor B, who does the same before deploying a final product to the end users.
Note: Each platform vendor can provision individual platforms for development not to be connected to a production cloud network (“Development Platform X”).
Figure 6. Collaborative development principle

graph TD
subgraph Vendor_States [Vendor states]
Device([STM32 personalized device])
PA([Platform A])
PB([Platform B])
PP1([Platform part])
PP2([Platform part])
end
subgraph User_States [User states]
DPB1([Development platform B])
DPB2([Development platform B])
DP([Deployed product])
DPDec([Decommissioned product])
end
Device -- "Vendor A manufacturing" --> PA
PA -- "Integrated" --> PP1
PA -- "Vendor B manufacturing" --> PB
PB -- "Integrated" --> PP2
PA -- "User provisioning" --> DPB1
PB -- "User provisioning" --> DPB2
PB -- "Productization" --> DP
DP -- "Decommissioning" --> DPDec
V_Dashed[ ] --- U_Dashed[ ]
style V_Dashed fill:none,stroke:none
style U_Dashed fill:none,stroke:none
MSv64455V1
The features described below contribute to securing the software intellectual property within such a collaborative development.
3.6.1 Software intellectual property protection
As described in Section 3.5.1, the hardware PRODUCT_STATE mechanism automatically controls the accesses to secrets provisioned in the device. The protection of these secrets is defined in the table below.
Table 7. Software intellectual property protection with PRODUCT_STATE
| PRODUCT_STATE protection level | Secrets protection | |
|---|---|---|
| Open | Device open | No special protections. |
| Provisioning | Debug partially opened | All areas protected with HDPL1 and HDPL2 cannot be dumped, debugged, or traced. The iROT can set up a higher level of protection. |
| iROT-Provisioned | Debug partially opened | All areas protected with HDPL1 and HDPL2 cannot be dumped, debugged, or traced. The iROT can set up a higher level of protection. |
| Closed | No debug | No debug possible except through debug authentication after a full regression. |
| Locked | No debug | All data and code stored in the device or encrypted in external flash memory cannot be dumped clear-text, debugged or traced. |
3.6.2 Other software intellectual property protections
The device additional protections to software intellectual property are:
- • Invasive attacks such as physical tampering or perturbation are countered by detection. Then, they are decommissioned of the device before the detected attack succeeds.
- • Noninvasive attacks, such as side channel attacks, are countered by not leaking secret information via side channels such as timing, power, and EM emissions.