Skip to content

Commit f2e5117

Browse files
committed
Update patchset
1 parent 277f468 commit f2e5117

File tree

2 files changed

+140
-0
lines changed

2 files changed

+140
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
From 92907dc0a3dec975e250f753fbc72a2b57639565 Mon Sep 17 00:00:00 2001
2+
From: Martino Facchin <[email protected]>
3+
Date: Wed, 28 Sep 2022 17:27:56 +0200
4+
Subject: [PATCH 178/179] STM32H747: linker: set bootloader_info section for
5+
all bootloaders
6+
7+
---
8+
.../TARGET_STM32H747xI_CM7/TOOLCHAIN_GCC_ARM/STM32H747xI_CM7.ld | 2 +-
9+
1 file changed, 1 insertion(+), 1 deletion(-)
10+
11+
diff --git a/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_STM32H747xI_CM7/TOOLCHAIN_GCC_ARM/STM32H747xI_CM7.ld b/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_STM32H747xI_CM7/TOOLCHAIN_GCC_ARM/STM32H747xI_CM7.ld
12+
index 3e84731230..2914967e38 100644
13+
--- a/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_STM32H747xI_CM7/TOOLCHAIN_GCC_ARM/STM32H747xI_CM7.ld
14+
+++ b/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_STM32H747xI_CM7/TOOLCHAIN_GCC_ARM/STM32H747xI_CM7.ld
15+
@@ -113,7 +113,7 @@ SECTIONS
16+
*(SORT(.dtors.*))
17+
*(.dtors)
18+
19+
-#if defined(MCUBOOT_BOOTLOADER_BUILD) && ( defined(TARGET_PORTENTA_H7_M7) || defined(TARGET_NICLA_VISION))
20+
+#if (defined(MCUBOOT_BOOTLOADER_BUILD) || defined(BOOTLOADER_BUILD)) && (defined(TARGET_PORTENTA_H7_M7) || defined(TARGET_NICLA_VISION))
21+
*ltrans0*.o(.rodata*)
22+
*ltrans1*.o(.rodata*)
23+
*ltrans2*.o(.rodata*)
24+
--
25+
2.37.3
26+
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
From 98eef4b565d5701b55e58388b14d45f1776e0430 Mon Sep 17 00:00:00 2001
2+
From: Martino Facchin <[email protected]>
3+
Date: Wed, 28 Sep 2022 17:28:59 +0200
4+
Subject: [PATCH 179/179] STM32: RTC: allow runtime clock source selection
5+
6+
---
7+
targets/TARGET_STM/rtc_api.c | 80 +++++++++++++++++++++---------------
8+
1 file changed, 46 insertions(+), 34 deletions(-)
9+
10+
diff --git a/targets/TARGET_STM/rtc_api.c b/targets/TARGET_STM/rtc_api.c
11+
index 3fb6cc7320..4b0d386e39 100644
12+
--- a/targets/TARGET_STM/rtc_api.c
13+
+++ b/targets/TARGET_STM/rtc_api.c
14+
@@ -44,6 +44,14 @@ static int RTC_inited = 0;
15+
16+
static RTC_HandleTypeDef RtcHandle;
17+
18+
+MBED_WEAK bool isLSEAvailableAndPrecise() {
19+
+#if MBED_CONF_TARGET_LSE_AVAILABLE
20+
+ return true;
21+
+#else
22+
+ return false;
23+
+#endif
24+
+}
25+
+
26+
void rtc_init(void)
27+
{
28+
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
29+
@@ -73,44 +81,48 @@ void rtc_init(void)
30+
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
31+
error("PeriphClkInitStruct RTC failed with HSE\n");
32+
}
33+
-#elif (MBED_CONF_TARGET_RTC_CLOCK_SOURCE == USE_RTC_CLK_LSE_OR_LSI) && MBED_CONF_TARGET_LSE_AVAILABLE
34+
- RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
35+
- RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
36+
-#if MBED_CONF_TARGET_LSE_BYPASS
37+
- RCC_OscInitStruct.LSEState = RCC_LSE_BYPASS;
38+
-#else
39+
- RCC_OscInitStruct.LSEState = RCC_LSE_ON;
40+
-#endif
41+
-
42+
- if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
43+
- error("Cannot initialize RTC with LSE\n");
44+
- }
45+
+#elif (MBED_CONF_TARGET_RTC_CLOCK_SOURCE == USE_RTC_CLK_LSE_OR_LSI)
46+
+
47+
+ // Request if LSE is precise (fallback to WEAK implementation in case)
48+
+ if (isLSEAvailableAndPrecise()) {
49+
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
50+
+ RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
51+
+ #if MBED_CONF_TARGET_LSE_BYPASS
52+
+ RCC_OscInitStruct.LSEState = RCC_LSE_BYPASS;
53+
+ #else
54+
+ RCC_OscInitStruct.LSEState = RCC_LSE_ON;
55+
+ #endif
56+
+
57+
+ if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
58+
+ error("Cannot initialize RTC with LSE\n");
59+
+ }
60+
61+
- __HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSE);
62+
+ __HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSE);
63+
64+
- PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
65+
- PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
66+
- if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
67+
- error("PeriphClkInitStruct RTC failed with LSE\n");
68+
- }
69+
-#else /* Fallback to LSI */
70+
-#if TARGET_STM32WB
71+
- RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI1;
72+
-#else
73+
- RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI;
74+
-#endif
75+
- RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
76+
- RCC_OscInitStruct.LSIState = RCC_LSI_ON;
77+
- if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
78+
- error("Cannot initialize RTC with LSI\n");
79+
- }
80+
+ PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
81+
+ PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
82+
+ if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
83+
+ error("PeriphClkInitStruct RTC failed with LSE\n");
84+
+ }
85+
+ } else {
86+
+ #if TARGET_STM32WB
87+
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI1;
88+
+ #else
89+
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI;
90+
+ #endif
91+
+ RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
92+
+ RCC_OscInitStruct.LSIState = RCC_LSI_ON;
93+
+ if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
94+
+ error("Cannot initialize RTC with LSI\n");
95+
+ }
96+
97+
- __HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSI);
98+
+ __HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSI);
99+
100+
- PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
101+
- PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
102+
- if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
103+
- error("PeriphClkInitStruct RTC failed with LSI\n");
104+
+ PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
105+
+ PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
106+
+ if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
107+
+ error("PeriphClkInitStruct RTC failed with LSI\n");
108+
+ }
109+
}
110+
#endif /* MBED_CONF_TARGET_RTC_CLOCK_SOURCE */
111+
#if defined(DUAL_CORE) && (TARGET_STM32H7)
112+
--
113+
2.37.3
114+

0 commit comments

Comments
 (0)