Skip to content

Commit 0d8d3e0

Browse files
committed
STM32F4 Cube v1.19.0 update : ST HAL files
Previous version was v1.16.0
1 parent 4db8842 commit 0d8d3e0

File tree

184 files changed

+12024
-10822
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+12024
-10822
lines changed

targets/TARGET_STM/TARGET_STM32F4/device/Release_Notes_stm32f4xx_hal.html

Lines changed: 0 additions & 2210 deletions
This file was deleted.

targets/TARGET_STM/TARGET_STM32F4/device/stm32_hal_legacy.h

Lines changed: 379 additions & 245 deletions
Large diffs are not rendered by default.

targets/TARGET_STM/TARGET_STM32F4/device/stm32f4xx_hal.c

Lines changed: 91 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
******************************************************************************
33
* @file stm32f4xx_hal.c
44
* @author MCD Application Team
5-
* @version V1.7.1
6-
* @date 14-April-2017
75
* @brief HAL module driver.
86
* This is the common part of the HAL initialization
97
*
@@ -68,11 +66,11 @@
6866
* @{
6967
*/
7068
/**
71-
* @brief STM32F4xx HAL Driver version number V1.7.1
69+
* @brief STM32F4xx HAL Driver version number V1.7.3
7270
*/
7371
#define __STM32F4xx_HAL_VERSION_MAIN (0x01U) /*!< [31:24] main version */
7472
#define __STM32F4xx_HAL_VERSION_SUB1 (0x07U) /*!< [23:16] sub1 version */
75-
#define __STM32F4xx_HAL_VERSION_SUB2 (0x01U) /*!< [15:8] sub2 version */
73+
#define __STM32F4xx_HAL_VERSION_SUB2 (0x03U) /*!< [15:8] sub2 version */
7674
#define __STM32F4xx_HAL_VERSION_RC (0x00U) /*!< [7:0] release candidate */
7775
#define __STM32F4xx_HAL_VERSION ((__STM32F4xx_HAL_VERSION_MAIN << 24U)\
7876
|(__STM32F4xx_HAL_VERSION_SUB1 << 16U)\
@@ -86,19 +84,19 @@
8684
/* --- MEMRMP Register ---*/
8785
/* Alias word address of UFB_MODE bit */
8886
#define MEMRMP_OFFSET SYSCFG_OFFSET
89-
#define UFB_MODE_BIT_NUMBER POSITION_VAL(SYSCFG_MEMRMP_UFB_MODE)
87+
#define UFB_MODE_BIT_NUMBER SYSCFG_MEMRMP_UFB_MODE_Pos
9088
#define UFB_MODE_BB (uint32_t)(PERIPH_BB_BASE + (MEMRMP_OFFSET * 32U) + (UFB_MODE_BIT_NUMBER * 4U))
9189

9290
/* --- CMPCR Register ---*/
9391
/* Alias word address of CMP_PD bit */
9492
#define CMPCR_OFFSET (SYSCFG_OFFSET + 0x20U)
95-
#define CMP_PD_BIT_NUMBER POSITION_VAL(SYSCFG_CMPCR_CMP_PD)
93+
#define CMP_PD_BIT_NUMBER SYSCFG_CMPCR_CMP_PD_Pos
9694
#define CMPCR_CMP_PD_BB (uint32_t)(PERIPH_BB_BASE + (CMPCR_OFFSET * 32U) + (CMP_PD_BIT_NUMBER * 4U))
9795

9896
/* --- MCHDLYCR Register ---*/
9997
/* Alias word address of BSCKSEL bit */
10098
#define MCHDLYCR_OFFSET (SYSCFG_OFFSET + 0x30U)
101-
#define BSCKSEL_BIT_NUMBER POSITION_VAL(SYSCFG_MCHDLYCR_BSCKSEL)
99+
#define BSCKSEL_BIT_NUMBER SYSCFG_MCHDLYCR_BSCKSEL_Pos
102100
#define MCHDLYCR_BSCKSEL_BB (uint32_t)(PERIPH_BB_BASE + (MCHDLYCR_OFFSET * 32U) + (BSCKSEL_BIT_NUMBER * 4U))
103101
/**
104102
* @}
@@ -110,6 +108,8 @@
110108
* @{
111109
*/
112110
__IO uint32_t uwTick;
111+
uint32_t uwTickPrio = (1UL << __NVIC_PRIO_BITS); /* Invalid PRIO */
112+
HAL_TickFreqTypeDef uwTickFreq = HAL_TICK_FREQ_DEFAULT; /* 1KHz */
113113
/**
114114
* @}
115115
*/
@@ -125,16 +125,16 @@ __IO uint32_t uwTick;
125125
*
126126
@verbatim
127127
===============================================================================
128-
##### Initialization and de-initialization functions #####
128+
##### Initialization and Configuration functions #####
129129
===============================================================================
130130
[..] This section provides functions allowing to:
131131
(+) Initializes the Flash interface the NVIC allocation and initial clock
132132
configuration. It initializes the systick also when timeout is needed
133133
and the backup domain when enabled.
134-
(+) de-Initializes common part of the HAL
135-
(+) Configure The time base source to have 1ms time base with a dedicated
134+
(+) De-Initializes common part of the HAL.
135+
(+) Configure the time base source to have 1ms time base with a dedicated
136136
Tick interrupt priority.
137-
(++) Systick timer is used by default as source of time base, but user
137+
(++) SysTick timer is used by default as source of time base, but user
138138
can eventually implement his proper time base source (a general purpose
139139
timer for example or other time source), keeping in mind that Time base
140140
duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
@@ -174,23 +174,29 @@ HAL_StatusTypeDef HAL_Init(void)
174174
{
175175
/* Configure Flash prefetch, Instruction cache, Data cache */
176176
#if (INSTRUCTION_CACHE_ENABLE != 0U)
177-
__HAL_FLASH_INSTRUCTION_CACHE_ENABLE();
177+
__HAL_FLASH_INSTRUCTION_CACHE_ENABLE();
178178
#endif /* INSTRUCTION_CACHE_ENABLE */
179179

180180
#if (DATA_CACHE_ENABLE != 0U)
181-
__HAL_FLASH_DATA_CACHE_ENABLE();
181+
__HAL_FLASH_DATA_CACHE_ENABLE();
182182
#endif /* DATA_CACHE_ENABLE */
183183

184184
#if (PREFETCH_ENABLE != 0U)
185185
__HAL_FLASH_PREFETCH_BUFFER_ENABLE();
186186
#endif /* PREFETCH_ENABLE */
187187

188+
/* Set Interrupt Group Priority */
189+
/* MBED : moved to HAL_InitPre() */
190+
#if !defined (TARGET_STM32F429xI)
191+
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
192+
#endif
193+
188194
/* Use systick as time base source and configure 1ms tick (default clock after Reset is HSI) */
189195
HAL_InitTick(TICK_INT_PRIORITY);
190-
196+
191197
/* Init the low level hardware */
192198
HAL_MspInit();
193-
199+
194200
/* Return function status */
195201
return HAL_OK;
196202
}
@@ -226,12 +232,12 @@ HAL_StatusTypeDef HAL_DeInit(void)
226232
}
227233

228234
/**
229-
* @brief Initializes the MSP.
235+
* @brief Initialize the MSP.
230236
* @retval None
231237
*/
232238
__weak void HAL_MspInit(void)
233239
{
234-
/* NOTE : This function Should not be modified, when the callback is needed,
240+
/* NOTE : This function should not be modified, when the callback is needed,
235241
the HAL_MspInit could be implemented in the user file
236242
*/
237243
}
@@ -242,7 +248,7 @@ __weak void HAL_MspInit(void)
242248
*/
243249
__weak void HAL_MspDeInit(void)
244250
{
245-
/* NOTE : This function Should not be modified, when the callback is needed,
251+
/* NOTE : This function should not be modified, when the callback is needed,
246252
the HAL_MspDeInit could be implemented in the user file
247253
*/
248254
}
@@ -256,20 +262,31 @@ __weak void HAL_MspDeInit(void)
256262
* @note In the default implementation, SysTick timer is the source of time base.
257263
* It is used to generate interrupts at regular time intervals.
258264
* Care must be taken if HAL_Delay() is called from a peripheral ISR process,
259-
* The the SysTick interrupt must have higher priority (numerically lower)
265+
* The SysTick interrupt must have higher priority (numerically lower)
260266
* than the peripheral interrupt. Otherwise the caller ISR process will be blocked.
261267
* The function is declared as __weak to be overwritten in case of other
262268
* implementation in user file.
263-
* @param TickPriority: Tick interrupt priority.
269+
* @param TickPriority Tick interrupt priority.
264270
* @retval HAL status
265271
*/
266272
__weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
267273
{
268-
/*Configure the SysTick to have interrupt in 1ms time basis*/
269-
HAL_SYSTICK_Config(SystemCoreClock/1000U);
274+
/* Configure the SysTick to have interrupt in 1ms time basis*/
275+
if (HAL_SYSTICK_Config(SystemCoreClock / (1000U / uwTickFreq)) > 0U)
276+
{
277+
return HAL_ERROR;
278+
}
270279

271-
/*Configure the SysTick IRQ priority */
272-
HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority, 0U);
280+
/* Configure the SysTick IRQ priority */
281+
if (TickPriority < (1UL << __NVIC_PRIO_BITS))
282+
{
283+
HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority, 0U);
284+
uwTickPrio = TickPriority;
285+
}
286+
else
287+
{
288+
return HAL_ERROR;
289+
}
273290

274291
/* Return function status */
275292
return HAL_OK;
@@ -306,14 +323,14 @@ __weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
306323
* @brief This function is called to increment a global variable "uwTick"
307324
* used as application time base.
308325
* @note In the default implementation, this variable is incremented each 1ms
309-
* in Systick ISR.
326+
* in SysTick ISR.
310327
* @note This function is declared as __weak to be overwritten in case of other
311328
* implementations in user file.
312329
* @retval None
313330
*/
314331
__weak void HAL_IncTick(void)
315332
{
316-
uwTick++;
333+
uwTick += uwTickFreq;
317334
}
318335

319336
/**
@@ -327,6 +344,44 @@ __weak uint32_t HAL_GetTick(void)
327344
return uwTick;
328345
}
329346

347+
/**
348+
* @brief This function returns a tick priority.
349+
* @retval tick priority
350+
*/
351+
uint32_t HAL_GetTickPrio(void)
352+
{
353+
return uwTickPrio;
354+
}
355+
356+
/**
357+
* @brief Set new tick Freq.
358+
* @retval Status
359+
*/
360+
HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq)
361+
{
362+
HAL_StatusTypeDef status = HAL_OK;
363+
assert_param(IS_TICKFREQ(Freq));
364+
365+
if (uwTickFreq != Freq)
366+
{
367+
uwTickFreq = Freq;
368+
369+
/* Apply the new tick Freq */
370+
status = HAL_InitTick(uwTickPrio);
371+
}
372+
373+
return status;
374+
}
375+
376+
/**
377+
* @brief Return tick frequency.
378+
* @retval tick period in Hz
379+
*/
380+
HAL_TickFreqTypeDef HAL_GetTickFreq(void)
381+
{
382+
return uwTickFreq;
383+
}
384+
330385
/**
331386
* @brief This function provides minimum delay (in milliseconds) based
332387
* on variable incremented.
@@ -335,20 +390,20 @@ __weak uint32_t HAL_GetTick(void)
335390
* is incremented.
336391
* @note This function is declared as __weak to be overwritten in case of other
337392
* implementations in user file.
338-
* @param Delay: specifies the delay time length, in milliseconds.
393+
* @param Delay specifies the delay time length, in milliseconds.
339394
* @retval None
340395
*/
341-
__weak void HAL_Delay(__IO uint32_t Delay)
396+
__weak void HAL_Delay(uint32_t Delay)
342397
{
343398
uint32_t tickstart = HAL_GetTick();
344399
uint32_t wait = Delay;
345-
346-
/* Add a period to guarantee minimum wait */
400+
401+
/* Add a freq to guarantee minimum wait */
347402
if (wait < HAL_MAX_DELAY)
348403
{
349-
wait++;
404+
wait += (uint32_t)(uwTickFreq);
350405
}
351-
406+
352407
while((HAL_GetTick() - tickstart) < wait)
353408
{
354409
}
@@ -392,7 +447,7 @@ __weak void HAL_ResumeTick(void)
392447
*/
393448
uint32_t HAL_GetHalVersion(void)
394449
{
395-
return __STM32F4xx_HAL_VERSION;
450+
return __STM32F4xx_HAL_VERSION;
396451
}
397452

398453
/**
@@ -401,7 +456,7 @@ uint32_t HAL_GetHalVersion(void)
401456
*/
402457
uint32_t HAL_GetREVID(void)
403458
{
404-
return((DBGMCU->IDCODE) >> 16U);
459+
return((DBGMCU->IDCODE) >> 16U);
405460
}
406461

407462
/**
@@ -410,7 +465,7 @@ uint32_t HAL_GetREVID(void)
410465
*/
411466
uint32_t HAL_GetDEVID(void)
412467
{
413-
return((DBGMCU->IDCODE) & IDCODE_DEVID_MASK);
468+
return((DBGMCU->IDCODE) & IDCODE_DEVID_MASK);
414469
}
415470

416471
/**
@@ -491,7 +546,7 @@ void HAL_DisableCompensationCell(void)
491546

492547
/**
493548
* @brief Return the unique device identifier (UID based on 96 bits)
494-
* @param UID: pointer to 3 words array.
549+
* @param UID pointer to 3 words array.
495550
* @retval Device identifier
496551
*/
497552
void HAL_GetUID(uint32_t *UID)
@@ -530,7 +585,6 @@ void HAL_EnableMemorySwappingBank(void)
530585
*/
531586
void HAL_DisableMemorySwappingBank(void)
532587
{
533-
534588
*(__IO uint32_t *)UFB_MODE_BB = (uint32_t)DISABLE;
535589
}
536590
#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */

targets/TARGET_STM/TARGET_STM32F4/device/stm32f4xx_hal.h

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
******************************************************************************
33
* @file stm32f4xx_hal.h
44
* @author MCD Application Team
5-
* @version V1.7.1
6-
* @date 14-April-2017
75
* @brief This file contains all the functions prototypes for the HAL
86
* module driver.
97
******************************************************************************
@@ -58,6 +56,28 @@
5856
/* Exported types ------------------------------------------------------------*/
5957
/* Exported constants --------------------------------------------------------*/
6058

59+
/** @defgroup HAL_Exported_Constants HAL Exported Constants
60+
* @{
61+
*/
62+
63+
/** @defgroup HAL_TICK_FREQ Tick Frequency
64+
* @{
65+
*/
66+
typedef enum
67+
{
68+
HAL_TICK_FREQ_10HZ = 100U,
69+
HAL_TICK_FREQ_100HZ = 10U,
70+
HAL_TICK_FREQ_1KHZ = 1U,
71+
HAL_TICK_FREQ_DEFAULT = HAL_TICK_FREQ_1KHZ
72+
} HAL_TickFreqTypeDef;
73+
/**
74+
* @}
75+
*/
76+
77+
/**
78+
* @}
79+
*/
80+
6181
/* Exported macro ------------------------------------------------------------*/
6282
/** @defgroup HAL_Exported_Macros HAL Exported Macros
6383
* @{
@@ -183,15 +203,24 @@
183203
* @}
184204
*/
185205

206+
/** @defgroup HAL_Private_Macros HAL Private Macros
207+
* @{
208+
*/
209+
#define IS_TICKFREQ(FREQ) (((FREQ) == HAL_TICK_FREQ_10HZ) || \
210+
((FREQ) == HAL_TICK_FREQ_100HZ) || \
211+
((FREQ) == HAL_TICK_FREQ_1KHZ))
212+
/**
213+
* @}
214+
*/
215+
186216
/* Exported functions --------------------------------------------------------*/
187217
/** @addtogroup HAL_Exported_Functions
188218
* @{
189219
*/
190220
/** @addtogroup HAL_Exported_Functions_Group1
191221
* @{
192222
*/
193-
/* Initialization and de-initialization functions ******************************/
194-
HAL_StatusTypeDef HAL_InitPre(void);
223+
/* Initialization and Configuration functions ******************************/
195224
HAL_StatusTypeDef HAL_Init(void);
196225
HAL_StatusTypeDef HAL_DeInit(void);
197226
void HAL_MspInit(void);
@@ -206,8 +235,11 @@ HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority);
206235
*/
207236
/* Peripheral Control functions ************************************************/
208237
void HAL_IncTick(void);
209-
void HAL_Delay(__IO uint32_t Delay);
238+
void HAL_Delay(uint32_t Delay);
210239
uint32_t HAL_GetTick(void);
240+
uint32_t HAL_GetTickPrio(void);
241+
HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq);
242+
HAL_TickFreqTypeDef HAL_GetTickFreq(void);
211243
void HAL_SuspendTick(void);
212244
void HAL_ResumeTick(void);
213245
uint32_t HAL_GetHalVersion(void);

0 commit comments

Comments
 (0)