This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ARM:5.10 USB custom class Error

When I use MDK 5.10 USB custom class ,build error:

D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(23): error: #20: identifier "USBD_CUSTOM_CLASS0_IF0_EN" is undefined uint8_t usbd0_alt_setting [USBD0_IF_CNT];
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(23): error: #20: identifier "USBD_CUSTOM_CLASS0_IF0_ALT" is undefined uint8_t usbd0_alt_setting [USBD0_IF_CNT];
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(23): error: #20: identifier "USBD_CUSTOM_CLASS0_IF1_EN" is undefined uint8_t usbd0_alt_setting [USBD0_IF_CNT];
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(23): error: #20: identifier "USBD_CUSTOM_CLASS0_IF1_ALT" is undefined uint8_t usbd0_alt_setting [USBD0_IF_CNT];
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(23): error: #20: identifier "USBD_CUSTOM_CLASS0_IF2_EN" is undefined uint8_t usbd0_alt_setting [USBD0_IF_CNT];
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(23): error: #20: identifier "USBD_CUSTOM_CLASS0_IF2_ALT" is undefined uint8_t usbd0_alt_setting [USBD0_IF_CNT];
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(23): error: #20: identifier "USBD_CUSTOM_CLASS0_IF3_EN" is undefined uint8_t usbd0_alt_setting [USBD0_IF_CNT];
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(23): error: #20: identifier "USBD_CUSTOM_CLASS0_IF3_ALT" is undefined uint8_t usbd0_alt_setting [USBD0_IF_CNT];
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(28): error: #28: expression must have a constant value usbd0_alt_setting,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF0_EP_BULK_OUT_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF0_EP_BULK_IN_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF0_EP_INT_OUT_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF0_EP_INT_IN_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF0_EP_ISO_OUT_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF0_EP_ISO_IN_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF1_EP_BULK_OUT_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF1_EP_BULK_IN_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF1_EP_INT_OUT_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF1_EP_INT_IN_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF1_EP_ISO_OUT_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF1_EP_ISO_IN_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF2_EP_BULK_OUT_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF2_EP_BULK_IN_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF2_EP_INT_OUT_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF2_EP_INT_IN_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF2_EP_ISO_OUT_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF2_EP_ISO_IN_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF3_EP_BULK_OUT_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF3_EP_BULK_IN_EN" is undefined USBD0_EP_CNT,
D:\Keil\ARM\Pack\Keil\MDK-Middleware\5.1.4\USB\Include\usbd_config_dev_0.c(34): error: #20: identifier "USBD_CUSTOM_CLASS0_IF3_EP_INT_OUT_EN" is undefined USBD0_EP_CNT,
RTE\USB\USBD_Config_0.c: 0 warnings, 30 errors

  • I don't know whether this is a bug or just wrong usage of the tool wizard.

    This is how i fixed it without modifying middleware components:

    Add ./RTE/USB to the include path (or wherever your custom class header files are located)
    Add #include "USBD_Config_CustomClass_0.h" to USBD_Config_0.c

    Best Regards,
    Jan