Skip to content

Commit a0b033c

Browse files
committed
Default STM32 HAL configuration
Before each variants had to include the STM32 HAL configuration file: stm32yyxx_hal_conf.h. Those files were almost the same for the same series. With a default one per series this avoid to add it to the variant. Extra HAL module can be enabled in variant.h if required or in a file named (at sketch level): `hal_conf_extra.h` Custom HAL configuration file can replace the default one by adding a file named (at sketch level): `hal_conf_custom.h` . Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
1 parent af10a0e commit a0b033c

File tree

94 files changed

+2309
-17262
lines changed

Some content is hidden

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

94 files changed

+2309
-17262
lines changed

system/STM32F0xx/stm32f0xx_hal_conf.h

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef __STM32F0xx_HAL_CONF_H
2+
#define __STM32F0xx_HAL_CONF_H
3+
4+
#include "variant.h"
5+
6+
/* STM32F0xx specific HAL configuration options. */
7+
#if __has_include("hal_conf_custom.h")
8+
#include "hal_conf_custom.h"
9+
#else
10+
#if __has_include("hal_conf_extra.h")
11+
#include "hal_conf_extra.h"
12+
#endif
13+
#include "stm32f0xx_hal_conf_default.h"
14+
#endif
15+
16+
#endif /* __STM32F0xx_HAL_CONF_H */

variants/DEMO_F030F4/stm32f0xx_hal_conf.h renamed to system/STM32F0xx/stm32f0xx_hal_conf_default.h

+21-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/**
22
******************************************************************************
3-
* @file stm32f0xx_hal_conf.h
4-
* @author MCD Application Team
5-
* @brief HAL configuration file.
3+
* @file stm32f0xx_hal_conf_default.h
4+
* @brief HAL defalt configuration file.
65
******************************************************************************
76
* @attention
87
*
@@ -34,8 +33,8 @@
3433
*/
3534

3635
/* Define to prevent recursive inclusion -------------------------------------*/
37-
#ifndef __STM32F0xx_HAL_CONF_H
38-
#define __STM32F0xx_HAL_CONF_H
36+
#ifndef __STM32F0xx_HAL_CONF_DEFAULT_H
37+
#define __STM32F0xx_HAL_CONF_DEFAULT_H
3938

4039
#ifdef __cplusplus
4140
extern "C" {
@@ -54,19 +53,19 @@ extern "C" {
5453
/*#define HAL_CEC_MODULE_ENABLED*/
5554
/*#define HAL_COMP_MODULE_ENABLED*/
5655
#define HAL_CORTEX_MODULE_ENABLED
57-
#define HAL_CRC_MODULE_ENABLED
56+
/*#define HAL_CRC_MODULE_ENABLED*/
5857
/*#define HAL_DAC_MODULE_ENABLED*/
5958
#define HAL_DMA_MODULE_ENABLED
6059
#define HAL_FLASH_MODULE_ENABLED
6160
#define HAL_GPIO_MODULE_ENABLED
6261
#define HAL_I2C_MODULE_ENABLED
6362
/*#define HAL_I2S_MODULE_ENABLED*/
6463
/*#define HAL_IRDA_MODULE_ENABLED*/
65-
#define HAL_IWDG_MODULE_ENABLED
64+
/*#define HAL_IWDG_MODULE_ENABLED*/
6665
/*#define HAL_PCD_MODULE_ENABLED*/
67-
/*#define HAL_PWR_MODULE_ENABLED*/
66+
#define HAL_PWR_MODULE_ENABLED
6867
#define HAL_RCC_MODULE_ENABLED
69-
/*#define HAL_RTC_MODULE_ENABLED*/
68+
#define HAL_RTC_MODULE_ENABLED
7069
/*#define HAL_SMARTCARD_MODULE_ENABLED*/
7170
/*#define HAL_SMBUS_MODULE_ENABLED*/
7271
#define HAL_SPI_MODULE_ENABLED
@@ -160,14 +159,24 @@ in voltage and temperature. */
160159
* @brief This is the HAL system configuration section
161160
*/
162161
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
162+
#if !defined (TICK_INT_PRIORITY)
163163
#define TICK_INT_PRIORITY ((uint32_t)(1U<<__NVIC_PRIO_BITS) - 1U) /*!< tick interrupt priority (lowest by default) */
164-
/* Warning: Must be set to higher priority for HAL_Delay() */
165-
/* and HAL_GetTick() usage under interrupt context */
164+
#endif
165+
#if !defined (USE_RTOS)
166166
#define USE_RTOS 0U
167+
#endif
168+
#if !defined (PREFETCH_ENABLE)
167169
#define PREFETCH_ENABLE 1U
170+
#endif
171+
#if !defined (INSTRUCTION_CACHE_ENABLE)
168172
#define INSTRUCTION_CACHE_ENABLE 0U
173+
#endif
174+
#if !defined (DATA_CACHE_ENABLE)
169175
#define DATA_CACHE_ENABLE 0U
176+
#endif
177+
#if !defined (USE_SPI_CRC)
170178
#define USE_SPI_CRC 0U
179+
#endif
171180

172181
/* ########################## Assert Selection ############################## */
173182
/**
@@ -306,7 +315,7 @@ void assert_failed(char *file, uint32_t line);
306315
}
307316
#endif
308317

309-
#endif /* __STM32F0xx_HAL_CONF_H */
318+
#endif /* __STM32F0xx_HAL_CONF_DEFAULT_H */
310319

311320

312321
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

system/STM32F1xx/stm32f1xx_hal_conf.h

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef __STM32F1xx_HAL_CONF_H
2+
#define __STM32F1xx_HAL_CONF_H
3+
4+
#include "variant.h"
5+
6+
/* STM32F1xx specific HAL configuration options. */
7+
#if __has_include("hal_conf_custom.h")
8+
#include "hal_conf_custom.h"
9+
#else
10+
#if __has_include("hal_conf_extra.h")
11+
#include "hal_conf_extra.h"
12+
#endif
13+
#include "stm32f1xx_hal_conf_default.h"
14+
#endif
15+
16+
#endif /* __STM32F1xx_HAL_CONF_H */

variants/MAPLEMINI_F103CB/stm32f1xx_hal_conf.h renamed to system/STM32F1xx/stm32f1xx_hal_conf_default.h

+19-14
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
/**
22
******************************************************************************
3-
* @file stm32f1xx_hal_conf.h
4-
* @author MCD Application Team
5-
* @brief HAL configuration template file.
6-
* This file should be copied to the application folder and renamed
7-
* to stm32f1xx_hal_conf.h.
3+
* @file stm32f1xx_hal_conf_default.h
4+
* @brief HAL default configuration file.
85
******************************************************************************
96
* @attention
107
*
@@ -36,8 +33,8 @@
3633
*/
3734

3835
/* Define to prevent recursive inclusion -------------------------------------*/
39-
#ifndef __STM32F1xx_HAL_CONF_H
40-
#define __STM32F1xx_HAL_CONF_H
36+
#ifndef __STM32F1xx_HAL_CONF_DEFAULT_H
37+
#define __STM32F1xx_HAL_CONF_DEFAULT_H
4138

4239
#ifdef __cplusplus
4340
extern "C" {
@@ -82,7 +79,7 @@ extern "C" {
8279
/*#define HAL_UART_MODULE_ENABLED*/
8380
/*#define HAL_USART_MODULE_ENABLED*/
8481
/*#define HAL_WWDG_MODULE_ENABLED*/
85-
#define HAL_MMC_MODULE_ENABLED
82+
/*#define HAL_MMC_MODULE_ENABLED*/
8683

8784
/* ########################## Oscillator Values adaptation ####################*/
8885
/**
@@ -117,8 +114,8 @@ extern "C" {
117114
#if !defined (LSI_VALUE)
118115
#define LSI_VALUE 40000U /*!< LSI Typical Value in Hz */
119116
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
120-
The real value may vary depending on the variations
121-
in voltage and temperature. */
117+
The real value may vary depending on the variations
118+
in voltage and temperature. */
122119
/**
123120
* @brief External Low Speed oscillator (LSE) value.
124121
* This value is used by the UART, RTC HAL module to compute the system frequency
@@ -139,9 +136,15 @@ in voltage and temperature. */
139136
* @brief This is the HAL system configuration section
140137
*/
141138
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
139+
#if !defined (TICK_INT_PRIORITY)
142140
#define TICK_INT_PRIORITY 0x0FU /*!< tick interrupt priority */
141+
#endif
142+
#if !defined (USE_RTOS)
143143
#define USE_RTOS 0U
144+
#endif
145+
#if !defined (PREFETCH_ENABLE)
144146
#define PREFETCH_ENABLE 1U
147+
#endif
145148

146149
/* ########################## Assert Selection ############################## */
147150
/**
@@ -222,8 +225,9 @@ in voltage and temperature. */
222225
* Activated: CRC code is present inside driver
223226
* Deactivated: CRC code cleaned from driver
224227
*/
225-
226-
#define USE_SPI_CRC 1U
228+
#if !defined (USE_SPI_CRC)
229+
#define USE_SPI_CRC 0U
230+
#endif
227231

228232
/* Includes ------------------------------------------------------------------*/
229233
/**
@@ -251,7 +255,7 @@ in voltage and temperature. */
251255
#endif /* HAL_CAN_MODULE_ENABLED */
252256

253257
#ifdef HAL_CAN_LEGACY_MODULE_ENABLED
254-
#include "Legacy/stm32f1xx_hal_can_legacy.h"
258+
#include "Legacy/stm32f1xx_hal_can_legacy.h"
255259
#endif /* HAL_CAN_LEGACY_MODULE_ENABLED */
256260

257261
#ifdef HAL_CEC_MODULE_ENABLED
@@ -375,11 +379,12 @@ void assert_failed(uint8_t *file, uint32_t line);
375379
#define assert_param(expr) ((void)0U)
376380
#endif /* USE_FULL_ASSERT */
377381

382+
378383
#ifdef __cplusplus
379384
}
380385
#endif
381386

382-
#endif /* __STM32F1xx_HAL_CONF_H */
387+
#endif /* __STM32F1xx_HAL_CONF_DEFAULT_H */
383388

384389

385390
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

system/STM32F2xx/stm32f2xx_hal_conf.h

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef __STM32F2xx_HAL_CONF_H
2+
#define __STM32F2xx_HAL_CONF_H
3+
4+
#include "variant.h"
5+
6+
/* STM32F2xx specific HAL configuration options. */
7+
#if __has_include("hal_conf_custom.h")
8+
#include "hal_conf_custom.h"
9+
#else
10+
#if __has_include("hal_conf_extra.h")
11+
#include "hal_conf_extra.h"
12+
#endif
13+
#include "stm32f2xx_hal_conf_default.h"
14+
#endif
15+
16+
#endif /* __STM32F2xx_HAL_CONF_H */

0 commit comments

Comments
 (0)