Skip to content

Commit f6c0a36

Browse files
committed
Use automatic module definitions in blinky
1 parent e79233f commit f6c0a36

File tree

4 files changed

+35
-17
lines changed

4 files changed

+35
-17
lines changed

examples/blinky/CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ endif()
1919
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
2020

2121

22-
set(HAL_COMP_LIST RCC GPIO CORTEX)
22+
set(HAL_COMP_LIST RCC GPIO CORTEX FLASH)
2323
set(CMSIS_COMP_LIST "")
2424

2525
if(BLINKY_F4_EXAMPLE)
@@ -55,6 +55,7 @@ if(BLINKY_F4_EXAMPLE)
5555
target_link_libraries(stm32-blinky-f4
5656
HAL::STM32::F4::RCC
5757
HAL::STM32::F4::GPIO
58+
HAL::STM32::F4::FLASH
5859
HAL::STM32::F4::CORTEX
5960
CMSIS::STM32::F407VG
6061
STM32::NoSys
@@ -68,6 +69,7 @@ if(BLINKY_F1_EXAMPLE)
6869
target_link_libraries(stm32-blinky-f1
6970
HAL::STM32::F1::RCC
7071
HAL::STM32::F1::GPIO
72+
HAL::STM32::F1::FLASH
7173
HAL::STM32::F1::CORTEX
7274
CMSIS::STM32::F100RB
7375
STM32::NoSys
@@ -81,6 +83,7 @@ if(BLINKY_L0_EXAMPLE)
8183
target_link_libraries(stm32-blinky-l0
8284
HAL::STM32::L0::RCC
8385
HAL::STM32::L0::GPIO
86+
HAL::STM32::L0::FLASH
8487
HAL::STM32::L0::CORTEX
8588
CMSIS::STM32::L053C8
8689
STM32::NoSys

examples/blinky/stm32f1xx_hal_conf.h

+10-5
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,25 @@ extern "C" {
3333
/* ########################## Module Selection ############################## */
3434
/**
3535
* @brief This is the list of modules to be used in the HAL driver
36+
*
37+
* `stm32-cmake` automatically defines the `HAL_*_MODULE_ENABLED` variables
38+
* when a driver is added to a project using `target_link_libraries`, so they
39+
* don't need to be defined here
40+
*
3641
*/
3742
#define HAL_MODULE_ENABLED
3843
// #define HAL_ADC_MODULE_ENABLED
3944
// #define HAL_CAN_MODULE_ENABLED
4045
// #define HAL_CAN_LEGACY_MODULE_ENABLED
4146
// #define HAL_CEC_MODULE_ENABLED
42-
#define HAL_CORTEX_MODULE_ENABLED
47+
// #define HAL_CORTEX_MODULE_ENABLED
4348
// #define HAL_CRC_MODULE_ENABLED
4449
// #define HAL_DAC_MODULE_ENABLED
45-
#define HAL_DMA_MODULE_ENABLED
50+
// #define HAL_DMA_MODULE_ENABLED
4651
// #define HAL_ETH_MODULE_ENABLED
4752
// #define HAL_EXTI_MODULE_ENABLED
48-
#define HAL_FLASH_MODULE_ENABLED
49-
#define HAL_GPIO_MODULE_ENABLED
53+
// #define HAL_FLASH_MODULE_ENABLED
54+
// #define HAL_GPIO_MODULE_ENABLED
5055
// #define HAL_HCD_MODULE_ENABLED
5156
// #define HAL_I2C_MODULE_ENABLED
5257
// #define HAL_I2S_MODULE_ENABLED
@@ -57,7 +62,7 @@ extern "C" {
5762
// #define HAL_PCCARD_MODULE_ENABLED
5863
// #define HAL_PCD_MODULE_ENABLED
5964
// #define HAL_PWR_MODULE_ENABLED
60-
#define HAL_RCC_MODULE_ENABLED
65+
// #define HAL_RCC_MODULE_ENABLED
6166
// #define HAL_RTC_MODULE_ENABLED
6267
// #define HAL_SD_MODULE_ENABLED
6368
// #define HAL_SMARTCARD_MODULE_ENABLED

examples/blinky/stm32f4xx_hal_conf.h

+11-6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
/* ########################## Module Selection ############################## */
3434
/**
3535
* @brief This is the list of modules to be used in the HAL driver
36+
*
37+
* `stm32-cmake` automatically defines the `HAL_*_MODULE_ENABLED` variables
38+
* when a driver is added to a project using `target_link_libraries`, so they
39+
* don't need to be defined here
40+
*
3641
*/
3742
#define HAL_MODULE_ENABLED
3843
// #define HAL_ADC_MODULE_ENABLED
@@ -43,27 +48,27 @@
4348
// #define HAL_CRYP_MODULE_ENABLED
4449
// #define HAL_DAC_MODULE_ENABLED
4550
// #define HAL_DCMI_MODULE_ENABLED
46-
#define HAL_DMA_MODULE_ENABLED
51+
// #define HAL_DMA_MODULE_ENABLED
4752
// #define HAL_DMA2D_MODULE_ENABLED
4853
// #define HAL_ETH_MODULE_ENABLED
49-
#define HAL_FLASH_MODULE_ENABLED
54+
// #define HAL_FLASH_MODULE_ENABLED
5055
// #define HAL_NAND_MODULE_ENABLED
5156
// #define HAL_NOR_MODULE_ENABLED
5257
// #define HAL_PCCARD_MODULE_ENABLED
5358
// #define HAL_SRAM_MODULE_ENABLED
5459
// #define HAL_SDRAM_MODULE_ENABLED
5560
// #define HAL_HASH_MODULE_ENABLED
56-
#define HAL_GPIO_MODULE_ENABLED
61+
// #define HAL_GPIO_MODULE_ENABLED
5762
// #define HAL_EXTI_MODULE_ENABLED
5863
// #define HAL_I2C_MODULE_ENABLED
5964
// #define HAL_SMBUS_MODULE_ENABLED
6065
// #define HAL_I2S_MODULE_ENABLED
6166
// #define HAL_IWDG_MODULE_ENABLED
6267
// #define HAL_LTDC_MODULE_ENABLED
6368
// #define HAL_DSI_MODULE_ENABLED
64-
#define HAL_PWR_MODULE_ENABLED
69+
// #define HAL_PWR_MODULE_ENABLED
6570
// #define HAL_QSPI_MODULE_ENABLED
66-
#define HAL_RCC_MODULE_ENABLED
71+
// #define HAL_RCC_MODULE_ENABLED
6772
// #define HAL_RNG_MODULE_ENABLED
6873
// #define HAL_RTC_MODULE_ENABLED
6974
// #define HAL_SAI_MODULE_ENABLED
@@ -75,7 +80,7 @@
7580
// #define HAL_IRDA_MODULE_ENABLED
7681
// #define HAL_SMARTCARD_MODULE_ENABLED
7782
// #define HAL_WWDG_MODULE_ENABLED
78-
#define HAL_CORTEX_MODULE_ENABLED
83+
// #define HAL_CORTEX_MODULE_ENABLED
7984
// #define HAL_PCD_MODULE_ENABLED
8085
// #define HAL_HCD_MODULE_ENABLED
8186
// #define HAL_FMPI2C_MODULE_ENABLED

examples/blinky/stm32l0xx_hal_conf.h

+10-5
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,30 @@
3333
/* ########################## Module Selection ############################## */
3434
/**
3535
* @brief This is the list of modules to be used in the HAL driver
36+
*
37+
* `stm32-cmake` automatically defines the `HAL_*_MODULE_ENABLED` variables
38+
* when a driver is added to a project using `target_link_libraries`, so they
39+
* don't need to be defined here
40+
*
3641
*/
3742
#define HAL_MODULE_ENABLED
3843
// #define HAL_ADC_MODULE_ENABLED
3944
// #define HAL_COMP_MODULE_ENABLED
4045
// #define HAL_CRC_MODULE_ENABLED
4146
// #define HAL_CRYP_MODULE_ENABLED
4247
// #define HAL_DAC_MODULE_ENABLED
43-
#define HAL_DMA_MODULE_ENABLED
48+
// #define HAL_DMA_MODULE_ENABLED
4449
// #define HAL_EXTI_MODULE_ENABLED
4550
// #define HAL_FIREWALL_MODULE_ENABLED
46-
#define HAL_FLASH_MODULE_ENABLED
47-
#define HAL_GPIO_MODULE_ENABLED
51+
// #define HAL_FLASH_MODULE_ENABLED
52+
// #define HAL_GPIO_MODULE_ENABLED
4853
// #define HAL_I2C_MODULE_ENABLED
4954
// #define HAL_I2S_MODULE_ENABLED
5055
// #define HAL_IWDG_MODULE_ENABLED
5156
// #define HAL_LCD_MODULE_ENABLED
5257
// #define HAL_LPTIM_MODULE_ENABLED
5358
// #define HAL_PWR_MODULE_ENABLED
54-
#define HAL_RCC_MODULE_ENABLED
59+
// #define HAL_RCC_MODULE_ENABLED
5560
// #define HAL_RNG_MODULE_ENABLED
5661
// #define HAL_RTC_MODULE_ENABLED
5762
// #define HAL_SPI_MODULE_ENABLED
@@ -63,7 +68,7 @@
6368
// #define HAL_SMARTCARD_MODULE_ENABLED
6469
// #define HAL_SMBUS_MODULE_ENABLED
6570
// #define HAL_WWDG_MODULE_ENABLED
66-
#define HAL_CORTEX_MODULE_ENABLED
71+
// #define HAL_CORTEX_MODULE_ENABLED
6772
// #define HAL_PCD_MODULE_ENABLED
6873

6974
/* ########################## Oscillator Values adaptation ####################*/

0 commit comments

Comments
 (0)