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,