Registered User mNo edit summary |
Registered User m (Assignment tables reviewed with architects) |
||
(7 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<noinclude>{{ApplicableFor | <noinclude>{{ApplicableFor | ||
|MPUs list=STM32MP13x, STM32MP15x | |MPUs list=STM32MP13x, STM32MP15x | ||
|MPUs checklist=STM32MP13x,STM32MP15x | |MPUs checklist=STM32MP13x, STM32MP15x | ||
}}</noinclude> | }}</noinclude> | ||
==Article purpose== | |||
The purpose of this article is to: | |||
* briefly introduce the RTC peripheral and its main features, | |||
* indicate the peripheral instances assignment at boot time and their assignment at runtime (including whether instances can be allocated to secure contexts), | |||
* list the software frameworks and drivers managing the peripheral, | |||
* explain how to configure the peripheral. | |||
{| | ==Peripheral overview== | ||
The '''RTC''' peripheral is used to provide the date and clock to the application. It supports programmable alarms and wake up capabilities. | |||
Refer to the [[STM32 MPU resources#Reference manuals|STM32 MPU reference manuals]] for the complete list of features, and to the software frameworks and drivers, introduced below, to see which features are implemented. | |||
==Peripheral usage== | |||
This chapter is applicable in the scope of the '''OpenSTLinux BSP''' running on the Arm<sup>®</sup> Cortex<sup>®</sup>-A processor(s), and the '''STM32CubeMPU Package''' running on the Arm<sup>®</sup> Cortex<sup>®</sup>-M processor. | |||
===Boot time assignment=== | |||
====On {{MicroprocessorDevice | device=1}}==== | |||
By default after a backup domain power-on reset (performed at boot time), all RTC registers can be read or written in both secure and non-secure modes.<br /> | |||
In OpenSTLinux distribution, the first stage bootloader (FSBL, running in secure mode) keeps this default configuration, leaving full control to Linux<sup>®</sup> at runtime. | |||
{{InternalInfo|This configuration could be changed in RTC_SMCR register, per sub function (initialization, calibration, alarm A, alarm B, wake up timer and time-stamp). The customer may adapt this configuration to his needs, sharing some functions with the coprocessor or the secure world. This would require some code adaptation because, in case some functions are put in secure world, then secure services are needed to access to some control registers (like the write protection) from Linux.}} | |||
The '''RTC''' peripheral is able to generate two interrupts: | |||
* A secure interrupt, connected to the Arm<sup>®</sup> Cortex<sup>®</sup>-A7 [[GIC internal peripheral|GIC]], not used in OpenSTLinux distribution. | |||
* A non-secure interrupt, connected both to Arm<sup>®</sup> Cortex<sup>®</sup>-A7 [[GIC internal peripheral|GIC]] and Cortex-M4 [[NVIC internal peripheral|NVIC]] ({{MicroprocessorDevice | device=15}} only): this interrupt is used on Linux<sup>®</sup> and by default in OpenSTLinux distribution.<br /> | |||
The '''RTC''' peripheral is part of the backup domain which reset and clock are controlled via the [[RCC internal peripheral|RCC]] by the first stage bootloader (FSBL, running in secure mode) at boot time.<br /> | |||
The RTC reset occurs when the backup domain is reset. To avoid clearing the [[TAMP internal peripheral|TAMP]] register contents, this is only done on cold boot, not on wake up. | |||
{{#lst:STM32MP1_internal_peripherals_assignment_table_template|stm32mp1_boottime}} | |||
<section begin=stm32mp13_boottime /><section begin=stm32mp15_boottime /> | |||
| rowspan="1" | Core | |||
| rowspan="1" | [[RTC internal peripheral|RTC]] | |||
| RTC | |||
| | |||
| | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| | |||
|- | |- | ||
<section end=stm32mp13_boottime /><section end=stm32mp15_boottime /> | |||
|} | |||
===Runtime assignment=== | |||
====On {{MicroprocessorDevice | device=13}}==== | |||
{{#lst:STM32MP1_internal_peripherals_assignment_table_template|stm32mp13_runtime}} | |||
<section begin=stm32mp13_runtime /> | |||
| rowspan="1" | Core | |||
| rowspan="1" | [[RTC internal peripheral|RTC]] | |||
| RTC | |||
| <span title="assigned peripheral" style="font-size:21px">☑</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| RTC is mandatory to resynchronize [[STGEN_internal_peripheral | STGEN]] after exiting [[Power_overview | low-power modes]]. | |||
|- | |- | ||
| {{MicroprocessorDevice | device= | <section end=stm32mp13_runtime /> | ||
|} | |||
====On {{MicroprocessorDevice | device=15}}==== | |||
{{#lst:STM32MP1_internal_peripherals_assignment_table_template|stm32mp15_runtime}} | |||
<section begin=stm32mp15_runtime /> | |||
| rowspan="1" | Core | |||
| rowspan="1" | [[RTC internal peripheral|RTC]] | |||
| RTC | |||
| <span title="assigned peripheral" style="font-size:21px">☑</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| RTC is mandatory to resynchronize [[STGEN_internal_peripheral | STGEN]] after exiting [[Power_overview | low-power modes]]. | |||
|- | |- | ||
<section end=stm32mp15_runtime /> | |||
|} | |} | ||
==Software frameworks and drivers== | |||
Below are listed the software frameworks and drivers managing the RTC peripheral for the embedded software components listed in the above tables. | |||
* '''Linux<sup>®</sup>''': [[RTC overview|RTC framework]] | |||
* '''U-Boot''': | |||
** {{CodeSource | U-Boot | drivers/rtc/rtc-uclass.c}} | |||
** {{CodeSource | U-Boot | drivers/rtc/stm32_rtc.c}} | |||
==How to assign and configure the peripheral== | |||
The peripheral assignment can be done via the [[STM32CubeMX]] graphical tool (and manually completed if needed).<br /> | |||
This tool also helps to configure the peripheral: | |||
* partial device trees (pin control and clock tree) generation for the OpenSTLinux software components, | |||
* HAL initialization code generation for the STM32CubeMPU Package. | |||
The configuration is applied by the firmware running in the context in which the peripheral is assigned. | |||
For Linux kernel configuration, please refer to [[RTC device tree configuration|RTC device tree configuration]]. | |||
<noinclude> | <noinclude> | ||
[[Category:Core peripherals]] | [[Category:Core peripherals]] | ||
{{PublicationRequestId | | {{ArticleBasedOnModel| Internal peripheral article model}} | ||
{{PublicationRequestId | 10398 | 2019-01-21 | AnneJ}} | |||
</noinclude> | </noinclude> |
Revision as of 17:27, 19 June 2023
1. Article purpose[edit | edit source]
The purpose of this article is to:
- briefly introduce the RTC peripheral and its main features,
- indicate the peripheral instances assignment at boot time and their assignment at runtime (including whether instances can be allocated to secure contexts),
- list the software frameworks and drivers managing the peripheral,
- explain how to configure the peripheral.
2. Peripheral overview[edit | edit source]
The RTC peripheral is used to provide the date and clock to the application. It supports programmable alarms and wake up capabilities.
Refer to the STM32 MPU reference manuals for the complete list of features, and to the software frameworks and drivers, introduced below, to see which features are implemented.
3. Peripheral usage[edit | edit source]
This chapter is applicable in the scope of the OpenSTLinux BSP running on the Arm® Cortex®-A processor(s), and the STM32CubeMPU Package running on the Arm® Cortex®-M processor.
3.1. Boot time assignment[edit | edit source]
3.1.1. On STM32MP1 Series[edit | edit source]
By default after a backup domain power-on reset (performed at boot time), all RTC registers can be read or written in both secure and non-secure modes.
In OpenSTLinux distribution, the first stage bootloader (FSBL, running in secure mode) keeps this default configuration, leaving full control to Linux® at runtime.
The RTC peripheral is able to generate two interrupts:
- A secure interrupt, connected to the Arm® Cortex®-A7 GIC, not used in OpenSTLinux distribution.
- A non-secure interrupt, connected both to Arm® Cortex®-A7 GIC and Cortex-M4 NVIC (STM32MP15x lines
only): this interrupt is used on Linux® and by default in OpenSTLinux distribution.
The RTC peripheral is part of the backup domain which reset and clock are controlled via the RCC by the first stage bootloader (FSBL, running in secure mode) at boot time.
The RTC reset occurs when the backup domain is reset. To avoid clearing the TAMP register contents, this is only done on cold boot, not on wake up.
Click on to expand or collapse the legend...
Domain | Peripheral | Boot time allocation | Comment ![]() | |||
---|---|---|---|---|---|---|
Instance | Cortex-A7 secure (ROM code) |
Cortex-A7 secure (TF-A BL2) |
Cortex-A7 nonsecure (U-Boot) | |||
Core | RTC | RTC | ☐ |
3.2. Runtime assignment[edit | edit source]
3.2.1. On STM32MP13x lines
[edit | edit source]
Click on to expand or collapse the legend...
Domain | Peripheral | Runtime allocation | Comment ![]() | ||
---|---|---|---|---|---|
Instance | Cortex-A7 secure (OP-TEE) |
Cortex-A7 nonsecure (Linux) | |||
Core | RTC | RTC | ☑ | ☐ | RTC is mandatory to resynchronize STGEN after exiting low-power modes. |
3.2.2. On STM32MP15x lines
[edit | edit source]
Click on to expand or collapse the legend...
Domain | Peripheral | Runtime allocation | Comment ![]() | |||
---|---|---|---|---|---|---|
Instance | Cortex-A7 secure (OP-TEE) |
Cortex-A7 nonsecure (Linux) |
Cortex-M4 (STM32Cube) | |||
Core | RTC | RTC | ☑ | ☐ | ☐ | RTC is mandatory to resynchronize STGEN after exiting low-power modes. |
4. Software frameworks and drivers[edit | edit source]
Below are listed the software frameworks and drivers managing the RTC peripheral for the embedded software components listed in the above tables.
- Linux®: RTC framework
- U-Boot:
5. How to assign and configure the peripheral[edit | edit source]
The peripheral assignment can be done via the STM32CubeMX graphical tool (and manually completed if needed).
This tool also helps to configure the peripheral:
- partial device trees (pin control and clock tree) generation for the OpenSTLinux software components,
- HAL initialization code generation for the STM32CubeMPU Package.
The configuration is applied by the firmware running in the context in which the peripheral is assigned.
For Linux kernel configuration, please refer to RTC device tree configuration.