summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorhathach <[email protected]>2014-03-10 13:13:13 +0700
committerhathach <[email protected]>2014-03-10 13:13:13 +0700
commitad72db5aeacf7d969f5c091c59a2f279eaf1c19c (patch)
tree328b462bcd4443e1eadba638509ebb4076b36b04 /demos
parent1c73d2f923aade6c6640d41c4b9dc3ec8865d3da (diff)
change IAR TUSB_CFG_ATTR_USBRAM to _Pragma("location=\".ahb_sram1\"") instead of @ .ahb_sram1 so that we can place it before the variable for a cleaner code
change pipe xfer API buffer from void* to uint8_t* change FIFO_DEF to have a separated buffer to be compatible with IAR\ refractor IAR data alignment pragma
Diffstat (limited to 'demos')
-rw-r--r--demos/device/src/tusb_config.h2
-rw-r--r--demos/device/src/tusb_descriptors.c876
-rw-r--r--demos/host/host_os_none/.cproject133
-rw-r--r--demos/host/src/cdc_serial_app.c4
-rw-r--r--demos/host/src/cli.c2
-rw-r--r--demos/host/src/keyboard_app.c2
-rw-r--r--demos/host/src/mouse_app.c2
-rw-r--r--demos/host/src/msc_app.c2
-rw-r--r--demos/host/src/tusb_config.h2
9 files changed, 519 insertions, 506 deletions
diff --git a/demos/device/src/tusb_config.h b/demos/device/src/tusb_config.h
index 512d23997..2f32abba7 100644
--- a/demos/device/src/tusb_config.h
+++ b/demos/device/src/tusb_config.h
@@ -123,7 +123,7 @@
#elif __ICCARM__ // compiled with IAR
- #define TUSB_CFG_ATTR_USBRAM @ ".ahb_sram1"
+ #define TUSB_CFG_ATTR_USBRAM _Pragma("location=\".ahb_sram1\"")
#else
diff --git a/demos/device/src/tusb_descriptors.c b/demos/device/src/tusb_descriptors.c
index 51088f324..e31261aeb 100644
--- a/demos/device/src/tusb_descriptors.c
+++ b/demos/device/src/tusb_descriptors.c
@@ -1,438 +1,438 @@
-/**************************************************************************/
-/*!
- @file tusb_descriptors.c
- @author hathach (tinyusb.org)
-
- @section LICENSE
-
- Software License Agreement (BSD License)
-
- Copyright (c) 2013, hathach (tinyusb.org)
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holders nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This file is part of the tinyusb stack.
-*/
-/**************************************************************************/
-
-#include "tusb_descriptors.h"
-
-#if TUSB_CFG_DEVICE_HID_KEYBOARD
-ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
-uint8_t app_tusb_keyboard_desc_report[] = {
- HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
- HID_USAGE ( HID_USAGE_DESKTOP_KEYBOARD ),
- HID_COLLECTION ( HID_COLLECTION_APPLICATION ),
- HID_USAGE_PAGE ( HID_USAGE_PAGE_KEYBOARD ),
- HID_USAGE_MIN ( 224 ),
- HID_USAGE_MAX ( 231 ),
- HID_LOGICAL_MIN ( 0 ),
- HID_LOGICAL_MAX ( 1 ),
-
- HID_REPORT_SIZE ( 1 ),
- HID_REPORT_COUNT ( 8 ), /* 8 bits */
- HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ), /* maskable modifier key */
-
- HID_REPORT_SIZE ( 8 ),
- HID_REPORT_COUNT ( 1 ),
- HID_INPUT ( HID_CONSTANT ), /* reserved */
-
- HID_USAGE_PAGE ( HID_USAGE_PAGE_LED ),
- HID_USAGE_MIN ( 1 ),
- HID_USAGE_MAX ( 5 ),
- HID_REPORT_COUNT ( 5 ),
- HID_REPORT_SIZE ( 1 ),
- HID_OUTPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ), /* 5-bit Led report */
-
- HID_REPORT_SIZE ( 3 ), /* led padding */
- HID_REPORT_COUNT ( 1 ),
- HID_OUTPUT ( HID_CONSTANT ),
-
- HID_USAGE_PAGE (HID_USAGE_PAGE_KEYBOARD),
- HID_USAGE_MIN ( 0 ),
- HID_USAGE_MAX ( 101 ),
- HID_LOGICAL_MIN ( 0 ),
- HID_LOGICAL_MAX ( 101 ),
-
- HID_REPORT_SIZE ( 8 ),
- HID_REPORT_COUNT ( 6 ),
- HID_INPUT ( HID_DATA | HID_ARRAY | HID_ABSOLUTE ), /* keycodes array 6 items */
- HID_COLLECTION_END
-};
-#endif
-
-#if TUSB_CFG_DEVICE_HID_MOUSE
-ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
-uint8_t app_tusb_mouse_desc_report[] = {
- HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
- HID_USAGE ( HID_USAGE_DESKTOP_MOUSE ),
- HID_COLLECTION ( HID_COLLECTION_APPLICATION ),
- HID_USAGE (HID_USAGE_DESKTOP_POINTER),
-
- HID_COLLECTION ( HID_COLLECTION_PHYSICAL ),
- HID_USAGE_PAGE ( HID_USAGE_PAGE_BUTTON ),
- HID_USAGE_MIN ( 1 ),
- HID_USAGE_MAX ( 3 ),
- HID_LOGICAL_MIN ( 0 ),
- HID_LOGICAL_MAX ( 1 ),
-
- HID_REPORT_SIZE ( 1 ),
- HID_REPORT_COUNT ( 3 ), /* Left, Right and Middle mouse*/
- HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ),
-
- HID_REPORT_SIZE ( 5 ),
- HID_REPORT_COUNT ( 1 ),
- HID_INPUT ( HID_CONSTANT ), /* 5 bit padding followed 3 bit buttons */
-
- HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
- HID_USAGE ( HID_USAGE_DESKTOP_X ),
- HID_USAGE ( HID_USAGE_DESKTOP_Y ),
- HID_LOGICAL_MIN ( 0x81 ), /* -127 */
- HID_LOGICAL_MAX ( 0x7f ), /* 127 */
-
- HID_REPORT_SIZE ( 8 ),
- HID_REPORT_COUNT ( 2 ), /* X, Y position */
- HID_INPUT ( HID_DATA | HID_VARIABLE | HID_RELATIVE ), /* relative values */
-
- HID_USAGE ( HID_USAGE_DESKTOP_WHEEL ), /* mouse scroll */
- HID_LOGICAL_MIN ( 0x81 ), /* -127 */
- HID_LOGICAL_MAX ( 0x7f ), /* 127 */
- HID_REPORT_COUNT( 1 ),
- HID_REPORT_SIZE ( 8 ), /* 8-bit value */
- HID_INPUT ( HID_DATA | HID_VARIABLE | HID_RELATIVE ), /* relative values */
-
- HID_COLLECTION_END,
-
- HID_COLLECTION_END
-};
-#endif
-
-ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
-tusb_descriptor_device_t app_tusb_desc_device =
-{
- .bLength = sizeof(tusb_descriptor_device_t),
- .bDescriptorType = TUSB_DESC_TYPE_DEVICE,
- .bcdUSB = 0x0200,
- #if IAD_DESC_REQUIRED
- // Multiple Interfaces Using Interface Association Descriptor (IAD)
- // As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
- .bDeviceClass = TUSB_CLASS_MISC,
- .bDeviceSubClass = MISC_SUBCLASS_COMMON,
- .bDeviceProtocol = MISC_PROTOCOL_IAD,
- #else
- .bDeviceClass = 0x00,
- .bDeviceSubClass = 0x00,
- .bDeviceProtocol = 0x00,
- #endif
-
- .bMaxPacketSize0 = TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE,
-
- .idVendor = CFG_VENDORID,
- .idProduct = CFG_PRODUCTID,
- .bcdDevice = 0x0100,
-
- .iManufacturer = 0x01,
- .iProduct = 0x02,
- .iSerialNumber = 0x03,
-
- .bNumConfigurations = 0x01 // TODO multiple configurations
-};
-
-ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
-app_descriptor_configuration_t app_tusb_desc_configuration =
-{
- .configuration =
- {
- .bLength = sizeof(tusb_descriptor_configuration_t),
- .bDescriptorType = TUSB_DESC_TYPE_CONFIGURATION,
-
- .wTotalLength = sizeof(app_descriptor_configuration_t),
- .bNumInterfaces = TOTAL_INTEFACES,
-
- .bConfigurationValue = 1,
- .iConfiguration = 0x00,
- .bmAttributes = TUSB_DESC_CONFIG_ATT_BUS_POWER,
- .bMaxPower = TUSB_DESC_CONFIG_POWER_MA(100)
- },
-
- #if IAD_DESC_REQUIRED
- // IAD points to CDC Interfaces
- .cdc_iad =
- {
- .bLength = sizeof(tusb_descriptor_interface_association_t),
- .bDescriptorType = TUSB_DESC_TYPE_INTERFACE_ASSOCIATION,
-
- .bFirstInterface = INTERFACE_NUM_CDC,
- .bInterfaceCount = 2,
-
- .bFunctionClass = TUSB_CLASS_CDC,
- .bFunctionSubClass = CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL,
- .bFunctionProtocol = CDC_COMM_PROTOCOL_ATCOMMAND,
- .iFunction = 0
- },
- #endif
-
- #if TUSB_CFG_DEVICE_CDC
- //------------- CDC Communication Interface -------------//
- .cdc_comm_interface =
- {
- .bLength = sizeof(tusb_descriptor_interface_t),
- .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
- .bInterfaceNumber = INTERFACE_NUM_CDC,
- .bAlternateSetting = 0,
- .bNumEndpoints = 1,
- .bInterfaceClass = TUSB_CLASS_CDC,
- .bInterfaceSubClass = CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL,
- .bInterfaceProtocol = CDC_COMM_PROTOCOL_ATCOMMAND,
- .iInterface = 0x00
- },
-
- .cdc_header =
- {
- .bLength = sizeof(cdc_desc_func_header_t),
- .bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
- .bDescriptorSubType = CDC_FUNC_DESC_HEADER,
- .bcdCDC = 0x0120
- },
-
- .cdc_acm =
- {
- .bLength = sizeof(cdc_desc_func_abstract_control_management_t),
- .bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
- .bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT,
- .bmCapabilities = { // 0x06
- .support_line_request = 1,
- .support_send_break = 1
- }
- },
-
- .cdc_union =
- {
- .bLength = sizeof(cdc_desc_func_union_t), // plus number of
- .bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
- .bDescriptorSubType = CDC_FUNC_DESC_UNION,
- .bControlInterface = 0,
- .bSubordinateInterface = 1,
- },
-
- .cdc_endpoint_notification =
- {
- .bLength = sizeof(tusb_descriptor_endpoint_t),
- .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
- .bEndpointAddress = CDC_EDPT_NOTIFICATION_ADDR,
- .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
- .wMaxPacketSize = { .size = 0x08 },
- .bInterval = 0x0a
- },
-
- //------------- CDC Data Interface -------------//
- .cdc_data_interface =
- {
- .bLength = sizeof(tusb_descriptor_interface_t),
- .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
- .bInterfaceNumber = INTERFACE_NUM_CDC+1,
- .bAlternateSetting = 0x00,
- .bNumEndpoints = 2,
- .bInterfaceClass = TUSB_CLASS_CDC_DATA,
- .bInterfaceSubClass = 0,
- .bInterfaceProtocol = 0,
- .iInterface = 0x00
- },
-
- .cdc_endpoint_out =
- {
- .bLength = sizeof(tusb_descriptor_endpoint_t),
- .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
- .bEndpointAddress = CDC_EDPT_DATA_OUT_ADDR,
- .bmAttributes = { .xfer = TUSB_XFER_BULK },
- .wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE },
- .bInterval = 0
- },
-
- .cdc_endpoint_in =
- {
- .bLength = sizeof(tusb_descriptor_endpoint_t),
- .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
- .bEndpointAddress = CDC_EDPT_DATA_IN_ADDR,
- .bmAttributes = { .xfer = TUSB_XFER_BULK },
- .wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE },
- .bInterval = 0
- },
- #endif
-
- //------------- HID Keyboard -------------//
- #if TUSB_CFG_DEVICE_HID_KEYBOARD
- .keyboard_interface =
- {
- .bLength = sizeof(tusb_descriptor_interface_t),
- .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
- .bInterfaceNumber = INTERFACE_NUM_HID_KEYBOARD,
- .bAlternateSetting = 0x00,
- .bNumEndpoints = 1,
- .bInterfaceClass = TUSB_CLASS_HID,
- .bInterfaceSubClass = HID_SUBCLASS_BOOT,
- .bInterfaceProtocol = HID_PROTOCOL_KEYBOARD,
- .iInterface = 0x00
- },
-
- .keyboard_hid =
- {
- .bLength = sizeof(tusb_hid_descriptor_hid_t),
- .bDescriptorType = HID_DESC_TYPE_HID,
- .bcdHID = 0x0111,
- .bCountryCode = HID_Local_NotSupported,
- .bNumDescriptors = 1,
- .bReportType = HID_DESC_TYPE_REPORT,
- .wReportLength = sizeof(app_tusb_keyboard_desc_report)
- },
-
- .keyboard_endpoint =
- {
- .bLength = sizeof(tusb_descriptor_endpoint_t),
- .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
- .bEndpointAddress = HID_KEYBOARD_EDPT_ADDR,
- .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
- .wMaxPacketSize = { .size = HID_KEYBOARD_EDPT_PACKETSIZE },
- .bInterval = 0x0A
- },
- #endif
-
- //------------- HID Mouse -------------//
- #if TUSB_CFG_DEVICE_HID_MOUSE
- .mouse_interface =
- {
- .bLength = sizeof(tusb_descriptor_interface_t),
- .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
- .bInterfaceNumber = INTERFACE_NUM_HID_MOUSE,
- .bAlternateSetting = 0x00,
- .bNumEndpoints = 1,
- .bInterfaceClass = TUSB_CLASS_HID,
- .bInterfaceSubClass = HID_SUBCLASS_BOOT,
- .bInterfaceProtocol = HID_PROTOCOL_MOUSE,
- .iInterface = 0x00
- },
-
- .mouse_hid =
- {
- .bLength = sizeof(tusb_hid_descriptor_hid_t),
- .bDescriptorType = HID_DESC_TYPE_HID,
- .bcdHID = 0x0111,
- .bCountryCode = HID_Local_NotSupported,
- .bNumDescriptors = 1,
- .bReportType = HID_DESC_TYPE_REPORT,
- .wReportLength = sizeof(app_tusb_mouse_desc_report)
- },
-
- .mouse_endpoint =
- {
- .bLength = sizeof(tusb_descriptor_endpoint_t),
- .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
- .bEndpointAddress = HID_MOUSE_EDPT_ADDR, // TODO
- .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
- .wMaxPacketSize = { .size = HID_MOUSE_EDPT_PACKETSIZE },
- .bInterval = 0x0A
- },
- #endif
-
- //------------- Mass Storage -------------//
- #if TUSB_CFG_DEVICE_MSC
- .msc_interface =
- {
- .bLength = sizeof(tusb_descriptor_interface_t),
- .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
- .bInterfaceNumber = INTERFACE_NUM_MSC,
- .bAlternateSetting = 0x00,
- .bNumEndpoints = 2,
- .bInterfaceClass = TUSB_CLASS_MSC,
- .bInterfaceSubClass = MSC_SUBCLASS_SCSI,
- .bInterfaceProtocol = MSC_PROTOCOL_BOT,
- .iInterface = 0x00
- },
-
- .msc_endpoint_in =
- {
- .bLength = sizeof(tusb_descriptor_endpoint_t),
- .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
- .bEndpointAddress = MSC_EDPT_IN_ADDR,
- .bmAttributes = { .xfer = TUSB_XFER_BULK },
- .wMaxPacketSize = { .size = MSC_EDPT_PACKETSIZE },
- .bInterval = 1
- },
-
- .msc_endpoint_out =
- {
- .bLength = sizeof(tusb_descriptor_endpoint_t),
- .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
- .bEndpointAddress = MSC_EDPT_OUT_ADDR,
- .bmAttributes = { .xfer = TUSB_XFER_BULK },
- .wMaxPacketSize = { .size = MSC_EDPT_PACKETSIZE },
- .bInterval = 1
- },
- #endif
-};
-
-//--------------------------------------------------------------------+
-// STRING DESCRIPTORS
-//--------------------------------------------------------------------+
-#define STRING_LEN_UNICODE(n) (2 + (2*(n))) // also includes 2 byte header
-
-ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
-tusb_descriptor_string_t desc_str_language =
-{
- .bLength = STRING_LEN_UNICODE(1),
- .bDescriptorType = TUSB_DESC_TYPE_STRING,
- .unicode_string = { 0x0409 }
-};
-
-ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
-tusb_descriptor_string_t desc_str_manufacturer =
-{
- .bLength = STRING_LEN_UNICODE(11),
- .bDescriptorType = TUSB_DESC_TYPE_STRING,
- .unicode_string = { 't', 'i', 'n', 'y', 'u', 's', 'b', '.', 'o', 'r', 'g' } // len = 11
-};
-
-ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
-tusb_descriptor_string_t desc_str_product =
-{
- .bLength = STRING_LEN_UNICODE(14),
- .bDescriptorType = TUSB_DESC_TYPE_STRING,
- .unicode_string = { 't', 'i', 'n', 'y', 'u', 's', 'b', ' ', 'D', 'e', 'v', 'i', 'c', 'e' } // len = 14
-};
-
-ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
-tusb_descriptor_string_t desc_str_serial =
-{
- .bLength = STRING_LEN_UNICODE(4),
- .bDescriptorType = TUSB_DESC_TYPE_STRING,
- .unicode_string = { '1', '2', '3', '4' } // len = 4
-};
-
-tusb_descriptor_string_t * const desc_str_table [TUSB_CFG_DEVICE_STRING_DESCRIPTOR_COUNT] =
-{
- &desc_str_language,
- &desc_str_manufacturer,
- &desc_str_product,
- &desc_str_serial
-};
+/**************************************************************************/
+/*!
+ @file tusb_descriptors.c
+ @author hathach (tinyusb.org)
+
+ @section LICENSE
+
+ Software License Agreement (BSD License)
+
+ Copyright (c) 2013, hathach (tinyusb.org)
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holders nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This file is part of the tinyusb stack.
+*/
+/**************************************************************************/
+
+#include "tusb_descriptors.h"
+
+#if TUSB_CFG_DEVICE_HID_KEYBOARD
+ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
+uint8_t app_tusb_keyboard_desc_report[] = {
+ HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
+ HID_USAGE ( HID_USAGE_DESKTOP_KEYBOARD ),
+ HID_COLLECTION ( HID_COLLECTION_APPLICATION ),
+ HID_USAGE_PAGE ( HID_USAGE_PAGE_KEYBOARD ),
+ HID_USAGE_MIN ( 224 ),
+ HID_USAGE_MAX ( 231 ),
+ HID_LOGICAL_MIN ( 0 ),
+ HID_LOGICAL_MAX ( 1 ),
+
+ HID_REPORT_SIZE ( 1 ),
+ HID_REPORT_COUNT ( 8 ), /* 8 bits */
+ HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ), /* maskable modifier key */
+
+ HID_REPORT_SIZE ( 8 ),
+ HID_REPORT_COUNT ( 1 ),
+ HID_INPUT ( HID_CONSTANT ), /* reserved */
+
+ HID_USAGE_PAGE ( HID_USAGE_PAGE_LED ),
+ HID_USAGE_MIN ( 1 ),
+ HID_USAGE_MAX ( 5 ),
+ HID_REPORT_COUNT ( 5 ),
+ HID_REPORT_SIZE ( 1 ),
+ HID_OUTPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ), /* 5-bit Led report */
+
+ HID_REPORT_SIZE ( 3 ), /* led padding */
+ HID_REPORT_COUNT ( 1 ),
+ HID_OUTPUT ( HID_CONSTANT ),
+
+ HID_USAGE_PAGE (HID_USAGE_PAGE_KEYBOARD),
+ HID_USAGE_MIN ( 0 ),
+ HID_USAGE_MAX ( 101 ),
+ HID_LOGICAL_MIN ( 0 ),
+ HID_LOGICAL_MAX ( 101 ),
+
+ HID_REPORT_SIZE ( 8 ),
+ HID_REPORT_COUNT ( 6 ),
+ HID_INPUT ( HID_DATA | HID_ARRAY | HID_ABSOLUTE ), /* keycodes array 6 items */
+ HID_COLLECTION_END
+};
+#endif
+
+#if TUSB_CFG_DEVICE_HID_MOUSE
+ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
+uint8_t app_tusb_mouse_desc_report[] = {
+ HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
+ HID_USAGE ( HID_USAGE_DESKTOP_MOUSE ),
+ HID_COLLECTION ( HID_COLLECTION_APPLICATION ),
+ HID_USAGE (HID_USAGE_DESKTOP_POINTER),
+
+ HID_COLLECTION ( HID_COLLECTION_PHYSICAL ),
+ HID_USAGE_PAGE ( HID_USAGE_PAGE_BUTTON ),
+ HID_USAGE_MIN ( 1 ),
+ HID_USAGE_MAX ( 3 ),
+ HID_LOGICAL_MIN ( 0 ),
+ HID_LOGICAL_MAX ( 1 ),
+
+ HID_REPORT_SIZE ( 1 ),
+ HID_REPORT_COUNT ( 3 ), /* Left, Right and Middle mouse*/
+ HID_INPUT ( HID_DATA | HID_VARIABLE | HID_ABSOLUTE ),
+
+ HID_REPORT_SIZE ( 5 ),
+ HID_REPORT_COUNT ( 1 ),
+ HID_INPUT ( HID_CONSTANT ), /* 5 bit padding followed 3 bit buttons */
+
+ HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
+ HID_USAGE ( HID_USAGE_DESKTOP_X ),
+ HID_USAGE ( HID_USAGE_DESKTOP_Y ),
+ HID_LOGICAL_MIN ( 0x81 ), /* -127 */
+ HID_LOGICAL_MAX ( 0x7f ), /* 127 */
+
+ HID_REPORT_SIZE ( 8 ),
+ HID_REPORT_COUNT ( 2 ), /* X, Y position */
+ HID_INPUT ( HID_DATA | HID_VARIABLE | HID_RELATIVE ), /* relative values */
+
+ HID_USAGE ( HID_USAGE_DESKTOP_WHEEL ), /* mouse scroll */
+ HID_LOGICAL_MIN ( 0x81 ), /* -127 */
+ HID_LOGICAL_MAX ( 0x7f ), /* 127 */
+ HID_REPORT_COUNT( 1 ),
+ HID_REPORT_SIZE ( 8 ), /* 8-bit value */
+ HID_INPUT ( HID_DATA | HID_VARIABLE | HID_RELATIVE ), /* relative values */
+
+ HID_COLLECTION_END,
+
+ HID_COLLECTION_END
+};
+#endif
+
+ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
+tusb_descriptor_device_t app_tusb_desc_device =
+{
+ .bLength = sizeof(tusb_descriptor_device_t),
+ .bDescriptorType = TUSB_DESC_TYPE_DEVICE,
+ .bcdUSB = 0x0200,
+ #if IAD_DESC_REQUIRED
+ // Multiple Interfaces Using Interface Association Descriptor (IAD)
+ // As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
+ .bDeviceClass = TUSB_CLASS_MISC,
+ .bDeviceSubClass = MISC_SUBCLASS_COMMON,
+ .bDeviceProtocol = MISC_PROTOCOL_IAD,
+ #else
+ .bDeviceClass = 0x00,
+ .bDeviceSubClass = 0x00,
+ .bDeviceProtocol = 0x00,
+ #endif
+
+ .bMaxPacketSize0 = TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE,
+
+ .idVendor = CFG_VENDORID,
+ .idProduct = CFG_PRODUCTID,
+ .bcdDevice = 0x0100,
+
+ .iManufacturer = 0x01,
+ .iProduct = 0x02,
+ .iSerialNumber = 0x03,
+
+ .bNumConfigurations = 0x01 // TODO multiple configurations
+};
+
+ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
+app_descriptor_configuration_t app_tusb_desc_configuration =
+{
+ .configuration =
+ {
+ .bLength = sizeof(tusb_descriptor_configuration_t),
+ .bDescriptorType = TUSB_DESC_TYPE_CONFIGURATION,
+
+ .wTotalLength = sizeof(app_descriptor_configuration_t),
+ .bNumInterfaces = TOTAL_INTEFACES,
+
+ .bConfigurationValue = 1,
+ .iConfiguration = 0x00,
+ .bmAttributes = TUSB_DESC_CONFIG_ATT_BUS_POWER,
+ .bMaxPower = TUSB_DESC_CONFIG_POWER_MA(100)
+ },
+
+ #if IAD_DESC_REQUIRED
+ // IAD points to CDC Interfaces
+ .cdc_iad =
+ {
+ .bLength = sizeof(tusb_descriptor_interface_association_t),
+ .bDescriptorType = TUSB_DESC_TYPE_INTERFACE_ASSOCIATION,
+
+ .bFirstInterface = INTERFACE_NUM_CDC,
+ .bInterfaceCount = 2,
+
+ .bFunctionClass = TUSB_CLASS_CDC,
+ .bFunctionSubClass = CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL,
+ .bFunctionProtocol = CDC_COMM_PROTOCOL_ATCOMMAND,
+ .iFunction = 0
+ },
+ #endif
+
+ #if TUSB_CFG_DEVICE_CDC
+ //------------- CDC Communication Interface -------------//
+ .cdc_comm_interface =
+ {
+ .bLength = sizeof(tusb_descriptor_interface_t),
+ .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
+ .bInterfaceNumber = INTERFACE_NUM_CDC,
+ .bAlternateSetting = 0,
+ .bNumEndpoints = 1,
+ .bInterfaceClass = TUSB_CLASS_CDC,
+ .bInterfaceSubClass = CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL,
+ .bInterfaceProtocol = CDC_COMM_PROTOCOL_ATCOMMAND,
+ .iInterface = 0x00
+ },
+
+ .cdc_header =
+ {
+ .bLength = sizeof(cdc_desc_func_header_t),
+ .bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
+ .bDescriptorSubType = CDC_FUNC_DESC_HEADER,
+ .bcdCDC = 0x0120
+ },
+
+ .cdc_acm =
+ {
+ .bLength = sizeof(cdc_desc_func_abstract_control_management_t),
+ .bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
+ .bDescriptorSubType = CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT,
+ .bmCapabilities = { // 0x06
+ .support_line_request = 1,
+ .support_send_break = 1
+ }
+ },
+
+ .cdc_union =
+ {
+ .bLength = sizeof(cdc_desc_func_union_t), // plus number of
+ .bDescriptorType = TUSB_DESC_TYPE_INTERFACE_CLASS_SPECIFIC,
+ .bDescriptorSubType = CDC_FUNC_DESC_UNION,
+ .bControlInterface = 0,
+ .bSubordinateInterface = 1,
+ },
+
+ .cdc_endpoint_notification =
+ {
+ .bLength = sizeof(tusb_descriptor_endpoint_t),
+ .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
+ .bEndpointAddress = CDC_EDPT_NOTIFICATION_ADDR,
+ .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
+ .wMaxPacketSize = { .size = 0x08 },
+ .bInterval = 0x0a
+ },
+
+ //------------- CDC Data Interface -------------//
+ .cdc_data_interface =
+ {
+ .bLength = sizeof(tusb_descriptor_interface_t),
+ .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
+ .bInterfaceNumber = INTERFACE_NUM_CDC+1,
+ .bAlternateSetting = 0x00,
+ .bNumEndpoints = 2,
+ .bInterfaceClass = TUSB_CLASS_CDC_DATA,
+ .bInterfaceSubClass = 0,
+ .bInterfaceProtocol = 0,
+ .iInterface = 0x00
+ },
+
+ .cdc_endpoint_out =
+ {
+ .bLength = sizeof(tusb_descriptor_endpoint_t),
+ .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
+ .bEndpointAddress = CDC_EDPT_DATA_OUT_ADDR,
+ .bmAttributes = { .xfer = TUSB_XFER_BULK },
+ .wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE },
+ .bInterval = 0
+ },
+
+ .cdc_endpoint_in =
+ {
+ .bLength = sizeof(tusb_descriptor_endpoint_t),
+ .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
+ .bEndpointAddress = CDC_EDPT_DATA_IN_ADDR,
+ .bmAttributes = { .xfer = TUSB_XFER_BULK },
+ .wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE },
+ .bInterval = 0
+ },
+ #endif
+
+ //------------- HID Keyboard -------------//
+ #if TUSB_CFG_DEVICE_HID_KEYBOARD
+ .keyboard_interface =
+ {
+ .bLength = sizeof(tusb_descriptor_interface_t),
+ .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
+ .bInterfaceNumber = INTERFACE_NUM_HID_KEYBOARD,
+ .bAlternateSetting = 0x00,
+ .bNumEndpoints = 1,
+ .bInterfaceClass = TUSB_CLASS_HID,
+ .bInterfaceSubClass = HID_SUBCLASS_BOOT,
+ .bInterfaceProtocol = HID_PROTOCOL_KEYBOARD,
+ .iInterface = 0x00
+ },
+
+ .keyboard_hid =
+ {
+ .bLength = sizeof(tusb_hid_descriptor_hid_t),
+ .bDescriptorType = HID_DESC_TYPE_HID,
+ .bcdHID = 0x0111,
+ .bCountryCode = HID_Local_NotSupported,
+ .bNumDescriptors = 1,
+ .bReportType = HID_DESC_TYPE_REPORT,
+ .wReportLength = sizeof(app_tusb_keyboard_desc_report)
+ },
+
+ .keyboard_endpoint =
+ {
+ .bLength = sizeof(tusb_descriptor_endpoint_t),
+ .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
+ .bEndpointAddress = HID_KEYBOARD_EDPT_ADDR,
+ .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
+ .wMaxPacketSize = { .size = HID_KEYBOARD_EDPT_PACKETSIZE },
+ .bInterval = 0x0A
+ },
+ #endif
+
+ //------------- HID Mouse -------------//
+ #if TUSB_CFG_DEVICE_HID_MOUSE
+ .mouse_interface =
+ {
+ .bLength = sizeof(tusb_descriptor_interface_t),
+ .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
+ .bInterfaceNumber = INTERFACE_NUM_HID_MOUSE,
+ .bAlternateSetting = 0x00,
+ .bNumEndpoints = 1,
+ .bInterfaceClass = TUSB_CLASS_HID,
+ .bInterfaceSubClass = HID_SUBCLASS_BOOT,
+ .bInterfaceProtocol = HID_PROTOCOL_MOUSE,
+ .iInterface = 0x00
+ },
+
+ .mouse_hid =
+ {
+ .bLength = sizeof(tusb_hid_descriptor_hid_t),
+ .bDescriptorType = HID_DESC_TYPE_HID,
+ .bcdHID = 0x0111,
+ .bCountryCode = HID_Local_NotSupported,
+ .bNumDescriptors = 1,
+ .bReportType = HID_DESC_TYPE_REPORT,
+ .wReportLength = sizeof(app_tusb_mouse_desc_report)
+ },
+
+ .mouse_endpoint =
+ {
+ .bLength = sizeof(tusb_descriptor_endpoint_t),
+ .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
+ .bEndpointAddress = HID_MOUSE_EDPT_ADDR, // TODO
+ .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
+ .wMaxPacketSize = { .size = HID_MOUSE_EDPT_PACKETSIZE },
+ .bInterval = 0x0A
+ },
+ #endif
+
+ //------------- Mass Storage -------------//
+ #if TUSB_CFG_DEVICE_MSC
+ .msc_interface =
+ {
+ .bLength = sizeof(tusb_descriptor_interface_t),
+ .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
+ .bInterfaceNumber = INTERFACE_NUM_MSC,
+ .bAlternateSetting = 0x00,
+ .bNumEndpoints = 2,
+ .bInterfaceClass = TUSB_CLASS_MSC,
+ .bInterfaceSubClass = MSC_SUBCLASS_SCSI,
+ .bInterfaceProtocol = MSC_PROTOCOL_BOT,
+ .iInterface = 0x00
+ },
+
+ .msc_endpoint_in =
+ {
+ .bLength = sizeof(tusb_descriptor_endpoint_t),
+ .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
+ .bEndpointAddress = MSC_EDPT_IN_ADDR,
+ .bmAttributes = { .xfer = TUSB_XFER_BULK },
+ .wMaxPacketSize = { .size = MSC_EDPT_PACKETSIZE },
+ .bInterval = 1
+ },
+
+ .msc_endpoint_out =
+ {
+ .bLength = sizeof(tusb_descriptor_endpoint_t),
+ .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
+ .bEndpointAddress = MSC_EDPT_OUT_ADDR,
+ .bmAttributes = { .xfer = TUSB_XFER_BULK },
+ .wMaxPacketSize = { .size = MSC_EDPT_PACKETSIZE },
+ .bInterval = 1
+ },
+ #endif
+};
+
+//--------------------------------------------------------------------+
+// STRING DESCRIPTORS
+//--------------------------------------------------------------------+
+#define STRING_LEN_UNICODE(n) (2 + (2*(n))) // also includes 2 byte header
+
+ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
+tusb_descriptor_string_t desc_str_language =
+{
+ .bLength = STRING_LEN_UNICODE(1),
+ .bDescriptorType = TUSB_DESC_TYPE_STRING,
+ .unicode_string = { 0x0409 }
+};
+
+ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
+tusb_descriptor_string_t desc_str_manufacturer =
+{
+ .bLength = STRING_LEN_UNICODE(11),
+ .bDescriptorType = TUSB_DESC_TYPE_STRING,
+ .unicode_string = { 't', 'i', 'n', 'y', 'u', 's', 'b', '.', 'o', 'r', 'g' } // len = 11
+};
+
+ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
+tusb_descriptor_string_t desc_str_product =
+{
+ .bLength = STRING_LEN_UNICODE(14),
+ .bDescriptorType = TUSB_DESC_TYPE_STRING,
+ .unicode_string = { 't', 'i', 'n', 'y', 'u', 's', 'b', ' ', 'D', 'e', 'v', 'i', 'c', 'e' } // len = 14
+};
+
+ATTR_USB_MIN_ALIGNMENT TUSB_CFG_ATTR_USBRAM
+tusb_descriptor_string_t desc_str_serial =
+{
+ .bLength = STRING_LEN_UNICODE(4),
+ .bDescriptorType = TUSB_DESC_TYPE_STRING,
+ .unicode_string = { '1', '2', '3', '4' } // len = 4
+};
+
+tusb_descriptor_string_t * const desc_str_table [TUSB_CFG_DEVICE_STRING_DESCRIPTOR_COUNT] =
+{
+ &desc_str_language,
+ &desc_str_manufacturer,
+ &desc_str_product,
+ &desc_str_serial
+};
diff --git a/demos/host/host_os_none/.cproject b/demos/host/host_os_none/.cproject
index 27d4f6a7e..99960707c 100644
--- a/demos/host/host_os_none/.cproject
+++ b/demos/host/host_os_none/.cproject
@@ -123,7 +123,7 @@
<builder buildPath="${workspace_loc:/host/Debug}" errorParsers="org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.CWDLocator" id="com.crt.advproject.builder.exe.debug.1432862600" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="com.crt.advproject.builder.exe.debug"/>
<tool id="com.crt.advproject.cpp.exe.debug.964171687" name="MCU C++ Compiler" superClass="com.crt.advproject.cpp.exe.debug"/>
<tool command="arm-none-eabi-gcc" commandLinePattern="${COMMAND} ${FLAGS} ${CFLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GCCErrorParser" id="com.crt.advproject.gcc.exe.debug.502985594" name="MCU C Compiler" superClass="com.crt.advproject.gcc.exe.debug">
- <option id="com.crt.advproject.gcc.arch.625803892" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gcc.arch.625803892" name="Architecture" superClass="com.crt.advproject.gcc.arch" value="com.crt.advproject.gcc.target.cm4" valueType="enumerated"/>
<option id="com.crt.advproject.gcc.thumb.1149795974" name="Thumb mode" superClass="com.crt.advproject.gcc.thumb" value="true" valueType="boolean"/>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.510918973" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__REDLIB__"/>
@@ -151,7 +151,7 @@
<inputType id="com.crt.advproject.compiler.input.772057054" superClass="com.crt.advproject.compiler.input"/>
</tool>
<tool command="arm-none-eabi-gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GASErrorParser" id="com.crt.advproject.gas.exe.debug.973267950" name="MCU Assembler" superClass="com.crt.advproject.gas.exe.debug">
- <option id="com.crt.advproject.gas.arch.733211533" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.gas.arch.733211533" name="Architecture" superClass="com.crt.advproject.gas.arch" value="com.crt.advproject.gas.target.cm4" valueType="enumerated"/>
<option id="com.crt.advproject.gas.thumb.154920324" name="Thumb mode" superClass="com.crt.advproject.gas.thumb" value="true" valueType="boolean"/>
<option id="gnu.both.asm.option.flags.crt.220166654" name="Assembler flags" superClass="gnu.both.asm.option.flags.crt" value="-c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED" valueType="string"/>
<option id="com.crt.advproject.gas.fpu.464699791" name="Floating point" superClass="com.crt.advproject.gas.fpu" value="com.crt.advproject.gas.fpu.fpv4" valueType="enumerated"/>
@@ -160,7 +160,7 @@
</tool>
<tool id="com.crt.advproject.link.cpp.exe.debug.1510590263" name="MCU C++ Linker" superClass="com.crt.advproject.link.cpp.exe.debug"/>
<tool command="arm-none-eabi-gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GLDErrorParser" id="com.crt.advproject.link.exe.debug.1770663329" name="MCU Linker" superClass="com.crt.advproject.link.exe.debug">
- <option id="com.crt.advproject.link.arch.1264750550" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm3" valueType="enumerated"/>
+ <option id="com.crt.advproject.link.arch.1264750550" name="Architecture" superClass="com.crt.advproject.link.arch" value="com.crt.advproject.link.target.cm4" valueType="enumerated"/>
<option id="com.crt.advproject.link.thumb.1129500777" name="Thumb mode" superClass="com.crt.advproject.link.thumb" value="true" valueType="boolean"/>
<option id="com.crt.advproject.link.script.1484718299" name="Linker script" superClass="com.crt.advproject.link.script" value="&quot;host_os_none_Board_EA4357.ld&quot;" valueType="string"/>
<option id="com.crt.advproject.link.manage.887685321" name="Manage linker script" superClass="com.crt.advproject.link.manage" value="true" valueType="boolean"/>
@@ -566,73 +566,86 @@
<storageModule moduleId="com.crt.config">
<projectStorage>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&#13;
&lt;TargetConfig&gt;&#13;
-&lt;Properties property_0="" property_3="NXP" property_4="LPC1769" property_count="5" version="1"/&gt;&#13;
-&lt;infoList vendor="NXP"&gt;&lt;info chip="LPC1769" match_id="0x26113F37" name="LPC1769" package="lpc17_lqfp100.xml"&gt;&lt;chip&gt;&lt;name&gt;LPC1769&lt;/name&gt;&#13;
-&lt;family&gt;LPC17xx&lt;/family&gt;&#13;
+&lt;Properties property_0="" property_2="LPC18x7_43x7_2x512_BootA.cfx" property_3="NXP" property_4="LPC4357" property_count="5" version="1"/&gt;&#13;
+&lt;infoList vendor="NXP"&gt;&lt;info chip="LPC4357" flash_driver="LPC18x7_43x7_2x512_BootA.cfx" match_id="0x0" name="LPC4357" resetscript="LPC18LPC43InternalFLASHBootResetscript.scp" stub="crt_emu_lpc18_43_nxp"&gt;&lt;chip&gt;&lt;name&gt;LPC4357&lt;/name&gt;&#13;
+&lt;family&gt;LPC43xx&lt;/family&gt;&#13;
&lt;vendor&gt;NXP (formerly Philips)&lt;/vendor&gt;&#13;
&lt;reset board="None" core="Real" sys="Real"/&gt;&#13;
&lt;clock changeable="TRUE" freq="20MHz" is_accurate="TRUE"/&gt;&#13;
&lt;memory can_program="true" id="Flash" is_ro="true" type="Flash"/&gt;&#13;
&lt;memory id="RAM" type="RAM"/&gt;&#13;
&lt;memory id="Periph" is_volatile="true" type="Peripheral"/&gt;&#13;
-&lt;memoryInstance derived_from="Flash" id="MFlash512" location="0x0" size="0x80000"/&gt;&#13;
+&lt;memoryInstance derived_from="Flash" id="MFlashA512" location="0x1a000000" size="0x80000"/&gt;&#13;
+&lt;memoryInstance derived_from="Flash" id="MFlashB512" location="0x1b000000" size="0x80000"/&gt;&#13;
&lt;memoryInstance derived_from="RAM" id="RamLoc32" location="0x10000000" size="0x8000"/&gt;&#13;
-&lt;memoryInstance derived_from="RAM" id="RamAHB32" location="0x2007c000" size="0x8000"/&gt;&#13;
-&lt;prog_flash blocksz="0x1000" location="0" maxprgbuff="0x1000" progwithcode="TRUE" size="0x10000"/&gt;&#13;
-&lt;prog_flash blocksz="0x8000" location="0x10000" maxprgbuff="0x1000" progwithcode="TRUE" size="0x70000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_NVIC" id="NVIC" location="0xE000E000"/&gt;&#13;
-&lt;peripheralInstance derived_from="TIMER" enable="SYSCTL.PCONP.PCTIM0&amp;amp;0x1" id="TIMER0" location="0x40004000"/&gt;&#13;
-&lt;peripheralInstance derived_from="TIMER" enable="SYSCTL.PCONP.PCTIM1&amp;amp;0x1" id="TIMER1" location="0x40008000"/&gt;&#13;
-&lt;peripheralInstance derived_from="TIMER" enable="SYSCTL.PCONP.PCTIM2&amp;amp;0x1" id="TIMER2" location="0x40090000"/&gt;&#13;
-&lt;peripheralInstance derived_from="TIMER" enable="SYSCTL.PCONP.PCTIM3&amp;amp;0x1" id="TIMER3" location="0x40094000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_RIT" enable="SYSCTL.PCONP.PCRIT&amp;amp;0x1" id="RIT" location="0x400B0000"/&gt;&#13;
-&lt;peripheralInstance derived_from="FGPIO" enable="SYSCTL.PCONP.PCGPIO&amp;amp;0x1" id="GPIO0" location="0x2009C000"/&gt;&#13;
-&lt;peripheralInstance derived_from="FGPIO" enable="SYSCTL.PCONP.PCGPIO&amp;amp;0x1" id="GPIO1" location="0x2009C020"/&gt;&#13;
-&lt;peripheralInstance derived_from="FGPIO" enable="SYSCTL.PCONP.PCGPIO&amp;amp;0x1" id="GPIO2" location="0x2009C040"/&gt;&#13;
-&lt;peripheralInstance derived_from="FGPIO" enable="SYSCTL.PCONP.PCGPIO&amp;amp;0x1" id="GPIO3" location="0x2009C060"/&gt;&#13;
-&lt;peripheralInstance derived_from="FGPIO" enable="SYSCTL.PCONP.PCGPIO&amp;amp;0x1" id="GPIO4" location="0x2009C080"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_I2S" enable="SYSCTL.PCONP&amp;amp;0x08000000" id="I2S" location="0x400A8000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_SYSCTL" id="SYSCTL" location="0x400FC000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_DAC" enable="PCB.PINSEL1.P0_26&amp;amp;0x2=2" id="DAC" location="0x4008C000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17xx_UART" enable="SYSCTL.PCONP.PCUART0&amp;amp;0x1" id="UART0" location="0x4000C000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17xx_UART_MODEM" enable="SYSCTL.PCONP.PCUART1&amp;amp;0x1" id="UART1" location="0x40010000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17xx_UART" enable="SYSCTL.PCONP.PCUART2&amp;amp;0x1" id="UART2" location="0x40098000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17xx_UART" enable="SYSCTL.PCONP.PCUART3&amp;amp;0x1" id="UART3" location="0x4009C000"/&gt;&#13;
-&lt;peripheralInstance derived_from="SPI" enable="SYSCTL.PCONP.PCSPI&amp;amp;0x1" id="SPI" location="0x40020000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_SSP" enable="SYSCTL.PCONP.PCSSP0&amp;amp;0x1" id="SSP0" location="0x40088000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_SSP" enable="SYSCTL.PCONP.PCSSP1&amp;amp;0x1" id="SSP1" location="0x40030000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_ADC" enable="SYSCTL.PCONP.PCAD&amp;amp;0x1" id="ADC" location="0x40034000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_USBINTST" enable="USBCLKCTL.USBClkCtrl&amp;amp;0x12" id="USBINTSTAT" location="0x400fc1c0"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_USB_CLK_CTL" id="USBCLKCTL" location="0x5000cff4"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_USBDEV" enable="USBCLKCTL.USBClkSt&amp;amp;0x12=0x12" id="USBDEV" location="0x5000C200"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_PWM" enable="SYSCTL.PCONP.PWM1&amp;amp;0x1" id="PWM" location="0x40018000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_I2C" enable="SYSCTL.PCONP.PCI2C0&amp;amp;0x1" id="I2C0" location="0x4001C000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_I2C" enable="SYSCTL.PCONP.PCI2C1&amp;amp;0x1" id="I2C1" location="0x4005C000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_I2C" enable="SYSCTL.PCONP.PCI2C2&amp;amp;0x1" id="I2C2" location="0x400A0000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_DMA" enable="SYSCTL.PCONP.PCGPDMA&amp;amp;0x1" id="DMA" location="0x50004000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_ENET" enable="SYSCTL.PCONP.PCENET&amp;amp;0x1" id="ENET" location="0x50000000"/&gt;&#13;
-&lt;peripheralInstance derived_from="CM3_DCR" id="DCR" location="0xE000EDF0"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_PCB" id="PCB" location="0x4002c000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_QEI" enable="SYSCTL.PCONP.PCQEI&amp;amp;0x1" id="QEI" location="0x400bc000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_USBHOST" enable="USBCLKCTL.USBClkSt&amp;amp;0x11=0x11" id="USBHOST" location="0x5000C000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_USBOTG" enable="USBCLKCTL.USBClkSt&amp;amp;0x1c=0x1c" id="USBOTG" location="0x5000C000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_RTC" enable="SYSCTL.PCONP.PCRTC&amp;amp;0x1" id="RTC" location="0x40024000"/&gt;&#13;
-&lt;peripheralInstance derived_from="MPU" id="MPU" location="0xE000ED90"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC1x_WDT" id="WDT" location="0x40000000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_FLASHCFG" id="FLASHACCEL" location="0x400FC000"/&gt;&#13;
-&lt;peripheralInstance derived_from="GPIO_INT" id="GPIOINTMAP" location="0x40028080"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_CANAFR" enable="SYSCTL.PCONP.PCCAN1&amp;amp;0x1|SYSCTL.PCONP.PCCAN2&amp;amp;0x1" id="CANAFR" location="0x4003C000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_CANCEN" enable="SYSCTL.PCONP.PCCAN1&amp;amp;0x1|SYSCTL.PCONP.PCCAN2&amp;amp;0x1" id="CANCEN" location="0x40040000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_CANWAKESLEEP" id="CANWAKESLEEP" location="0x400FC110"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_CANCON" enable="SYSCTL.PCONP.PCCAN1&amp;amp;0x1" id="CANCON1" location="0x40044000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_CANCON" enable="SYSCTL.PCONP.PCCAN2&amp;amp;0x1" id="CANCON2" location="0x40048000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_MCPWM" enable="SYSCTL.PCONP.PCMCPWM&amp;amp;0x1" id="MCPWM" location="0x400B8000"/&gt;&#13;
-&lt;peripheralInstance derived_from="LPC17_FMC" id="FMC" location="0x40084000"/&gt;&#13;
+&lt;memoryInstance derived_from="RAM" id="RamLoc40" location="0x10080000" size="0xa000"/&gt;&#13;
+&lt;memoryInstance derived_from="RAM" id="RamAHB32" location="0x20000000" size="0x8000"/&gt;&#13;
+&lt;memoryInstance derived_from="RAM" id="RamAHB16" location="0x20008000" size="0x4000"/&gt;&#13;
+&lt;memoryInstance derived_from="RAM" id="RamAHB_ETB16" location="0x2000c000" size="0x4000"/&gt;&#13;
+&lt;prog_flash blocksz="0x2000" location="0x1a000000" maxprgbuff="0x400" progwithcode="TRUE" size="0x10000"/&gt;&#13;
+&lt;prog_flash blocksz="0x10000" location="0x1a010000" maxprgbuff="0x400" progwithcode="TRUE" size="0x70000"/&gt;&#13;
+&lt;prog_flash blocksz="0x2000" location="0x1b000000" maxprgbuff="0x400" progwithcode="TRUE" size="0x10000"/&gt;&#13;
+&lt;prog_flash blocksz="0x10000" location="0x1b010000" maxprgbuff="0x400" progwithcode="TRUE" size="0x70000"/&gt;&#13;
+&lt;peripheralInstance derived_from="V7M_MPU" id="MPU" location="0xe000ed90"/&gt;&#13;
+&lt;peripheralInstance derived_from="V7M_NVIC" id="NVIC" location="0xe000e000"/&gt;&#13;
+&lt;peripheralInstance derived_from="V7M_DCR" id="DCR" location="0xe000edf0"/&gt;&#13;
+&lt;peripheralInstance derived_from="V7M_ITM" id="ITM" location="0xe0000000"/&gt;&#13;
+&lt;peripheralInstance derived_from="SCT" id="SCT" location="0x40000000"/&gt;&#13;
+&lt;peripheralInstance derived_from="GPDMA" id="GPDMA" location="0x40002000"/&gt;&#13;
+&lt;peripheralInstance derived_from="SPIFI" id="SPIFI" location="0x40003000"/&gt;&#13;
+&lt;peripheralInstance derived_from="SDMMC" id="SDMMC" location="0x40004000"/&gt;&#13;
+&lt;peripheralInstance derived_from="EMC" id="EMC" location="0x40005000"/&gt;&#13;
+&lt;peripheralInstance derived_from="USB0" id="USB0" location="0x40006000"/&gt;&#13;
+&lt;peripheralInstance derived_from="USB1" id="USB1" location="0x40007000"/&gt;&#13;
+&lt;peripheralInstance derived_from="LCD" id="LCD" location="0x40008000"/&gt;&#13;
+&lt;peripheralInstance derived_from="EEPROM" id="EEPROM" location="0x4000e000"/&gt;&#13;
+&lt;peripheralInstance derived_from="ETHERNET" id="ETHERNET" location="0x40010000"/&gt;&#13;
+&lt;peripheralInstance derived_from="ATIMER" id="ATIMER" location="0x40040000"/&gt;&#13;
+&lt;peripheralInstance derived_from="REGFILE" id="REGFILE" location="0x40041000"/&gt;&#13;
+&lt;peripheralInstance derived_from="PMC" id="PMC" location="0x40042000"/&gt;&#13;
+&lt;peripheralInstance derived_from="CREG" id="CREG" location="0x40043000"/&gt;&#13;
+&lt;peripheralInstance derived_from="EVENTROUTER" id="EVENTROUTER" location="0x40044000"/&gt;&#13;
+&lt;peripheralInstance derived_from="RTC" id="RTC" location="0x40046000"/&gt;&#13;
+&lt;peripheralInstance derived_from="CGU" id="CGU" location="0x40050000"/&gt;&#13;
+&lt;peripheralInstance derived_from="CCU1" id="CCU1" location="0x40051000"/&gt;&#13;
+&lt;peripheralInstance derived_from="CCU2" id="CCU2" location="0x40052000"/&gt;&#13;
+&lt;peripheralInstance derived_from="RGU" id="RGU" location="0x40053000"/&gt;&#13;
+&lt;peripheralInstance derived_from="WWDT" id="WWDT" location="0x40080000"/&gt;&#13;
+&lt;peripheralInstance derived_from="USART0" id="USART0" location="0x40081000"/&gt;&#13;
+&lt;peripheralInstance derived_from="USART2" id="USART2" location="0x400c1000"/&gt;&#13;
+&lt;peripheralInstance derived_from="USART3" id="USART3" location="0x400c2000"/&gt;&#13;
+&lt;peripheralInstance derived_from="UART1" id="UART1" location="0x40082000"/&gt;&#13;
+&lt;peripheralInstance derived_from="SSP0" id="SSP0" location="0x40083000"/&gt;&#13;
+&lt;peripheralInstance derived_from="SSP1" id="SSP1" location="0x400c5000"/&gt;&#13;
+&lt;peripheralInstance derived_from="TIMER0" id="TIMER0" location="0x40084000"/&gt;&#13;
+&lt;peripheralInstance derived_from="TIMER1" id="TIMER1" location="0x40085000"/&gt;&#13;
+&lt;peripheralInstance derived_from="TIMER2" id="TIMER2" location="0x400c3000"/&gt;&#13;
+&lt;peripheralInstance derived_from="TIMER3" id="TIMER3" location="0x400c4000"/&gt;&#13;
+&lt;peripheralInstance derived_from="SCU" id="SCU" location="0x40086000"/&gt;&#13;
+&lt;peripheralInstance derived_from="GPIO-PIN-INT" id="GPIO-PIN-INT" location="0x40087000"/&gt;&#13;
+&lt;peripheralInstance derived_from="GPIO-GROUP-INT0" id="GPIO-GROUP-INT0" location="0x40088000"/&gt;&#13;
+&lt;peripheralInstance derived_from="GPIO-GROUP-INT1" id="GPIO-GROUP-INT1" location="0x40089000"/&gt;&#13;
+&lt;peripheralInstance derived_from="MCPWM" id="MCPWM" location="0x400a0000"/&gt;&#13;
+&lt;peripheralInstance derived_from="I2C0" id="I2C0" location="0x400a1000"/&gt;&#13;
+&lt;peripheralInstance derived_from="I2C1" id="I2C1" location="0x400e0000"/&gt;&#13;
+&lt;peripheralInstance derived_from="I2S0" id="I2S0" location="0x400a2000"/&gt;&#13;
+&lt;peripheralInstance derived_from="I2S1" id="I2S1" location="0x400a3000"/&gt;&#13;
+&lt;peripheralInstance derived_from="C-CAN1" id="C-CAN1" location="0x400a4000"/&gt;&#13;
+&lt;peripheralInstance derived_from="RITIMER" id="RITIMER" location="0x400c0000"/&gt;&#13;
+&lt;peripheralInstance derived_from="QEI" id="QEI" location="0x400c6000"/&gt;&#13;
+&lt;peripheralInstance derived_from="GIMA" id="GIMA" location="0x400c7000"/&gt;&#13;
+&lt;peripheralInstance derived_from="DAC" id="DAC" location="0x400e1000"/&gt;&#13;
+&lt;peripheralInstance derived_from="C-CAN0" id="C-CAN0" location="0x400e2000"/&gt;&#13;
+&lt;peripheralInstance derived_from="ADC0" id="ADC0" location="0x400e3000"/&gt;&#13;
+&lt;peripheralInstance derived_from="ADC1" id="ADC1" location="0x400e4000"/&gt;&#13;
+&lt;peripheralInstance derived_from="GPIO-PORT" id="GPIO-PORT" location="0x400f4000"/&gt;&#13;
+&lt;peripheralInstance derived_from="SPI" id="SPI" location="0x40100000"/&gt;&#13;
+&lt;peripheralInstance derived_from="SGPIO" id="SGPIO" location="0x40101000"/&gt;&#13;
&lt;/chip&gt;&#13;
-&lt;processor&gt;&lt;name gcc_name="cortex-m3"&gt;Cortex-M3&lt;/name&gt;&#13;
+&lt;processor&gt;&lt;name gcc_name="cortex-m4"&gt;Cortex-M4&lt;/name&gt;&#13;
&lt;family&gt;Cortex-M&lt;/family&gt;&#13;
&lt;/processor&gt;&#13;
-&lt;link href="nxp_lpcxxxx_peripheral.xme" show="embed" type="simple"/&gt;&#13;
+&lt;link href="nxp_lpc43xx_peripheral.xme" show="embed" type="simple"/&gt;&#13;
&lt;/info&gt;&#13;
&lt;/infoList&gt;&#13;
&lt;/TargetConfig&gt;</projectStorage>
diff --git a/demos/host/src/cdc_serial_app.c b/demos/host/src/cdc_serial_app.c
index db97bd87c..208cb28a6 100644
--- a/demos/host/src/cdc_serial_app.c
+++ b/demos/host/src/cdc_serial_app.c
@@ -51,8 +51,8 @@ OSAL_SEM_DEF(serial_semaphore);
static osal_semaphore_handle_t sem_hdl;
-static uint8_t serial_in_buffer[32] TUSB_CFG_ATTR_USBRAM;
-static uint8_t serial_out_buffer[32] TUSB_CFG_ATTR_USBRAM;
+TUSB_CFG_ATTR_USBRAM static uint8_t serial_in_buffer[32];
+TUSB_CFG_ATTR_USBRAM static uint8_t serial_out_buffer[32];
static uint8_t received_bytes; // set by transfer complete callback
diff --git a/demos/host/src/cli.c b/demos/host/src/cli.c
index 8816d43ba..d67379b9b 100644
--- a/demos/host/src/cli.c
+++ b/demos/host/src/cli.c
@@ -135,8 +135,8 @@ static cli_cmdfunc_t cli_command_tbl[] =
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
+TUSB_CFG_ATTR_USBRAM uint8_t fileread_buffer[CLI_FILE_READ_BUFFER];
static char cli_buffer[CLI_MAX_BUFFER];
-uint8_t fileread_buffer[CLI_FILE_READ_BUFFER] TUSB_CFG_ATTR_USBRAM;
static char volume_label[20];
static inline void drive_number2letter(char * p_path) ATTR_ALWAYS_INLINE;
diff --git a/demos/host/src/keyboard_app.c b/demos/host/src/keyboard_app.c
index 907ae8c2e..c004059ef 100644
--- a/demos/host/src/keyboard_app.c
+++ b/demos/host/src/keyboard_app.c
@@ -56,7 +56,7 @@ OSAL_TASK_DEF(keyboard_app_task, 128, KEYBOARD_APP_TASK_PRIO);
OSAL_QUEUE_DEF(queue_kbd_def, QUEUE_KEYBOARD_REPORT_DEPTH, hid_keyboard_report_t);
static osal_queue_handle_t queue_kbd_hdl;
-static hid_keyboard_report_t usb_keyboard_report TUSB_CFG_ATTR_USBRAM;
+TUSB_CFG_ATTR_USBRAM static hid_keyboard_report_t usb_keyboard_report;
static inline uint8_t keycode_to_ascii(uint8_t modifier, uint8_t keycode) ATTR_CONST ATTR_ALWAYS_INLINE;
static inline void process_kbd_report(hid_keyboard_report_t const * report);
diff --git a/demos/host/src/mouse_app.c b/demos/host/src/mouse_app.c
index 60b91f4d2..4fabd4f36 100644
--- a/demos/host/src/mouse_app.c
+++ b/demos/host/src/mouse_app.c
@@ -56,7 +56,7 @@ OSAL_TASK_DEF(mouse_app_task, 128, MOUSE_APP_TASK_PRIO);
OSAL_QUEUE_DEF(queue_mouse_def, QUEUE_MOUSE_REPORT_DEPTH, hid_mouse_report_t);
static osal_queue_handle_t queue_mouse_hdl;
-static hid_mouse_report_t usb_mouse_report TUSB_CFG_ATTR_USBRAM;
+TUSB_CFG_ATTR_USBRAM static hid_mouse_report_t usb_mouse_report;
static inline void process_mouse_report(hid_mouse_report_t const * p_report);
diff --git a/demos/host/src/msc_app.c b/demos/host/src/msc_app.c
index b7e909cee..5bd66c9d6 100644
--- a/demos/host/src/msc_app.c
+++ b/demos/host/src/msc_app.c
@@ -57,7 +57,7 @@
//--------------------------------------------------------------------+
OSAL_TASK_DEF(msc_app_task, 512, MSC_APP_TASK_PRIO);
-static FATFS fatfs[TUSB_CFG_HOST_DEVICE_MAX] TUSB_CFG_ATTR_USBRAM;
+TUSB_CFG_ATTR_USBRAM static FATFS fatfs[TUSB_CFG_HOST_DEVICE_MAX];
//--------------------------------------------------------------------+
// tinyusb callback (ISR context)
diff --git a/demos/host/src/tusb_config.h b/demos/host/src/tusb_config.h
index 3315897cf..e12f020a6 100644
--- a/demos/host/src/tusb_config.h
+++ b/demos/host/src/tusb_config.h
@@ -115,7 +115,7 @@
#elif defined __ICCARM__ // compiled with IAR
- #define TUSB_CFG_ATTR_USBRAM @ ".ahb_sram1"
+ #define TUSB_CFG_ATTR_USBRAM _Pragma("location=\".ahb_sram1\"")
#else