diff options
| author | biyq <[email protected]> | 2022-12-14 13:35:44 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2022-12-15 20:19:42 +0800 |
| commit | 9bcea9ae37281d79ee47d9cc02afda72f03ef757 (patch) | |
| tree | 5a337ecb56e036fda7886b719e2f7cf6669fe898 | |
| parent | 82596cea4bcbb1b9798ebf68fced903068a00a57 (diff) | |
1. support for iar in situation of usb host application
| -rw-r--r-- | common/usb_util.h | 4 | ||||
| -rw-r--r-- | core/usbh_core.c | 5 | ||||
| -rw-r--r-- | core/usbh_core.h | 3 |
3 files changed, 10 insertions, 2 deletions
diff --git a/common/usb_util.h b/common/usb_util.h index 790dfe54..f19c5079 100644 --- a/common/usb_util.h +++ b/common/usb_util.h @@ -44,12 +44,12 @@ #ifndef __ALIGNED #define __ALIGNED(x) __attribute__((aligned(x))) #endif -#elif defined(__ICCARM__) +#elif defined(__ICCARM__) || defined(__ICCRX__) #ifndef __USED #if __ICCARM_V8 #define __USED __attribute__((used)) #else -#define __USED _Pragma("__root") +#define __USED __root #endif #endif diff --git a/core/usbh_core.c b/core/usbh_core.c index f9bfb3f1..11e12497 100644 --- a/core/usbh_core.c +++ b/core/usbh_core.c @@ -689,6 +689,11 @@ int usbh_initialize(void) 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__; +#elif defined(__ICCARM__) || defined(__ICCRX__) + extern uint32_t __usbh_class_info_start__; + extern uint32_t __usbh_class_info_end__; + usbh_class_info_table_begin = (struct usbh_class_info *)__section_begin("usbh_class_info"); + usbh_class_info_table_end = (struct usbh_class_info *)__section_end("usbh_class_info"); #endif /* devaddr 1 is for roothub */ diff --git a/core/usbh_core.h b/core/usbh_core.h index 0fd1ba0c..99f3a350 100644 --- a/core/usbh_core.h +++ b/core/usbh_core.h @@ -39,6 +39,9 @@ extern "C" { #define CLASS_INFO_DEFINE __attribute__((section("usbh_class_info"))) __USED __ALIGNED(1) #elif defined(__GNUC__) #define CLASS_INFO_DEFINE __attribute__((section(".usbh_class_info"))) __USED __ALIGNED(1) +#elif defined(__ICCARM__) || defined(__ICCRX__) +#pragma section="usbh_class_info" +#define CLASS_INFO_DEFINE __attribute__((section("usbh_class_info"))) __USED __ALIGNED(1) #endif static inline void usbh_control_urb_fill(struct usbh_urb *urb, |
