From a843e61791f7b79aa5a784ded5d7aacc88f12c73 Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Wed, 23 Mar 2022 20:33:55 +0800 Subject: [PATCH] fix linkscript for clang and ccarm --- core/usbh_core.c | 13 ++++++++++--- core/usbh_core.h | 2 -- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/core/usbh_core.c b/core/usbh_core.c index 28b4d468..74ac78b3 100644 --- a/core/usbh_core.c +++ b/core/usbh_core.c @@ -25,9 +25,6 @@ #include "usbh_hid.h" #include "usbh_msc.h" -extern uint32_t _usbh_class_info_start; -extern uint32_t _usbh_class_info_end; - struct usbh_class_info *usbh_class_info_table_begin = NULL; struct usbh_class_info *usbh_class_info_table_end = NULL; @@ -686,6 +683,7 @@ static int usbh_portchange_wait(struct usbh_hubport **hport) if (ret < 0) { continue; } + flags = usb_osal_enter_critical_section(); for (uint8_t port = USBH_HUB_PORT_START_INDEX; port <= CONFIG_USBHOST_RHPORTS; port++) { /* Check for a change in the connection state on any root hub port */ @@ -815,8 +813,17 @@ int usbh_initialize(void) memset(&usbh_core_cfg, 0, sizeof(struct usbh_core_priv)); +#if defined(__CC_ARM) || (__ARMCC_VERSION >= 6010050) /* ARM C Compiler */ + extern const int usbh_class_info$$Base; + extern const int usbh_class_info$$Limit; + usbh_class_info_table_begin = (struct usbh_class_info *)&usbh_class_info$$Base; + usbh_class_info_table_end = (struct usbh_class_info *)&usbh_class_info$$Limit; +#elif defined(__GNUC__) + extern uint32_t _usbh_class_info_start; + extern uint32_t _usbh_class_info_end; usbh_class_info_table_begin = (struct usbh_class_info *)&_usbh_class_info_start; usbh_class_info_table_end = (struct usbh_class_info *)&_usbh_class_info_end; +#endif #ifdef CONFIG_USBHOST_HUB usbh_workq_initialize(); #endif diff --git a/core/usbh_core.h b/core/usbh_core.h index 89010c8d..8338c695 100644 --- a/core/usbh_core.h +++ b/core/usbh_core.h @@ -26,10 +26,8 @@ #include "usb_def.h" #include "usb_hc.h" #include "usb_osal.h" -#ifdef CONFIG_USBHOST_HUB #include "usb_workq.h" #include "usbh_hub.h" -#endif #include "usb_config.h" #ifdef __cplusplus