Skip to content

Commit 373e7c6

Browse files
committed
patches: add stm32h7_m4 patchset
1 parent 9f04816 commit 373e7c6

5 files changed

+34865
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
From 547edd2014933a15cd0e48fe1f2f5f9b9ce094fd Mon Sep 17 00:00:00 2001
2+
From: Martino Facchin <m.facchin@arduino.cc>
3+
Date: Thu, 26 Oct 2023 16:37:54 +0200
4+
Subject: [PATCH 209/213] portenta_h7: make sure configuration is only executed
5+
by M7
6+
7+
---
8+
.../TARGET_STM32H747xI/TARGET_PORTENTA_H7/portenta_power.cpp | 3 ++-
9+
.../TARGET_PORTENTA_H7/system_clock_override.c | 2 ++
10+
2 files changed, 4 insertions(+), 1 deletion(-)
11+
12+
diff --git a/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/portenta_power.cpp b/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/portenta_power.cpp
13+
index 13ba1042de..59e6ac6cca 100644
14+
--- a/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/portenta_power.cpp
15+
+++ b/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/portenta_power.cpp
16+
@@ -26,6 +26,7 @@
17+
******************************************************************************/
18+
void enableEthPowerSupply(void)
19+
{
20+
+#ifndef CORE_CM4
21+
/* Ensure ETH power supply */
22+
mbed::I2C i2c(PB_7, PB_6);
23+
24+
@@ -48,5 +49,5 @@ void enableEthPowerSupply(void)
25+
data[0] = 0x35;
26+
data[1] = 0xF;
27+
i2c.write(8 << 1, data, sizeof(data));
28+
-
29+
+#endif
30+
}
31+
diff --git a/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/system_clock_override.c b/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/system_clock_override.c
32+
index ae7821ede0..e47b7d258c 100644
33+
--- a/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/system_clock_override.c
34+
+++ b/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/system_clock_override.c
35+
@@ -129,6 +129,7 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass, bool lowspeed)
36+
}
37+
}
38+
39+
+#ifndef CORE_CM4
40+
/* Enable oscillator pin */
41+
__HAL_RCC_GPIOH_CLK_ENABLE();
42+
GPIO_InitTypeDef gpio_osc_init_structure;
43+
@@ -139,6 +140,7 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass, bool lowspeed)
44+
HAL_GPIO_Init(GPIOH, &gpio_osc_init_structure);
45+
HAL_Delay(10);
46+
HAL_GPIO_WritePin(GPIOH, GPIO_PIN_1, 1);
47+
+#endif
48+
49+
/* Supply configuration update enable */
50+
#if HSE_VALUE == 27000000
51+
--
52+
2.42.0
53+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
From cb4587fa30a8f49bf27a16dda20fb21947d385ed Mon Sep 17 00:00:00 2001
2+
From: Martino Facchin <m.facchin@arduino.cc>
3+
Date: Thu, 26 Oct 2023 16:38:15 +0200
4+
Subject: [PATCH 210/213] giga: remove stray function
5+
6+
---
7+
.../TARGET_GIGA/giga_power.cpp | 23 -------------------
8+
1 file changed, 23 deletions(-)
9+
10+
diff --git a/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_GIGA/giga_power.cpp b/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_GIGA/giga_power.cpp
11+
index a47a758e1d..1954ff50cc 100644
12+
--- a/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_GIGA/giga_power.cpp
13+
+++ b/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_GIGA/giga_power.cpp
14+
@@ -26,27 +26,4 @@
15+
******************************************************************************/
16+
void enableEthPowerSupply(void)
17+
{
18+
- /* Ensure ETH power supply */
19+
- mbed::I2C i2c(PB_7, PB_6);
20+
-
21+
- char data[2];
22+
-
23+
- // LDO3 to 1.2V
24+
- data[0] = 0x52;
25+
- data[1] = 0x9;
26+
- i2c.write(8 << 1, data, sizeof(data));
27+
- data[0] = 0x53;
28+
- data[1] = 0xF;
29+
- i2c.write(8 << 1, data, sizeof(data));
30+
-
31+
- // SW2 to 3.3V (SW2_VOLT)
32+
- data[0] = 0x3B;
33+
- data[1] = 0xF;
34+
- i2c.write(8 << 1, data, sizeof(data));
35+
-
36+
- // SW1 to 3.0V (SW1_VOLT)
37+
- data[0] = 0x35;
38+
- data[1] = 0xF;
39+
- i2c.write(8 << 1, data, sizeof(data));
40+
-
41+
}
42+
--
43+
2.42.0
44+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
From f0fb6a21e7eb398c0b7279bce7859ae77debcc64 Mon Sep 17 00:00:00 2001
2+
From: Martino Facchin <m.facchin@arduino.cc>
3+
Date: Thu, 26 Oct 2023 16:39:04 +0200
4+
Subject: [PATCH 211/213] stm32h7 dual core: allow override of
5+
HAL_RCC_GetSysClockFreq
6+
7+
It's the only needed entry point to get the right timings for all peripherals
8+
---
9+
.../STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_rcc.c | 2 +-
10+
1 file changed, 1 insertion(+), 1 deletion(-)
11+
12+
diff --git a/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_rcc.c b/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_rcc.c
13+
index eb5485dc7d..f03be381a4 100644
14+
--- a/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_rcc.c
15+
+++ b/targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_rcc.c
16+
@@ -1354,7 +1354,7 @@ void HAL_RCC_DisableCSS(void)
17+
*
18+
* @retval SYSCLK frequency
19+
*/
20+
-uint32_t HAL_RCC_GetSysClockFreq(void)
21+
+__attribute__((weak)) uint32_t HAL_RCC_GetSysClockFreq(void)
22+
{
23+
uint32_t pllp, pllsource, pllm, pllfracen, hsivalue;
24+
float_t fracn1, pllvco;
25+
--
26+
2.42.0
27+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
From 46653cb9d8015361327cb0a8f9b394d6c008c841 Mon Sep 17 00:00:00 2001
2+
From: Martino Facchin <m.facchin@arduino.cc>
3+
Date: Thu, 26 Oct 2023 16:39:59 +0200
4+
Subject: [PATCH 212/213] ble: remove stray specializations
5+
6+
the standard one from Cypress driver is fine
7+
---
8+
.../TARGET_NICLA_VISION/cy_bt_cordio_cfg.cpp | 105 ------------------
9+
.../TARGET_PORTENTA_H7/cy_bt_cordio_cfg.cpp | 105 ------------------
10+
2 files changed, 210 deletions(-)
11+
delete mode 100644 connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/TARGET_NICLA_VISION/cy_bt_cordio_cfg.cpp
12+
delete mode 100644 connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/TARGET_PORTENTA_H7/cy_bt_cordio_cfg.cpp
13+
14+
diff --git a/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/TARGET_NICLA_VISION/cy_bt_cordio_cfg.cpp b/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/TARGET_NICLA_VISION/cy_bt_cordio_cfg.cpp
15+
deleted file mode 100644
16+
index 2d668fed9c..0000000000
17+
--- a/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/TARGET_NICLA_VISION/cy_bt_cordio_cfg.cpp
18+
+++ /dev/null
19+
@@ -1,105 +0,0 @@
20+
-/*******************************************************************************
21+
-* \file cy_bt_cordio_cfg.cpp
22+
-* \version 1.0
23+
-*
24+
-*
25+
-* Low Power Assist BT Pin configuration implementation.
26+
-*
27+
-********************************************************************************
28+
-* \copyright
29+
-* Copyright 2019 Cypress Semiconductor Corporation
30+
-* SPDX-License-Identifier: Apache-2.0
31+
-*
32+
-* Licensed under the Apache License, Version 2.0 (the "License");
33+
-* you may not use this file except in compliance with the License.
34+
-* You may obtain a copy of the License at
35+
-*
36+
-* http://www.apache.org/licenses/LICENSE-2.0
37+
-*
38+
-* Unless required by applicable law or agreed to in writing, software
39+
-* distributed under the License is distributed on an "AS IS" BASIS,
40+
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
41+
-* See the License for the specific language governing permissions and
42+
-* limitations under the License.
43+
-*******************************************************************************/
44+
-
45+
-#include <stdio.h>
46+
-#include "ble/driver/CordioHCIDriver.h"
47+
-#include "hci_api.h"
48+
-#include "hci_cmd.h"
49+
-#include "hci_core.h"
50+
-#include "bstream.h"
51+
-#include "assert.h"
52+
-#include <stdbool.h>
53+
-#include "hci_mbed_os_adaptation.h"
54+
-#include "CyH4TransportDriver.h"
55+
-
56+
-#define cyhal_gpio_to_rtos(x) (x)
57+
-#define CYCFG_BT_LP_ENABLED (1)
58+
-#define CYCFG_BT_HOST_WAKE_IRQ_EVENT WAKE_EVENT_ACTIVE_LOW
59+
-#define CYCFG_BT_DEV_WAKE_POLARITY WAKE_EVENT_ACTIVE_LOW
60+
-
61+
-/*******************************************************************************
62+
-* Function Name: ble_cordio_get_h4_transport_driver
63+
-********************************************************************************
64+
-*
65+
-* Strong implementation of function which calls CyH4TransportDriver constructor and return it
66+
-*
67+
-* \param none
68+
-*
69+
-* \return
70+
-* Returns the transport driver object
71+
-*******************************************************************************/
72+
-ble::vendor::cypress_ble::CyH4TransportDriver& ble_cordio_get_h4_transport_driver()
73+
-{
74+
-#if (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER)
75+
-
76+
-#if (defined(CYCFG_BT_LP_ENABLED))
77+
- if (CYCFG_BT_LP_ENABLED) {
78+
- static ble::vendor::cypress_ble::CyH4TransportDriver s_transport_driver(
79+
- /* TX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_TX),
80+
- /* RX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RX),
81+
- /* cts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_CTS),
82+
- /* rts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RTS),
83+
- /* power */ cyhal_gpio_to_rtos(CYBSP_BT_POWER),
84+
- DEF_BT_BAUD_RATE,
85+
- cyhal_gpio_to_rtos(CYBSP_BT_HOST_WAKE),
86+
- cyhal_gpio_to_rtos(CYBSP_BT_DEVICE_WAKE),
87+
- CYCFG_BT_HOST_WAKE_IRQ_EVENT,
88+
- CYCFG_BT_DEV_WAKE_POLARITY
89+
- );
90+
- return s_transport_driver;
91+
- } else { /* CYCFG_BT_LP_ENABLED */
92+
- static ble::vendor::cypress_ble::CyH4TransportDriver s_transport_driver(
93+
- /* TX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_TX),
94+
- /* RX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RX),
95+
- /* cts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_CTS),
96+
- /* rts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RTS),
97+
- /* power */ cyhal_gpio_to_rtos(CYBSP_BT_POWER),
98+
- DEF_BT_BAUD_RATE);
99+
- return s_transport_driver;
100+
- }
101+
-#else /* (defined(CYCFG_BT_LP_ENABLED)) */
102+
- static ble::vendor::cypress_ble::CyH4TransportDriver s_transport_driver(
103+
- /* TX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_TX),
104+
- /* RX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RX),
105+
- /* cts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_CTS),
106+
- /* rts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RTS),
107+
- /* power */ cyhal_gpio_to_rtos(CYBSP_BT_POWER),
108+
- DEF_BT_BAUD_RATE),
109+
- cyhal_gpio_to_rtos(CYBSP_BT_HOST_WAKE), cyhal_gpio_to_rtos(CYBSP_BT_DEVICE_WAKE)
110+
- );
111+
- return s_transport_driver;
112+
-#endif /* (defined(CYCFG_BT_LP_ENABLED)) */
113+
-
114+
-#else /* (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER) */
115+
- static ble::vendor::cypress_ble::CyH4TransportDriver s_transport_driver(
116+
- /* TX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_TX),
117+
- /* RX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RX),
118+
- /* cts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_CTS),
119+
- /* rts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RTS),
120+
- /* power */ cyhal_gpio_to_rtos(CYBSP_BT_POWER),
121+
- DEF_BT_BAUD_RATE);
122+
- return s_transport_driver;
123+
-#endif /* (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER) */
124+
-}
125+
diff --git a/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/TARGET_PORTENTA_H7/cy_bt_cordio_cfg.cpp b/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/TARGET_PORTENTA_H7/cy_bt_cordio_cfg.cpp
126+
deleted file mode 100644
127+
index 2d668fed9c..0000000000
128+
--- a/connectivity/drivers/ble/FEATURE_BLE/COMPONENT_CYW43XXX/TARGET_PORTENTA_H7/cy_bt_cordio_cfg.cpp
129+
+++ /dev/null
130+
@@ -1,105 +0,0 @@
131+
-/*******************************************************************************
132+
-* \file cy_bt_cordio_cfg.cpp
133+
-* \version 1.0
134+
-*
135+
-*
136+
-* Low Power Assist BT Pin configuration implementation.
137+
-*
138+
-********************************************************************************
139+
-* \copyright
140+
-* Copyright 2019 Cypress Semiconductor Corporation
141+
-* SPDX-License-Identifier: Apache-2.0
142+
-*
143+
-* Licensed under the Apache License, Version 2.0 (the "License");
144+
-* you may not use this file except in compliance with the License.
145+
-* You may obtain a copy of the License at
146+
-*
147+
-* http://www.apache.org/licenses/LICENSE-2.0
148+
-*
149+
-* Unless required by applicable law or agreed to in writing, software
150+
-* distributed under the License is distributed on an "AS IS" BASIS,
151+
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
152+
-* See the License for the specific language governing permissions and
153+
-* limitations under the License.
154+
-*******************************************************************************/
155+
-
156+
-#include <stdio.h>
157+
-#include "ble/driver/CordioHCIDriver.h"
158+
-#include "hci_api.h"
159+
-#include "hci_cmd.h"
160+
-#include "hci_core.h"
161+
-#include "bstream.h"
162+
-#include "assert.h"
163+
-#include <stdbool.h>
164+
-#include "hci_mbed_os_adaptation.h"
165+
-#include "CyH4TransportDriver.h"
166+
-
167+
-#define cyhal_gpio_to_rtos(x) (x)
168+
-#define CYCFG_BT_LP_ENABLED (1)
169+
-#define CYCFG_BT_HOST_WAKE_IRQ_EVENT WAKE_EVENT_ACTIVE_LOW
170+
-#define CYCFG_BT_DEV_WAKE_POLARITY WAKE_EVENT_ACTIVE_LOW
171+
-
172+
-/*******************************************************************************
173+
-* Function Name: ble_cordio_get_h4_transport_driver
174+
-********************************************************************************
175+
-*
176+
-* Strong implementation of function which calls CyH4TransportDriver constructor and return it
177+
-*
178+
-* \param none
179+
-*
180+
-* \return
181+
-* Returns the transport driver object
182+
-*******************************************************************************/
183+
-ble::vendor::cypress_ble::CyH4TransportDriver& ble_cordio_get_h4_transport_driver()
184+
-{
185+
-#if (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER)
186+
-
187+
-#if (defined(CYCFG_BT_LP_ENABLED))
188+
- if (CYCFG_BT_LP_ENABLED) {
189+
- static ble::vendor::cypress_ble::CyH4TransportDriver s_transport_driver(
190+
- /* TX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_TX),
191+
- /* RX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RX),
192+
- /* cts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_CTS),
193+
- /* rts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RTS),
194+
- /* power */ cyhal_gpio_to_rtos(CYBSP_BT_POWER),
195+
- DEF_BT_BAUD_RATE,
196+
- cyhal_gpio_to_rtos(CYBSP_BT_HOST_WAKE),
197+
- cyhal_gpio_to_rtos(CYBSP_BT_DEVICE_WAKE),
198+
- CYCFG_BT_HOST_WAKE_IRQ_EVENT,
199+
- CYCFG_BT_DEV_WAKE_POLARITY
200+
- );
201+
- return s_transport_driver;
202+
- } else { /* CYCFG_BT_LP_ENABLED */
203+
- static ble::vendor::cypress_ble::CyH4TransportDriver s_transport_driver(
204+
- /* TX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_TX),
205+
- /* RX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RX),
206+
- /* cts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_CTS),
207+
- /* rts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RTS),
208+
- /* power */ cyhal_gpio_to_rtos(CYBSP_BT_POWER),
209+
- DEF_BT_BAUD_RATE);
210+
- return s_transport_driver;
211+
- }
212+
-#else /* (defined(CYCFG_BT_LP_ENABLED)) */
213+
- static ble::vendor::cypress_ble::CyH4TransportDriver s_transport_driver(
214+
- /* TX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_TX),
215+
- /* RX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RX),
216+
- /* cts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_CTS),
217+
- /* rts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RTS),
218+
- /* power */ cyhal_gpio_to_rtos(CYBSP_BT_POWER),
219+
- DEF_BT_BAUD_RATE),
220+
- cyhal_gpio_to_rtos(CYBSP_BT_HOST_WAKE), cyhal_gpio_to_rtos(CYBSP_BT_DEVICE_WAKE)
221+
- );
222+
- return s_transport_driver;
223+
-#endif /* (defined(CYCFG_BT_LP_ENABLED)) */
224+
-
225+
-#else /* (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER) */
226+
- static ble::vendor::cypress_ble::CyH4TransportDriver s_transport_driver(
227+
- /* TX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_TX),
228+
- /* RX */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RX),
229+
- /* cts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_CTS),
230+
- /* rts */ cyhal_gpio_to_rtos(CYBSP_BT_UART_RTS),
231+
- /* power */ cyhal_gpio_to_rtos(CYBSP_BT_POWER),
232+
- DEF_BT_BAUD_RATE);
233+
- return s_transport_driver;
234+
-#endif /* (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER) */
235+
-}
236+
--
237+
2.42.0
238+

0 commit comments

Comments
 (0)