Skip to content

Commit a984c84

Browse files
committed
[USB] HAL PCD management
Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 4067d7e commit a984c84

File tree

11 files changed

+43
-34
lines changed

11 files changed

+43
-34
lines changed

cores/arduino/stm32/usb/usbd_conf.c

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#ifdef USBCON
2020
/* Includes ------------------------------------------------------------------*/
2121
#include "usbd_core.h"
22+
23+
#ifndef HAL_PCD_MODULE_ENABLED
24+
#error "HAL_PCD_MODULE_ENABLED is required"
25+
#else
2226
/* Private typedef -----------------------------------------------------------*/
2327
/* Private define ------------------------------------------------------------*/
2428
/* Private macro -------------------------------------------------------------*/
@@ -647,6 +651,7 @@ void USBD_LL_Delay(uint32_t Delay)
647651
{
648652
HAL_Delay(Delay);
649653
}
654+
#endif /* HAL_PCD_MODULE_ENABLED */
650655
#endif /* USBCON */
651656
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
652657

platform.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.3.0.path}/CMSIS/Lib/GCC/" -
6767

6868
# USB Flags
6969
# ---------
70-
build.usb_flags=-DUSBCON -DUSBD_VID={build.vid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT="{build.board}"'
70+
build.usb_flags=-DUSBCON -DUSBD_VID={build.vid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT="{build.board}"' -DHAL_PCD_MODULE_ENABLED
7171

7272
# Default usb manufacturer will be replaced at compile time using
7373
# numeric vendor ID if available or by board's specific value.

variants/ARMED_V1/stm32f4xx_hal_conf.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@
8787
/* #define HAL_SMARTCARD_MODULE_ENABLED */
8888
/* #define HAL_WWDG_MODULE_ENABLED */
8989
#define HAL_CORTEX_MODULE_ENABLED
90-
#define HAL_PCD_MODULE_ENABLED
91-
#define HAL_HCD_MODULE_ENABLED
90+
/* #define HAL_PCD_MODULE_ENABLED */
91+
/* #define HAL_HCD_MODULE_ENABLED */
9292
/* #define HAL_FMPI2C_MODULE_ENABLED */
9393
/* #define HAL_SPDIFRX_MODULE_ENABLED */
9494
/* #define HAL_DFSDM_MODULE_ENABLED */

variants/DISCO_F407VG/stm32f4xx_hal_conf.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@
8787
/* #define HAL_SMARTCARD_MODULE_ENABLED */
8888
/* #define HAL_WWDG_MODULE_ENABLED */
8989
#define HAL_CORTEX_MODULE_ENABLED
90-
#define HAL_PCD_MODULE_ENABLED
91-
#define HAL_HCD_MODULE_ENABLED
90+
/* #define HAL_PCD_MODULE_ENABLED */
91+
/* #define HAL_HCD_MODULE_ENABLED */
9292
/* #define HAL_FMPI2C_MODULE_ENABLED */
9393
/* #define HAL_SPDIFRX_MODULE_ENABLED */
9494
/* #define HAL_DFSDM_MODULE_ENABLED */

variants/DISCO_F746NG/stm32f7xx_hal_conf.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@
9090
/* #define HAL_SMARTCARD_MODULE_ENABLED */
9191
/* #define HAL_WWDG_MODULE_ENABLED */
9292
#define HAL_CORTEX_MODULE_ENABLED
93-
#define HAL_PCD_MODULE_ENABLED
94-
#define HAL_HCD_MODULE_ENABLED
93+
/* #define HAL_PCD_MODULE_ENABLED */
94+
/* #define HAL_HCD_MODULE_ENABLED */
9595
/* #define HAL_DFSDM_MODULE_ENABLED */
9696
/* #define HAL_DSI_MODULE_ENABLED */
9797
/* #define HAL_JPEG_MODULE_ENABLED */

variants/DISCO_L475VG_IOT/stm32l4xx_hal_conf.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
#define HAL_FLASH_MODULE_ENABLED
6969
/* #define HAL_GFXMMU_MODULE_ENABLED */
7070
/* #define HAL_HASH_MODULE_ENABLED */
71-
#define HAL_HCD_MODULE_ENABLED
71+
/* #define HAL_HCD_MODULE_ENABLED */
7272
/* #define HAL_NAND_MODULE_ENABLED */
7373
/* #define HAL_NOR_MODULE_ENABLED */
7474
/* #define HAL_SRAM_MODULE_ENABLED */
@@ -81,7 +81,7 @@
8181
/* #define HAL_LTDC_MODULE_ENABLED */
8282
/* #define HAL_OPAMP_MODULE_ENABLED */
8383
/* #define HAL_OSPI_MODULE_ENABLED */
84-
#define HAL_PCD_MODULE_ENABLED
84+
/* #define HAL_PCD_MODULE_ENABLED */
8585
#define HAL_PWR_MODULE_ENABLED
8686
#define HAL_QSPI_MODULE_ENABLED
8787
#define HAL_RCC_MODULE_ENABLED

variants/NUCLEO_F207ZG/stm32f2xx_hal_conf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
/*#define HAL_SMARTCARD_MODULE_ENABLED */
8080
/*#define HAL_WWDG_MODULE_ENABLED */
8181
#define HAL_CORTEX_MODULE_ENABLED
82-
#define HAL_PCD_MODULE_ENABLED
82+
/* #define HAL_PCD_MODULE_ENABLED */
8383
/*#define HAL_HCD_MODULE_ENABLED */
8484
#define HAL_MMC_MODULE_ENABLED
8585

variants/NUCLEO_F429ZI/stm32f4xx_hal_conf.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@
8787
/* #define HAL_SMARTCARD_MODULE_ENABLED */
8888
/* #define HAL_WWDG_MODULE_ENABLED */
8989
#define HAL_CORTEX_MODULE_ENABLED
90-
#define HAL_PCD_MODULE_ENABLED
91-
#define HAL_HCD_MODULE_ENABLED
90+
/* #define HAL_PCD_MODULE_ENABLED */
91+
/* #define HAL_HCD_MODULE_ENABLED */
9292
/* #define HAL_FMPI2C_MODULE_ENABLED */
9393
/* #define HAL_SPDIFRX_MODULE_ENABLED */
9494
/* #define HAL_DFSDM_MODULE_ENABLED */

variants/NUCLEO_F767ZI/stm32f7xx_hal_conf.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@
8787
/* #define HAL_SMARTCARD_MODULE_ENABLED */
8888
/* #define HAL_WWDG_MODULE_ENABLED */
8989
#define HAL_CORTEX_MODULE_ENABLED
90-
#define HAL_PCD_MODULE_ENABLED
91-
#define HAL_HCD_MODULE_ENABLED
90+
/* #define HAL_PCD_MODULE_ENABLED */
91+
/* #define HAL_HCD_MODULE_ENABLED */
9292
/* #define HAL_DFSDM_MODULE_ENABLED */
9393
/* #define HAL_DSI_MODULE_ENABLED */
9494
/* #define HAL_JPEG_MODULE_ENABLED */

variants/REMRAM_V1/stm32f7xx_hal_conf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
/* #define HAL_IRDA_MODULE_ENABLED */
8383
/* #define HAL_SMARTCARD_MODULE_ENABLED */
8484
/* #define HAL_WWDG_MODULE_ENABLED */
85-
#define HAL_PCD_MODULE_ENABLED
85+
/* #define HAL_PCD_MODULE_ENABLED */
8686
/* #define HAL_HCD_MODULE_ENABLED */
8787
/* #define HAL_DFSDM_MODULE_ENABLED */
8888
/* #define HAL_DSI_MODULE_ENABLED */
+23-19
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
/*
2-
* Copy the STM32 HAL config file from the targeted MCU Series HAL
3-
* from ../../system/Drivers/STM32YYxx_HAL_Driver/Inc/stm32yyxx_hal_conf_template.h
4-
* to
5-
* stm32yyxx_hal_conf.h
6-
* where 'yy' could be f0, f1, f2, f3, f4, f7, h7, l0, l1, l4)
7-
*
8-
* Example for a STM32 F4 based board:
9-
* cp ../../system/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_conf_template.h stm32f4xx_hal_conf.h
10-
*
11-
* Then edit it in order to:
12-
* - Disable undesired HAL modules by commenting line like:
13-
* "#define HAL_XXX_MODULE_ENABLED"
14-
* where "XXX" is the feature (ETH, I2S,...)
15-
* - Adjust HSE/HSI Values adaptation if needed
16-
* - Update any other configurations
17-
*
18-
* Note: disabled HAL_UART_MODULE_ENABLED, it is handled thanks Arduino menu (enabled by default)
19-
*/
1+
/*
2+
* Copy the STM32 HAL config file from the targeted MCU Series HAL
3+
* from ../../system/Drivers/STM32YYxx_HAL_Driver/Inc/stm32yyxx_hal_conf_template.h
4+
* to
5+
* stm32yyxx_hal_conf.h
6+
* where 'yy' could be f0, f1, f2, f3, f4, f7, h7, l0, l1, l4)
7+
*
8+
* Example for a STM32 F4 based board:
9+
* cp ../../system/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_conf_template.h stm32f4xx_hal_conf.h
10+
*
11+
* Then edit it in order to:
12+
* - Disable undesired HAL modules by commenting line like:
13+
* "#define HAL_XXX_MODULE_ENABLED"
14+
* where "XXX" is the feature (ETH, I2S,...)
15+
* - Adjust HSE/HSI Values adaptation if needed
16+
* - Update any other configurations
17+
*
18+
* Note:
19+
* Below HAL module have to be disabled, they are handled thanks Arduino menu:
20+
* HAL_UART_MODULE_ENABLED
21+
* HAL_PCD_MODULE_ENABLED
22+
*
23+
*/

0 commit comments

Comments
 (0)