Skip to content

Commit 088081d

Browse files
authored
Merge pull request #1026 from fpistm/CubeUpdate
Script to update HAL drivers and CMSIS devices from the STM32Cube GitHub release
2 parents 930184b + 92d12a7 commit 088081d

13 files changed

+1649
-0
lines changed

Diff for: .gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*.md text eol=lf
2727
*.MD text eol=lf
2828
*.old text eol=lf
29+
*.patch text eol=lf
2930
*.pde text eol=lf
3031
*.properties text eol=lf
3132
*.py text eol=lf

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ astyle.out
33
boards.local.txt
44
platform.local.txt
55
path_config.json
6+
update_config.json
67

78
# Backup
89
*.bak
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
From 01b39c624995928905b99b3ce211482d27d0d1bc Mon Sep 17 00:00:00 2001
2+
From: Bumsik Kim <[email protected]>
3+
Date: Sat, 12 Oct 2019 21:50:30 +0900
4+
Subject: [PATCH 1/1] [MP1] Review HAL default configuration
5+
6+
---
7+
.../Device/ST/STM32MP1xx/Include/stm32mp1xx.h | 6 +-
8+
.../STM32MP1xx/stm32mp1xx_hal_conf_default.h | 89 ++++++++++---------
9+
2 files changed, 49 insertions(+), 46 deletions(-)
10+
11+
diff --git a/system/Drivers/CMSIS/Device/ST/STM32MP1xx/Include/stm32mp1xx.h b/system/Drivers/CMSIS/Device/ST/STM32MP1xx/Include/stm32mp1xx.h
12+
index 10395b51..528b9b91 100644
13+
--- a/system/Drivers/CMSIS/Device/ST/STM32MP1xx/Include/stm32mp1xx.h
14+
+++ b/system/Drivers/CMSIS/Device/ST/STM32MP1xx/Include/stm32mp1xx.h
15+
@@ -197,7 +197,7 @@ typedef enum
16+
*/
17+
18+
#if defined (USE_HAL_DRIVER)
19+
- #include "stm32mp1xx_hal_conf.h"
20+
+ #include "stm32mp1xx_hal.h"
21+
#endif /* USE_HAL_DRIVER */
22+
23+
24+
--
25+
2.25.1.windows.1
26+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
From 4aba75ec152a2d2c65d07c1912da9eb4ea08be2e Mon Sep 17 00:00:00 2001
2+
From: Alexandre Bourdiol <[email protected]>
3+
Date: Mon, 27 Jan 2020 18:23:15 +0100
4+
Subject: [PATCH 1/1] [F1] I2C HAL fix: generate Start only once Stop is
5+
finished
6+
7+
---
8+
.../Src/stm32f1xx_hal_i2c.c | 87 ++++++++++++++++++-
9+
1 file changed, 86 insertions(+), 1 deletion(-)
10+
11+
diff --git a/system/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c b/system/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c
12+
index 6e74e699..fc108e0b 100644
13+
--- a/system/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c
14+
+++ b/system/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c
15+
@@ -3492,6 +3492,27 @@ HAL_StatusTypeDef HAL_I2C_Master_Seq_Transmit_IT(I2C_HandleTypeDef *hi2c, uint16
16+
while (__HAL_I2C_GET_FLAG(hi2c, I2C_FLAG_BUSY) != RESET);
17+
}
18+
19+
+ /* Before any new treatment like start or restart, check that there is no pending STOP request */
20+
+ /* Wait until STOP flag is reset */
21+
+ count = I2C_TIMEOUT_BUSY_FLAG * (SystemCoreClock / 25U / 1000U);
22+
+ do
23+
+ {
24+
+ count--;
25+
+ if (count == 0U)
26+
+ {
27+
+ hi2c->PreviousState = I2C_STATE_NONE;
28+
+ hi2c->State = HAL_I2C_STATE_READY;
29+
+ hi2c->Mode = HAL_I2C_MODE_NONE;
30+
+ hi2c->ErrorCode |= HAL_I2C_ERROR_TIMEOUT;
31+
+
32+
+ /* Process Unlocked */
33+
+ __HAL_UNLOCK(hi2c);
34+
+
35+
+ return HAL_ERROR;
36+
+ }
37+
+ }
38+
+ while (READ_BIT(hi2c->Instance->CR1, I2C_CR1_STOP) == I2C_CR1_STOP);
39+
+
40+
/* Process Locked */
41+
__HAL_LOCK(hi2c);
42+
43+
@@ -3591,6 +3612,27 @@ HAL_StatusTypeDef HAL_I2C_Master_Seq_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint1
44+
while (__HAL_I2C_GET_FLAG(hi2c, I2C_FLAG_BUSY) != RESET);
45+
}
46+
47+
+ /* Before any new treatment like start or restart, check that there is no pending STOP request */
48+
+ /* Wait until STOP flag is reset */
49+
+ count = I2C_TIMEOUT_BUSY_FLAG * (SystemCoreClock / 25U / 1000U);
50+
+ do
51+
+ {
52+
+ count--;
53+
+ if (count == 0U)
54+
+ {
55+
+ hi2c->PreviousState = I2C_STATE_NONE;
56+
+ hi2c->State = HAL_I2C_STATE_READY;
57+
+ hi2c->Mode = HAL_I2C_MODE_NONE;
58+
+ hi2c->ErrorCode |= HAL_I2C_ERROR_TIMEOUT;
59+
+
60+
+ /* Process Unlocked */
61+
+ __HAL_UNLOCK(hi2c);
62+
+
63+
+ return HAL_ERROR;
64+
+ }
65+
+ }
66+
+ while (READ_BIT(hi2c->Instance->CR1, I2C_CR1_STOP) == I2C_CR1_STOP);
67+
+
68+
/* Process Locked */
69+
__HAL_LOCK(hi2c);
70+
71+
@@ -3757,6 +3799,27 @@ HAL_StatusTypeDef HAL_I2C_Master_Seq_Receive_IT(I2C_HandleTypeDef *hi2c, uint16_
72+
while (__HAL_I2C_GET_FLAG(hi2c, I2C_FLAG_BUSY) != RESET);
73+
}
74+
75+
+ /* Before any new treatment like start or restart, check that there is no pending STOP request */
76+
+ /* Wait until STOP flag is reset */
77+
+ count = I2C_TIMEOUT_BUSY_FLAG * (SystemCoreClock / 25U / 1000U);
78+
+ do
79+
+ {
80+
+ count--;
81+
+ if (count == 0U)
82+
+ {
83+
+ hi2c->PreviousState = I2C_STATE_NONE;
84+
+ hi2c->State = HAL_I2C_STATE_READY;
85+
+ hi2c->Mode = HAL_I2C_MODE_NONE;
86+
+ hi2c->ErrorCode |= HAL_I2C_ERROR_TIMEOUT;
87+
+
88+
+ /* Process Unlocked */
89+
+ __HAL_UNLOCK(hi2c);
90+
+
91+
+ return HAL_ERROR;
92+
+ }
93+
+ }
94+
+ while (READ_BIT(hi2c->Instance->CR1, I2C_CR1_STOP) == I2C_CR1_STOP);
95+
+
96+
/* Process Locked */
97+
__HAL_LOCK(hi2c);
98+
99+
@@ -3882,6 +3945,27 @@ HAL_StatusTypeDef HAL_I2C_Master_Seq_Receive_DMA(I2C_HandleTypeDef *hi2c, uint16
100+
while (__HAL_I2C_GET_FLAG(hi2c, I2C_FLAG_BUSY) != RESET);
101+
}
102+
103+
+ /* Before any new treatment like start or restart, check that there is no pending STOP request */
104+
+ /* Wait until STOP flag is reset */
105+
+ count = I2C_TIMEOUT_BUSY_FLAG * (SystemCoreClock / 25U / 1000U);
106+
+ do
107+
+ {
108+
+ count--;
109+
+ if (count == 0U)
110+
+ {
111+
+ hi2c->PreviousState = I2C_STATE_NONE;
112+
+ hi2c->State = HAL_I2C_STATE_READY;
113+
+ hi2c->Mode = HAL_I2C_MODE_NONE;
114+
+ hi2c->ErrorCode |= HAL_I2C_ERROR_TIMEOUT;
115+
+
116+
+ /* Process Unlocked */
117+
+ __HAL_UNLOCK(hi2c);
118+
+
119+
+ return HAL_ERROR;
120+
+ }
121+
+ }
122+
+ while (READ_BIT(hi2c->Instance->CR1, I2C_CR1_STOP) == I2C_CR1_STOP);
123+
+
124+
/* Process Locked */
125+
__HAL_LOCK(hi2c);
126+
127+
@@ -4565,7 +4649,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Abort_IT(I2C_HandleTypeDef *hi2c, uint16_t DevA
128+
UNUSED(DevAddress);
129+
130+
/* Abort Master transfer during Receive or Transmit process */
131+
- if (hi2c->Mode == HAL_I2C_MODE_MASTER)
132+
+ if ((__HAL_I2C_GET_FLAG(hi2c, I2C_FLAG_BUSY) != RESET) && (hi2c->Mode == HAL_I2C_MODE_MASTER))
133+
{
134+
/* Process Locked */
135+
__HAL_LOCK(hi2c);
136+
@@ -4596,6 +4680,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Abort_IT(I2C_HandleTypeDef *hi2c, uint16_t DevA
137+
{
138+
/* Wrong usage of abort function */
139+
/* This function should be used only in case of abort monitored by master device */
140+
+ /* Or periphal is not in busy state, mean there is no active sequence to be abort */
141+
return HAL_ERROR;
142+
}
143+
}
144+
--
145+
2.25.1.windows.1
146+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
From d5815c606105adc2d390f9bac704934c923ea674 Mon Sep 17 00:00:00 2001
2+
From: Alexandre Bourdiol <[email protected]>
3+
Date: Tue, 28 Jan 2020 09:37:52 +0100
4+
Subject: [PATCH 1/1] [F2] I2C HAL fix: generate Start only once Stop is
5+
finished
6+
7+
---
8+
.../Src/stm32f2xx_hal_i2c.c | 87 ++++++++++++++++++-
9+
1 file changed, 86 insertions(+), 1 deletion(-)
10+
11+
diff --git a/system/Drivers/STM32F2xx_HAL_Driver/Src/stm32f2xx_hal_i2c.c b/system/Drivers/STM32F2xx_HAL_Driver/Src/stm32f2xx_hal_i2c.c
12+
index a8bcf8c5..4c7b5483 100644
13+
--- a/system/Drivers/STM32F2xx_HAL_Driver/Src/stm32f2xx_hal_i2c.c
14+
+++ b/system/Drivers/STM32F2xx_HAL_Driver/Src/stm32f2xx_hal_i2c.c
15+
@@ -3428,6 +3428,27 @@ HAL_StatusTypeDef HAL_I2C_Master_Seq_Transmit_IT(I2C_HandleTypeDef *hi2c, uint16
16+
while (__HAL_I2C_GET_FLAG(hi2c, I2C_FLAG_BUSY) != RESET);
17+
}
18+
19+
+ /* Before any new treatment like start or restart, check that there is no pending STOP request */
20+
+ /* Wait until STOP flag is reset */
21+
+ count = I2C_TIMEOUT_BUSY_FLAG * (SystemCoreClock / 25U / 1000U);
22+
+ do
23+
+ {
24+
+ count--;
25+
+ if (count == 0U)
26+
+ {
27+
+ hi2c->PreviousState = I2C_STATE_NONE;
28+
+ hi2c->State = HAL_I2C_STATE_READY;
29+
+ hi2c->Mode = HAL_I2C_MODE_NONE;
30+
+ hi2c->ErrorCode |= HAL_I2C_ERROR_TIMEOUT;
31+
+
32+
+ /* Process Unlocked */
33+
+ __HAL_UNLOCK(hi2c);
34+
+
35+
+ return HAL_ERROR;
36+
+ }
37+
+ }
38+
+ while (READ_BIT(hi2c->Instance->CR1, I2C_CR1_STOP) == I2C_CR1_STOP);
39+
+
40+
/* Process Locked */
41+
__HAL_LOCK(hi2c);
42+
43+
@@ -3527,6 +3548,27 @@ HAL_StatusTypeDef HAL_I2C_Master_Seq_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint1
44+
while (__HAL_I2C_GET_FLAG(hi2c, I2C_FLAG_BUSY) != RESET);
45+
}
46+
47+
+ /* Before any new treatment like start or restart, check that there is no pending STOP request */
48+
+ /* Wait until STOP flag is reset */
49+
+ count = I2C_TIMEOUT_BUSY_FLAG * (SystemCoreClock / 25U / 1000U);
50+
+ do
51+
+ {
52+
+ count--;
53+
+ if (count == 0U)
54+
+ {
55+
+ hi2c->PreviousState = I2C_STATE_NONE;
56+
+ hi2c->State = HAL_I2C_STATE_READY;
57+
+ hi2c->Mode = HAL_I2C_MODE_NONE;
58+
+ hi2c->ErrorCode |= HAL_I2C_ERROR_TIMEOUT;
59+
+
60+
+ /* Process Unlocked */
61+
+ __HAL_UNLOCK(hi2c);
62+
+
63+
+ return HAL_ERROR;
64+
+ }
65+
+ }
66+
+ while (READ_BIT(hi2c->Instance->CR1, I2C_CR1_STOP) == I2C_CR1_STOP);
67+
+
68+
/* Process Locked */
69+
__HAL_LOCK(hi2c);
70+
71+
@@ -3693,6 +3735,27 @@ HAL_StatusTypeDef HAL_I2C_Master_Seq_Receive_IT(I2C_HandleTypeDef *hi2c, uint16_
72+
while (__HAL_I2C_GET_FLAG(hi2c, I2C_FLAG_BUSY) != RESET);
73+
}
74+
75+
+ /* Before any new treatment like start or restart, check that there is no pending STOP request */
76+
+ /* Wait until STOP flag is reset */
77+
+ count = I2C_TIMEOUT_BUSY_FLAG * (SystemCoreClock / 25U / 1000U);
78+
+ do
79+
+ {
80+
+ count--;
81+
+ if (count == 0U)
82+
+ {
83+
+ hi2c->PreviousState = I2C_STATE_NONE;
84+
+ hi2c->State = HAL_I2C_STATE_READY;
85+
+ hi2c->Mode = HAL_I2C_MODE_NONE;
86+
+ hi2c->ErrorCode |= HAL_I2C_ERROR_TIMEOUT;
87+
+
88+
+ /* Process Unlocked */
89+
+ __HAL_UNLOCK(hi2c);
90+
+
91+
+ return HAL_ERROR;
92+
+ }
93+
+ }
94+
+ while (READ_BIT(hi2c->Instance->CR1, I2C_CR1_STOP) == I2C_CR1_STOP);
95+
+
96+
/* Process Locked */
97+
__HAL_LOCK(hi2c);
98+
99+
@@ -3818,6 +3881,27 @@ HAL_StatusTypeDef HAL_I2C_Master_Seq_Receive_DMA(I2C_HandleTypeDef *hi2c, uint16
100+
while (__HAL_I2C_GET_FLAG(hi2c, I2C_FLAG_BUSY) != RESET);
101+
}
102+
103+
+ /* Before any new treatment like start or restart, check that there is no pending STOP request */
104+
+ /* Wait until STOP flag is reset */
105+
+ count = I2C_TIMEOUT_BUSY_FLAG * (SystemCoreClock / 25U / 1000U);
106+
+ do
107+
+ {
108+
+ count--;
109+
+ if (count == 0U)
110+
+ {
111+
+ hi2c->PreviousState = I2C_STATE_NONE;
112+
+ hi2c->State = HAL_I2C_STATE_READY;
113+
+ hi2c->Mode = HAL_I2C_MODE_NONE;
114+
+ hi2c->ErrorCode |= HAL_I2C_ERROR_TIMEOUT;
115+
+
116+
+ /* Process Unlocked */
117+
+ __HAL_UNLOCK(hi2c);
118+
+
119+
+ return HAL_ERROR;
120+
+ }
121+
+ }
122+
+ while (READ_BIT(hi2c->Instance->CR1, I2C_CR1_STOP) == I2C_CR1_STOP);
123+
+
124+
/* Process Locked */
125+
__HAL_LOCK(hi2c);
126+
127+
@@ -4501,7 +4585,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Abort_IT(I2C_HandleTypeDef *hi2c, uint16_t DevA
128+
UNUSED(DevAddress);
129+
130+
/* Abort Master transfer during Receive or Transmit process */
131+
- if (hi2c->Mode == HAL_I2C_MODE_MASTER)
132+
+ if ((__HAL_I2C_GET_FLAG(hi2c, I2C_FLAG_BUSY) != RESET) && (hi2c->Mode == HAL_I2C_MODE_MASTER))
133+
{
134+
/* Process Locked */
135+
__HAL_LOCK(hi2c);
136+
@@ -4532,6 +4616,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Abort_IT(I2C_HandleTypeDef *hi2c, uint16_t DevA
137+
{
138+
/* Wrong usage of abort function */
139+
/* This function should be used only in case of abort monitored by master device */
140+
+ /* Or periphal is not in busy state, mean there is no active sequence to be abort */
141+
return HAL_ERROR;
142+
}
143+
}
144+
--
145+
2.25.1.windows.1
146+

0 commit comments

Comments
 (0)