From 0632e866e11042df95edd0de5a301b7095f3524f Mon Sep 17 00:00:00 2001 From: Paul Chavent Date: Sat, 19 Jul 2014 00:37:30 +0200 Subject: [PATCH 1/4] Fix the Demo's Device ClassDriver Descriptors for big endian. Use the CPU_TO_LE16 macro for 16 bits fields. The 16 bits fields has been checked for CDC and HID devices, so it could remains some bug for other class devices. Signed-off-by: Paul Chavent --- .../ClassDriver/AudioInput/Descriptors.c | 8 ++++---- .../ClassDriver/AudioOutput/Descriptors.c | 8 ++++---- .../DualVirtualSerial/Descriptors.c | 18 +++++++++--------- .../ClassDriver/GenericHID/Descriptors.c | 10 +++++----- .../Device/ClassDriver/Joystick/Descriptors.c | 10 +++++----- .../Device/ClassDriver/Keyboard/Descriptors.c | 10 +++++----- .../ClassDriver/KeyboardMouse/Descriptors.c | 14 +++++++------- .../KeyboardMouseMultiReport/Descriptors.c | 10 +++++----- Demos/Device/ClassDriver/MIDI/Descriptors.c | 10 +++++----- .../ClassDriver/MassStorage/Descriptors.c | 10 +++++----- .../MassStorageKeyboard/Descriptors.c | 14 +++++++------- Demos/Device/ClassDriver/Mouse/Descriptors.c | 10 +++++----- .../ClassDriver/RNDISEthernet/Descriptors.c | 12 ++++++------ .../ClassDriver/VirtualSerial/Descriptors.c | 12 ++++++------ .../VirtualSerialMassStorage/Descriptors.c | 16 ++++++++-------- .../VirtualSerialMouse/Descriptors.c | 16 ++++++++-------- .../CodeTemplates/DeviceTemplate/Descriptors.c | 6 +++--- 17 files changed, 97 insertions(+), 97 deletions(-) diff --git a/Demos/Device/ClassDriver/AudioInput/Descriptors.c b/Demos/Device/ClassDriver/AudioInput/Descriptors.c index f87ed9761..a9321e220 100644 --- a/Demos/Device/ClassDriver/AudioInput/Descriptors.c +++ b/Demos/Device/ClassDriver/AudioInput/Descriptors.c @@ -53,8 +53,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - .VendorID = 0x03EB, - .ProductID = 0x2047, + .VendorID = CPU_TO_LE16(0x03EB), + .ProductID = CPU_TO_LE16(0x2047), .ReleaseNumber = VERSION_BCD(0,0,2), .ManufacturerStrIndex = STRING_ID_Manufacturer, @@ -75,7 +75,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)), .TotalInterfaces = 2, .ConfigurationNumber = 1, @@ -222,7 +222,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = AUDIO_STREAM_EPADDR, .Attributes = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = AUDIO_STREAM_EPSIZE, + .EndpointSize = CPU_TO_LE16(AUDIO_STREAM_EPSIZE), .PollingIntervalMS = 0x01 }, diff --git a/Demos/Device/ClassDriver/AudioOutput/Descriptors.c b/Demos/Device/ClassDriver/AudioOutput/Descriptors.c index 4d68e89de..37a4e1eb2 100644 --- a/Demos/Device/ClassDriver/AudioOutput/Descriptors.c +++ b/Demos/Device/ClassDriver/AudioOutput/Descriptors.c @@ -53,8 +53,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - .VendorID = 0x03EB, - .ProductID = 0x2046, + .VendorID = CPU_TO_LE16(0x03EB), + .ProductID = CPU_TO_LE16(0x2046), .ReleaseNumber = VERSION_BCD(0,0,2), .ManufacturerStrIndex = STRING_ID_Manufacturer, @@ -75,7 +75,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)), .TotalInterfaces = 2, .ConfigurationNumber = 1, @@ -222,7 +222,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = AUDIO_STREAM_EPADDR, .Attributes = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = AUDIO_STREAM_EPSIZE, + .EndpointSize = CPU_TO_LE16(AUDIO_STREAM_EPSIZE), .PollingIntervalMS = 0x01 }, diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c index 9952ed92c..2ea09fa2f 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c +++ b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c @@ -54,8 +54,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - .VendorID = 0x03EB, - .ProductID = 0x204E, + .VendorID = CPU_TO_LE16(0x03EB), + .ProductID = CPU_TO_LE16(0x204E), .ReleaseNumber = VERSION_BCD(0,0,1), .ManufacturerStrIndex = STRING_ID_Manufacturer, @@ -76,7 +76,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)), .TotalInterfaces = 4, .ConfigurationNumber = 1, @@ -148,7 +148,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC1_NOTIFICATION_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_NOTIFICATION_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_NOTIFICATION_EPSIZE), .PollingIntervalMS = 0xFF }, @@ -174,7 +174,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC1_RX_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_TXRX_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_TXRX_EPSIZE), .PollingIntervalMS = 0x05 }, @@ -184,7 +184,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC1_TX_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_TXRX_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_TXRX_EPSIZE), .PollingIntervalMS = 0x05 }, @@ -249,7 +249,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC2_NOTIFICATION_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_NOTIFICATION_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_NOTIFICATION_EPSIZE), .PollingIntervalMS = 0xFF }, @@ -275,7 +275,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC2_RX_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_TXRX_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_TXRX_EPSIZE), .PollingIntervalMS = 0x05 }, @@ -285,7 +285,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC2_TX_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_TXRX_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_TXRX_EPSIZE), .PollingIntervalMS = 0x05 } }; diff --git a/Demos/Device/ClassDriver/GenericHID/Descriptors.c b/Demos/Device/ClassDriver/GenericHID/Descriptors.c index b070a5db3..3a06cd8bb 100644 --- a/Demos/Device/ClassDriver/GenericHID/Descriptors.c +++ b/Demos/Device/ClassDriver/GenericHID/Descriptors.c @@ -71,8 +71,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - .VendorID = 0x03EB, - .ProductID = 0x204F, + .VendorID = CPU_TO_LE16(0x03EB), + .ProductID = CPU_TO_LE16(0x204F), .ReleaseNumber = VERSION_BCD(0,0,1), .ManufacturerStrIndex = STRING_ID_Manufacturer, @@ -93,7 +93,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)), .TotalInterfaces = 1, .ConfigurationNumber = 1, @@ -128,7 +128,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .CountryCode = 0x00, .TotalReportDescriptors = 1, .HIDReportType = HID_DTYPE_Report, - .HIDReportLength = sizeof(GenericReport) + .HIDReportLength = CPU_TO_LE16(sizeof(GenericReport)) }, .HID_ReportINEndpoint = @@ -137,7 +137,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = GENERIC_IN_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = GENERIC_EPSIZE, + .EndpointSize = CPU_TO_LE16(GENERIC_EPSIZE), .PollingIntervalMS = 0x05 }, }; diff --git a/Demos/Device/ClassDriver/Joystick/Descriptors.c b/Demos/Device/ClassDriver/Joystick/Descriptors.c index b257b7101..a894d0f79 100644 --- a/Demos/Device/ClassDriver/Joystick/Descriptors.c +++ b/Demos/Device/ClassDriver/Joystick/Descriptors.c @@ -71,8 +71,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - .VendorID = 0x03EB, - .ProductID = 0x2043, + .VendorID = CPU_TO_LE16(0x03EB), + .ProductID = CPU_TO_LE16(0x2043), .ReleaseNumber = VERSION_BCD(0,0,1), .ManufacturerStrIndex = STRING_ID_Manufacturer, @@ -93,7 +93,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)), .TotalInterfaces = 1, .ConfigurationNumber = 1, @@ -128,7 +128,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .CountryCode = 0x00, .TotalReportDescriptors = 1, .HIDReportType = HID_DTYPE_Report, - .HIDReportLength = sizeof(JoystickReport) + .HIDReportLength = CPU_TO_LE16(sizeof(JoystickReport)) }, .HID_ReportINEndpoint = @@ -137,7 +137,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = JOYSTICK_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = JOYSTICK_EPSIZE, + .EndpointSize = CPU_TO_LE16(JOYSTICK_EPSIZE), .PollingIntervalMS = 0x05 } }; diff --git a/Demos/Device/ClassDriver/Keyboard/Descriptors.c b/Demos/Device/ClassDriver/Keyboard/Descriptors.c index d45c1098f..8e32f7377 100644 --- a/Demos/Device/ClassDriver/Keyboard/Descriptors.c +++ b/Demos/Device/ClassDriver/Keyboard/Descriptors.c @@ -67,8 +67,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - .VendorID = 0x03EB, - .ProductID = 0x2042, + .VendorID = CPU_TO_LE16(0x03EB), + .ProductID = CPU_TO_LE16(0x2042), .ReleaseNumber = VERSION_BCD(0,0,1), .ManufacturerStrIndex = STRING_ID_Manufacturer, @@ -89,7 +89,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)), .TotalInterfaces = 1, .ConfigurationNumber = 1, @@ -124,7 +124,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .CountryCode = 0x00, .TotalReportDescriptors = 1, .HIDReportType = HID_DTYPE_Report, - .HIDReportLength = sizeof(KeyboardReport) + .HIDReportLength = CPU_TO_LE16(sizeof(KeyboardReport)) }, .HID_ReportINEndpoint = @@ -133,7 +133,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = KEYBOARD_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = KEYBOARD_EPSIZE, + .EndpointSize = CPU_TO_LE16(KEYBOARD_EPSIZE), .PollingIntervalMS = 0x05 }, }; diff --git a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c index 663e425da..a4c3cc814 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c +++ b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c @@ -83,8 +83,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - .VendorID = 0x03EB, - .ProductID = 0x204D, + .VendorID = CPU_TO_LE16(0x03EB), + .ProductID = CPU_TO_LE16(0x204D), .ReleaseNumber = VERSION_BCD(0,0,1), .ManufacturerStrIndex = STRING_ID_Manufacturer, @@ -105,7 +105,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)), .TotalInterfaces = 2, .ConfigurationNumber = 1, @@ -140,7 +140,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .CountryCode = 0x00, .TotalReportDescriptors = 1, .HIDReportType = HID_DTYPE_Report, - .HIDReportLength = sizeof(KeyboardReport) + .HIDReportLength = CPU_TO_LE16(sizeof(KeyboardReport)) }, .HID1_ReportINEndpoint = @@ -149,7 +149,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = KEYBOARD_IN_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = HID_EPSIZE, + .EndpointSize = CPU_TO_LE16(HID_EPSIZE), .PollingIntervalMS = 0x05 }, @@ -177,7 +177,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .CountryCode = 0x00, .TotalReportDescriptors = 1, .HIDReportType = HID_DTYPE_Report, - .HIDReportLength = sizeof(MouseReport) + .HIDReportLength = CPU_TO_LE16(sizeof(MouseReport)) }, .HID2_ReportINEndpoint = @@ -186,7 +186,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = MOUSE_IN_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = HID_EPSIZE, + .EndpointSize = CPU_TO_LE16(HID_EPSIZE), .PollingIntervalMS = 0x05 } }; diff --git a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c index 6d9c3c250..1176f394f 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Descriptors.c @@ -130,8 +130,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - .VendorID = 0x03EB, - .ProductID = 0x2066, + .VendorID = CPU_TO_LE16(0x03EB), + .ProductID = CPU_TO_LE16(0x2066), .ReleaseNumber = VERSION_BCD(0,0,1), .ManufacturerStrIndex = STRING_ID_Manufacturer, @@ -152,7 +152,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)), .TotalInterfaces = 1, .ConfigurationNumber = 1, @@ -187,7 +187,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .CountryCode = 0x00, .TotalReportDescriptors = 1, .HIDReportType = HID_DTYPE_Report, - .HIDReportLength = sizeof(HIDReport) + .HIDReportLength = CPU_TO_LE16(sizeof(HIDReport)) }, .HID_ReportINEndpoint = @@ -196,7 +196,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = HID_IN_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = HID_EPSIZE, + .EndpointSize = CPU_TO_LE16(HID_EPSIZE), .PollingIntervalMS = 0x05 }, }; diff --git a/Demos/Device/ClassDriver/MIDI/Descriptors.c b/Demos/Device/ClassDriver/MIDI/Descriptors.c index f7138ca59..419898f3c 100644 --- a/Demos/Device/ClassDriver/MIDI/Descriptors.c +++ b/Demos/Device/ClassDriver/MIDI/Descriptors.c @@ -53,8 +53,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - .VendorID = 0x03EB, - .ProductID = 0x2048, + .VendorID = CPU_TO_LE16(0x03EB), + .ProductID = CPU_TO_LE16(0x2048), .ReleaseNumber = VERSION_BCD(0,0,1), .ManufacturerStrIndex = STRING_ID_Manufacturer, @@ -75,7 +75,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)), .TotalInterfaces = 2, .ConfigurationNumber = 1, @@ -201,7 +201,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = MIDI_STREAM_OUT_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = MIDI_STREAM_EPSIZE, + .EndpointSize = CPU_TO_LE16(MIDI_STREAM_EPSIZE), .PollingIntervalMS = 0x05 }, @@ -226,7 +226,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = MIDI_STREAM_IN_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = MIDI_STREAM_EPSIZE, + .EndpointSize = CPU_TO_LE16(MIDI_STREAM_EPSIZE), .PollingIntervalMS = 0x05 }, diff --git a/Demos/Device/ClassDriver/MassStorage/Descriptors.c b/Demos/Device/ClassDriver/MassStorage/Descriptors.c index 598155a45..6fe5d9626 100644 --- a/Demos/Device/ClassDriver/MassStorage/Descriptors.c +++ b/Demos/Device/ClassDriver/MassStorage/Descriptors.c @@ -54,8 +54,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - .VendorID = 0x03EB, - .ProductID = 0x2045, + .VendorID = CPU_TO_LE16(0x03EB), + .ProductID = CPU_TO_LE16(0x2045), .ReleaseNumber = VERSION_BCD(0,0,1), .ManufacturerStrIndex = STRING_ID_Manufacturer, @@ -76,7 +76,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)), .TotalInterfaces = 1, .ConfigurationNumber = 1, @@ -109,7 +109,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = MASS_STORAGE_IN_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = MASS_STORAGE_IO_EPSIZE, + .EndpointSize = CPU_TO_LE16(MASS_STORAGE_IO_EPSIZE), .PollingIntervalMS = 0x05 }, @@ -119,7 +119,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = MASS_STORAGE_OUT_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = MASS_STORAGE_IO_EPSIZE, + .EndpointSize = CPU_TO_LE16(MASS_STORAGE_IO_EPSIZE), .PollingIntervalMS = 0x05 } }; diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c index 90187c1e4..937e72cac 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c @@ -69,8 +69,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - .VendorID = 0x03EB, - .ProductID = 0x2061, + .VendorID = CPU_TO_LE16(0x03EB), + .ProductID = CPU_TO_LE16(0x2061), .ReleaseNumber = VERSION_BCD(0,0,1), .ManufacturerStrIndex = STRING_ID_Manufacturer, @@ -91,7 +91,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)), .TotalInterfaces = 2, .ConfigurationNumber = 1, @@ -124,7 +124,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = MASS_STORAGE_IN_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = MASS_STORAGE_IO_EPSIZE, + .EndpointSize = CPU_TO_LE16(MASS_STORAGE_IO_EPSIZE), .PollingIntervalMS = 0x05 }, @@ -134,7 +134,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = MASS_STORAGE_OUT_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = MASS_STORAGE_IO_EPSIZE, + .EndpointSize = CPU_TO_LE16(MASS_STORAGE_IO_EPSIZE), .PollingIntervalMS = 0x05 }, @@ -162,7 +162,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .CountryCode = 0x00, .TotalReportDescriptors = 1, .HIDReportType = HID_DTYPE_Report, - .HIDReportLength = sizeof(KeyboardReport) + .HIDReportLength = CPU_TO_LE16(sizeof(KeyboardReport)) }, .HID_ReportINEndpoint = @@ -171,7 +171,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = KEYBOARD_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = KEYBOARD_EPSIZE, + .EndpointSize = CPU_TO_LE16(KEYBOARD_EPSIZE), .PollingIntervalMS = 0x05 }, }; diff --git a/Demos/Device/ClassDriver/Mouse/Descriptors.c b/Demos/Device/ClassDriver/Mouse/Descriptors.c index c810ab527..3077ce0a1 100644 --- a/Demos/Device/ClassDriver/Mouse/Descriptors.c +++ b/Demos/Device/ClassDriver/Mouse/Descriptors.c @@ -72,8 +72,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - .VendorID = 0x03EB, - .ProductID = 0x2041, + .VendorID = CPU_TO_LE16(0x03EB), + .ProductID = CPU_TO_LE16(0x2041), .ReleaseNumber = VERSION_BCD(0,0,1), .ManufacturerStrIndex = STRING_ID_Manufacturer, @@ -94,7 +94,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)), .TotalInterfaces = 1, .ConfigurationNumber = 1, @@ -129,7 +129,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .CountryCode = 0x00, .TotalReportDescriptors = 1, .HIDReportType = HID_DTYPE_Report, - .HIDReportLength = sizeof(MouseReport) + .HIDReportLength = CPU_TO_LE16(sizeof(MouseReport)) }, .HID_ReportINEndpoint = @@ -138,7 +138,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = MOUSE_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = MOUSE_EPSIZE, + .EndpointSize = CPU_TO_LE16(MOUSE_EPSIZE), .PollingIntervalMS = 0x05 } }; diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c b/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c index cab6717f9..3e92133d4 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c @@ -53,8 +53,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - .VendorID = 0x03EB, - .ProductID = 0x204C, + .VendorID = CPU_TO_LE16(0x03EB), + .ProductID = CPU_TO_LE16(0x204C), .ReleaseNumber = VERSION_BCD(0,0,1), .ManufacturerStrIndex = STRING_ID_Manufacturer, @@ -75,7 +75,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)), .TotalInterfaces = 2, .ConfigurationNumber = 1, @@ -133,7 +133,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC_NOTIFICATION_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_NOTIFICATION_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_NOTIFICATION_EPSIZE), .PollingIntervalMS = 0xFF }, @@ -159,7 +159,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC_RX_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_TXRX_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_TXRX_EPSIZE), .PollingIntervalMS = 0x05 }, @@ -169,7 +169,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC_TX_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_TXRX_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_TXRX_EPSIZE), .PollingIntervalMS = 0x05 } }; diff --git a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.c b/Demos/Device/ClassDriver/VirtualSerial/Descriptors.c index 314151226..8369bd9fa 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.c +++ b/Demos/Device/ClassDriver/VirtualSerial/Descriptors.c @@ -54,8 +54,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - .VendorID = 0x03EB, - .ProductID = 0x2044, + .VendorID = CPU_TO_LE16(0x03EB), + .ProductID = CPU_TO_LE16(0x2044), .ReleaseNumber = VERSION_BCD(0,0,1), .ManufacturerStrIndex = STRING_ID_Manufacturer, @@ -76,7 +76,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)), .TotalInterfaces = 2, .ConfigurationNumber = 1, @@ -134,7 +134,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC_NOTIFICATION_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_NOTIFICATION_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_NOTIFICATION_EPSIZE), .PollingIntervalMS = 0xFF }, @@ -160,7 +160,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC_RX_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_TXRX_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_TXRX_EPSIZE), .PollingIntervalMS = 0x05 }, @@ -170,7 +170,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC_TX_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_TXRX_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_TXRX_EPSIZE), .PollingIntervalMS = 0x05 } }; diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.c b/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.c index 18533fda2..0bdacccf7 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.c +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/Descriptors.c @@ -54,8 +54,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - .VendorID = 0x03EB, - .ProductID = 0x2068, + .VendorID = CPU_TO_LE16(0x03EB), + .ProductID = CPU_TO_LE16(0x2068), .ReleaseNumber = VERSION_BCD(0,0,1), .ManufacturerStrIndex = STRING_ID_Manufacturer, @@ -76,7 +76,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)), .TotalInterfaces = 3, .ConfigurationNumber = 1, @@ -148,7 +148,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC_NOTIFICATION_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_NOTIFICATION_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_NOTIFICATION_EPSIZE), .PollingIntervalMS = 0xFF }, @@ -174,7 +174,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC_RX_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_TXRX_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_TXRX_EPSIZE), .PollingIntervalMS = 0x05 }, @@ -184,7 +184,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC_TX_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_TXRX_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_TXRX_EPSIZE), .PollingIntervalMS = 0x05 }, @@ -210,7 +210,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = MASS_STORAGE_IN_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = MASS_STORAGE_IO_EPSIZE, + .EndpointSize = CPU_TO_LE16(MASS_STORAGE_IO_EPSIZE), .PollingIntervalMS = 0x05 }, @@ -220,7 +220,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = MASS_STORAGE_OUT_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = MASS_STORAGE_IO_EPSIZE, + .EndpointSize = CPU_TO_LE16(MASS_STORAGE_IO_EPSIZE), .PollingIntervalMS = 0x05 } }; diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c b/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c index 029c80f0b..81146465f 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c @@ -73,8 +73,8 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - .VendorID = 0x03EB, - .ProductID = 0x2062, + .VendorID = CPU_TO_LE16(0x03EB), + .ProductID = CPU_TO_LE16(0x2062), .ReleaseNumber = VERSION_BCD(0,0,1), .ManufacturerStrIndex = STRING_ID_Manufacturer, @@ -95,7 +95,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)), .TotalInterfaces = 3, .ConfigurationNumber = 1, @@ -167,7 +167,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC_NOTIFICATION_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_NOTIFICATION_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_NOTIFICATION_EPSIZE), .PollingIntervalMS = 0xFF }, @@ -193,7 +193,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC_RX_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_TXRX_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_TXRX_EPSIZE), .PollingIntervalMS = 0x05 }, @@ -203,7 +203,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = CDC_TX_EPADDR, .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = CDC_TXRX_EPSIZE, + .EndpointSize = CPU_TO_LE16(CDC_TXRX_EPSIZE), .PollingIntervalMS = 0x05 }, @@ -231,7 +231,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .CountryCode = 0x00, .TotalReportDescriptors = 1, .HIDReportType = HID_DTYPE_Report, - .HIDReportLength = sizeof(MouseReport) + .HIDReportLength = CPU_TO_LE16(sizeof(MouseReport)) }, .HID_ReportINEndpoint = @@ -240,7 +240,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = MOUSE_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = MOUSE_EPSIZE, + .EndpointSize = CPU_TO_LE16(MOUSE_EPSIZE), .PollingIntervalMS = 0x05 } }; diff --git a/LUFA/CodeTemplates/DeviceTemplate/Descriptors.c b/LUFA/CodeTemplates/DeviceTemplate/Descriptors.c index 71cebe891..9ccb736db 100644 --- a/LUFA/CodeTemplates/DeviceTemplate/Descriptors.c +++ b/LUFA/CodeTemplates/DeviceTemplate/Descriptors.c @@ -53,8 +53,8 @@ const USB_Descriptor_Device_t DeviceDescriptor = .Endpoint0Size = 64, - .VendorID = 0x0000, - .ProductID = 0x0000, + .VendorID = CPU_TO_LE16(0x0000), + .ProductID = CPU_TO_LE16(0x0000), .ReleaseNumber = VERSION_BCD(0,0,2), .ManufacturerStrIndex = 0x01, @@ -75,7 +75,7 @@ const USB_Descriptor_Configuration_t ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = CPU_TO_LE16(sizeof(USB_Descriptor_Configuration_t)) .TotalInterfaces = 0, .ConfigurationNumber = 1, From bd90a8528badc7eab1044d75b0705d8c90152916 Mon Sep 17 00:00:00 2001 From: Paul Chavent Date: Fri, 18 Jul 2014 23:19:41 +0200 Subject: [PATCH 2/4] Add an objcopy knob in makefile rules. Signed-off-by: Paul Chavent --- LUFA/Build/lufa_build.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LUFA/Build/lufa_build.mk b/LUFA/Build/lufa_build.mk index 3469ec43d..95ba3e467 100644 --- a/LUFA/Build/lufa_build.mk +++ b/LUFA/Build/lufa_build.mk @@ -316,17 +316,17 @@ $(OBJDIR)/%.o: %.S $(MAKEFILE_LIST) # Extracts out the loadable FLASH memory data from the project ELF file, and creates an Intel HEX format file of it %.hex: %.elf @echo $(MSG_OBJCPY_CMD) Extracting HEX file data from \"$<\" - $(CROSS)-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature $< $@ + $(CROSS)-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature $(OBJCPY_FLAGS) $< $@ # Extracts out the loadable FLASH memory data from the project ELF file, and creates an Binary format file of it %.bin: %.elf @echo $(MSG_OBJCPY_CMD) Extracting BIN file data from \"$<\" - $(CROSS)-objcopy -O binary -R .eeprom -R .fuse -R .lock -R .signature $< $@ + $(CROSS)-objcopy -O binary -R .eeprom -R .fuse -R .lock -R .signature $(OBJCPY_FLAGS) $< $@ # Extracts out the loadable EEPROM memory data from the project ELF file, and creates an Intel HEX format file of it %.eep: %.elf @echo $(MSG_OBJCPY_CMD) Extracting EEP file data from \"$<\" - $(CROSS)-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings $< $@ || exit 0 + $(CROSS)-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings $(OBJCPY_FLAGS) $< $@ || exit 0 # Creates an assembly listing file from an input project ELF file, containing interleaved assembly and source data %.lss: %.elf From af576c2fb35256ed0f559d631922dad207d9820c Mon Sep 17 00:00:00 2001 From: Paul Chavent Date: Sat, 19 Jul 2014 00:30:26 +0200 Subject: [PATCH 3/4] Port the VirtualSerial demo to the evk1101. This is an initial port. Some rewrite for better integration and portability to other UC3 devices will be required. However, with an "out of the box EVK1101", you can issue : make -f makefile.evk1101 make -f makefile.evk1101 dfu The right and down buttons seem to be inoperant. Signed-off-by: Paul Chavent --- .../VirtualSerial/Config/LUFAConfig.h | 37 ++++++++++++++ .../ClassDriver/VirtualSerial/Descriptors.h | 7 ++- .../ClassDriver/VirtualSerial/VirtualSerial.c | 33 ++++++++++-- .../ClassDriver/VirtualSerial/VirtualSerial.h | 6 --- .../VirtualSerial/makefile.evk1101 | 50 +++++++++++++++++++ 5 files changed, 122 insertions(+), 11 deletions(-) create mode 100644 Demos/Device/ClassDriver/VirtualSerial/makefile.evk1101 diff --git a/Demos/Device/ClassDriver/VirtualSerial/Config/LUFAConfig.h b/Demos/Device/ClassDriver/VirtualSerial/Config/LUFAConfig.h index 3c3b68bb1..0925eab17 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/Config/LUFAConfig.h +++ b/Demos/Device/ClassDriver/VirtualSerial/Config/LUFAConfig.h @@ -118,6 +118,43 @@ // #define NO_DEVICE_REMOTE_WAKEUP // #define NO_DEVICE_SELF_POWER + #elif (ARCH == ARCH_UC3) + + /* Non-USB Related Configuration Tokens: */ +// #define DISABLE_TERMINAL_CODES + + /* USB Class Driver Related Tokens: */ +// #define HID_HOST_BOOT_PROTOCOL_ONLY +// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here} +// #define HID_USAGE_STACK_DEPTH {Insert Value Here} +// #define HID_MAX_COLLECTIONS {Insert Value Here} +// #define HID_MAX_REPORTITEMS {Insert Value Here} +// #define HID_MAX_REPORT_IDS {Insert Value Here} +// #define NO_CLASS_DRIVER_AUTOFLUSH + + /* General USB Driver Related Tokens: */ +// #define ORDERED_EP_CONFIG + #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_GCLK_SRC_PLL | USB_OPT_GCLK_CHANNEL_0) + #define USB_DEVICE_ONLY +// #define USB_HOST_ONLY +// #define USB_STREAM_TIMEOUT_MS {Insert Value Here} +// #define NO_SOF_EVENTS + + /* USB Device Mode Driver Related Tokens: */ +// #define NO_INTERNAL_SERIAL + #define FIXED_CONTROL_ENDPOINT_SIZE 32 + #define FIXED_NUM_CONFIGURATIONS 1 +// #define CONTROL_ONLY_DEVICE +// #define INTERRUPT_CONTROL_ENDPOINT +// #define NO_DEVICE_REMOTE_WAKEUP +// #define NO_DEVICE_SELF_POWER + + /* USB Host Mode Driver Related Tokens: */ +// #define USB_HOST_TIMEOUT_MS {Insert Value Here} +// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here} +// #define NO_AUTO_VBUS_MANAGEMENT +// #define INVERTED_VBUS_ENABLE_LINE + #else #error Unsupported architecture for this LUFA configuration file. diff --git a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h b/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h index 733d08dc2..56fa0b1c4 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h +++ b/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h @@ -37,9 +37,12 @@ #define _DESCRIPTORS_H_ /* Includes: */ - #include - #include + #include + +#if ((ARCH == ARCH_AVR8) || (ARCH == ARCH_XMEGA)) + #include +#endif /* Macros: */ /** Endpoint address of the CDC device-to-host notification IN endpoint. */ diff --git a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c index 2d98df760..0066e9838 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c +++ b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c @@ -36,6 +36,17 @@ #include "VirtualSerial.h" +#if ((ARCH == ARCH_AVR8) || (ARCH == ARCH_XMEGA)) +#include +#include +#include +#include +#elif (ARCH == ARCH_UC3) +#include +#endif +#include +#include + /** LUFA CDC Class driver interface configuration and state information. This structure is * passed to all CDC Class driver functions, so that multiple instances of the same class * within a device can be differentiated from one another. @@ -69,8 +80,9 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = /** Standard file stream for the CDC interface when set up, so that the virtual CDC COM port can be * used like any regular character stream in the C APIs. */ +#if defined(FDEV_SETUP_STREAM) static FILE USBSerialStream; - +#endif /** Main program entry point. This routine contains the overall program flow, including initial * setup of all components and the main program loop. @@ -79,8 +91,10 @@ int main(void) { SetupHardware(); +#if defined(FDEV_SETUP_STREAM) /* Create a regular character stream for the interface so that it can be used with the stdio.h functions */ CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream); +#endif LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); @@ -117,6 +131,16 @@ void SetupHardware(void) XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, F_USB); PMIC.CTRL = PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm; +#elif (ARCH == ARCH_UC3) + // Start the master external oscillator which will be used as the main clock reference + UC3CLK_StartExternalOscillator(0, EXOSC_MODE_8MHZ_OR_MORE, EXOSC_START_0CLK); + // Start the PLL for the CPU clock, switch CPU to it + UC3CLK_StartPLL(0, CLOCK_SRC_OSC0, F_CPU, F_USB); + UC3CLK_SetCPUClockSource(CLOCK_SRC_OSC0, F_CPU); + + // Init interrupt controller driver + INTC_Init(); + INTC_RegisterGroupHandler(INTC_IRQ_GROUP(AVR32_USBB_IRQ), 1, &USB_GEN_vect); #endif /* Hardware Initialization */ @@ -149,11 +173,14 @@ void CheckJoystickMovement(void) { ActionSent = true; +#if defined(FDEV_SETUP_STREAM) /* Write the string to the virtual COM port via the created character stream */ fputs(ReportString, &USBSerialStream); - +#else /* Alternatively, without the stream: */ - // CDC_Device_SendString(&VirtualSerial_CDC_Interface, ReportString); + CDC_Device_SendString(&VirtualSerial_CDC_Interface, ReportString); +#endif + } } diff --git a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h index ad4f74f31..65b5b02d4 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h +++ b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h @@ -37,12 +37,6 @@ #define _VIRTUALSERIAL_H_ /* Includes: */ - #include - #include - #include - #include - #include - #include #include "Descriptors.h" diff --git a/Demos/Device/ClassDriver/VirtualSerial/makefile.evk1101 b/Demos/Device/ClassDriver/VirtualSerial/makefile.evk1101 new file mode 100644 index 000000000..a5bb1bf29 --- /dev/null +++ b/Demos/Device/ClassDriver/VirtualSerial/makefile.evk1101 @@ -0,0 +1,50 @@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2014. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# +# -------------------------------------- +# LUFA Project Makefile. +# -------------------------------------- + +# Run "make help" for target help. + +MCU = at32uc3b0256 +ARCH = UC3 +BOARD = EVK1101 +F_CPU = 12000000 +F_USB = 48000000 +OPTIMIZATION = 2 +TARGET = VirtualSerial +SRC = $(TARGET).c Descriptors.c \ + $(LUFA_SRC_USB) \ + $(LUFA_SRC_USBCLASS) \ + $(LUFA_SRC_PLATFORM) +LUFA_PATH = ../../../../LUFA +CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ + +# Specific to the EVK1101 +# Allows to run with DFU +LD_FLAGS = -Wl,--section-start,.reset=0x80002000 +OBJCPY_FLAGS = --change-section-address .reset=0x80002000 + +# Specific to the big endian platforms +# Allows to create UTF-16LE string descriptors +Descriptors.o : CC_FLAGS+=-fshort-wchar -fwide-exec-charset=UTF-16LE + +# Default target +all: + +# Include LUFA build script makefiles +include $(LUFA_PATH)/Build/lufa_core.mk +include $(LUFA_PATH)/Build/lufa_sources.mk +include $(LUFA_PATH)/Build/lufa_build.mk +include $(LUFA_PATH)/Build/lufa_cppcheck.mk +include $(LUFA_PATH)/Build/lufa_doxygen.mk +include $(LUFA_PATH)/Build/lufa_dfu.mk +include $(LUFA_PATH)/Build/lufa_hid.mk +include $(LUFA_PATH)/Build/lufa_avrdude.mk +include $(LUFA_PATH)/Build/lufa_atprogram.mk + From afe51e83cba985d66f38e89828a5984a933688fd Mon Sep 17 00:00:00 2001 From: Paul Chavent Date: Sun, 20 Jul 2014 18:19:48 +0200 Subject: [PATCH 4/4] Fix clean target. Remove the lib.a since the build rule of .a append a lib prefix. Allow to override the clean target : this way we can remove added lst files for instance. --- LUFA/Build/lufa_build.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LUFA/Build/lufa_build.mk b/LUFA/Build/lufa_build.mk index 95ba3e467..92f0b710c 100644 --- a/LUFA/Build/lufa_build.mk +++ b/LUFA/Build/lufa_build.mk @@ -253,9 +253,9 @@ mostlyclean: rm -f $(DEPENDENCY_FILES) # Cleans all build files, leaving only the original source code -clean: mostlyclean +clean:: mostlyclean @echo $(MSG_REMOVE_CMD) Removing output files of \"$(TARGET)\" - rm -f $(TARGET).elf $(TARGET).hex $(TARGET).bin $(TARGET).eep $(TARGET).map $(TARGET).lss $(TARGET).sym $(TARGET).a + rm -f $(TARGET).elf $(TARGET).hex $(TARGET).bin $(TARGET).eep $(TARGET).map $(TARGET).lss $(TARGET).sym lib$(TARGET).a # Performs a complete build of the user application and prints size information afterwards all: build_begin elf hex bin lss sym size build_end