Skip to content

Commit 7ca8ddb

Browse files
authored
Merge pull request #57 from r2axz/r2axz-fix-compile-issues
FIX: compilation Issues (non const initializers, versioning)
2 parents d05b316 + c82d7f2 commit 7ca8ddb

2 files changed

Lines changed: 21 additions & 17 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ ifneq ($(FIRMWARE_ORIGIN),)
4444
LDFLAGS += -Wl,-section-start=.isr_vector=$(FIRMWARE_ORIGIN)
4545
endif
4646

47-
GIT_VERSION := $(subst ., ,$(subst v,,$(shell git describe --abbrev=0 --tags 2>/dev/null || true)))
47+
GIT_VERSION := $(subst ., ,$(subst v,,$(shell git describe --abbrev=0 --tags --match "v*" 2>/dev/null || true)))
4848

4949
ifneq ($(GIT_VERSION),)
5050
GIT_VERSION_MAJOR := $(word 1, $(GIT_VERSION))

usb_descriptors.c

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
#define USB_CDC_DATA_ENDPOINT_SIZE_SMALL 32
1515
#define USB_CDC_DATA_ENDPOINT_SIZE_LARGE 64
1616

17+
#define USB_CDC_DATA_0_ENDPOINT_SIZE USB_CDC_DATA_ENDPOINT_SIZE_SMALL
18+
#define USB_CDC_DATA_1_ENDPOINT_SIZE USB_CDC_DATA_ENDPOINT_SIZE_LARGE
19+
#define USB_CDC_DATA_2_ENDPOINT_SIZE USB_CDC_DATA_ENDPOINT_SIZE_LARGE
20+
1721
#define USB_CDC_INTERRUPT_ENDPOINT_POLLING_INTERVAL 20
1822

1923
const usb_endpoint_t usb_endpoints[usb_endpoint_address_last] = {
@@ -34,8 +38,8 @@ const usb_endpoint_t usb_endpoints[usb_endpoint_address_last] = {
3438
/* CDC 0 Data Endpoint */
3539
{
3640
.type = usb_endpoint_type_bulk,
37-
.rx_size = USB_CDC_DATA_ENDPOINT_SIZE_SMALL,
38-
.tx_size = USB_CDC_DATA_ENDPOINT_SIZE_SMALL,
41+
.rx_size = USB_CDC_DATA_0_ENDPOINT_SIZE,
42+
.tx_size = USB_CDC_DATA_0_ENDPOINT_SIZE,
3943
.event_handler = usb_cdc_data_endpoint_event_handler,
4044
},
4145
/* CDC 1 Interrupt Endpoint */
@@ -48,8 +52,8 @@ const usb_endpoint_t usb_endpoints[usb_endpoint_address_last] = {
4852
/* CDC 1 Data Endpoint */
4953
{
5054
.type = usb_endpoint_type_bulk,
51-
.rx_size = USB_CDC_DATA_ENDPOINT_SIZE_LARGE,
52-
.tx_size = USB_CDC_DATA_ENDPOINT_SIZE_LARGE,
55+
.rx_size = USB_CDC_DATA_1_ENDPOINT_SIZE,
56+
.tx_size = USB_CDC_DATA_1_ENDPOINT_SIZE,
5357
.event_handler = usb_cdc_data_endpoint_event_handler,
5458
},
5559
/* CDC 2 Interrupt Endpoint */
@@ -62,8 +66,8 @@ const usb_endpoint_t usb_endpoints[usb_endpoint_address_last] = {
6266
/* CDC 2 Data Endpoint */
6367
{
6468
.type = usb_endpoint_type_bulk,
65-
.rx_size = USB_CDC_DATA_ENDPOINT_SIZE_LARGE,
66-
.tx_size = USB_CDC_DATA_ENDPOINT_SIZE_LARGE,
69+
.rx_size = USB_CDC_DATA_2_ENDPOINT_SIZE,
70+
.tx_size = USB_CDC_DATA_2_ENDPOINT_SIZE,
6771
.event_handler = usb_cdc_data_endpoint_event_handler,
6872
},
6973
};
@@ -93,7 +97,7 @@ const usb_device_descriptor_t usb_device_descriptor = {
9397
.bDeviceClass = usb_device_class_misc,
9498
.bDeviceSubClass = usb_device_subclass_iad,
9599
.bDeviceProtocol = usb_device_protocol_iad,
96-
.bMaxPacketSize = usb_endpoints[usb_endpoint_address_control].rx_size,
100+
.bMaxPacketSize = USB_CONTROL_ENDPOINT_SIZE,
97101
.idVendor = USB_ID_VENDOR,
98102
.idProduct = USB_ID_PRODUCT,
99103
.bcdDevice = USB_BCD_VERSION(DEVICE_VERSION_MAJOR, DEVICE_VERSION_MINOR, DEVICE_VERSION_REVISION),
@@ -166,7 +170,7 @@ const usb_device_configuration_descriptor_t usb_configuration_descriptor = {
166170
.bDescriptorType = usb_descriptor_type_endpoint,
167171
.bEndpointAddress = usb_endpoint_direction_in | usb_endpoint_address_cdc_0_interrupt,
168172
.bmAttributes = usb_endpoint_type_interrupt,
169-
.wMaxPacketSize = usb_endpoints[usb_endpoint_address_cdc_0_interrupt].tx_size,
173+
.wMaxPacketSize = USB_CDC_INTERRUPT_ENDPOINT_SIZE,
170174
.bInterval = USB_CDC_INTERRUPT_ENDPOINT_POLLING_INTERVAL,
171175
},
172176
.data_0 = {
@@ -185,15 +189,15 @@ const usb_device_configuration_descriptor_t usb_configuration_descriptor = {
185189
.bDescriptorType = usb_descriptor_type_endpoint,
186190
.bEndpointAddress = usb_endpoint_direction_out | usb_endpoint_address_cdc_0_data,
187191
.bmAttributes = usb_endpoint_type_bulk,
188-
.wMaxPacketSize = usb_endpoints[usb_endpoint_address_cdc_0_data].rx_size,
192+
.wMaxPacketSize = USB_CDC_DATA_0_ENDPOINT_SIZE,
189193
.bInterval = 0,
190194
},
191195
.data_eptx_0 = {
192196
.bLength = sizeof(usb_configuration_descriptor.data_eptx_0),
193197
.bDescriptorType = usb_descriptor_type_endpoint,
194198
.bEndpointAddress = usb_endpoint_direction_in | usb_endpoint_address_cdc_0_data,
195199
.bmAttributes = usb_endpoint_type_bulk,
196-
.wMaxPacketSize = usb_endpoints[usb_endpoint_address_cdc_0_data].tx_size,
200+
.wMaxPacketSize = USB_CDC_DATA_0_ENDPOINT_SIZE,
197201
.bInterval = 0,
198202
},
199203
.comm_iad_1 = {
@@ -248,7 +252,7 @@ const usb_device_configuration_descriptor_t usb_configuration_descriptor = {
248252
.bDescriptorType = usb_descriptor_type_endpoint,
249253
.bEndpointAddress = usb_endpoint_direction_in | usb_endpoint_address_cdc_1_interrupt,
250254
.bmAttributes = usb_endpoint_type_interrupt,
251-
.wMaxPacketSize = usb_endpoints[usb_endpoint_address_cdc_1_interrupt].tx_size,
255+
.wMaxPacketSize = USB_CDC_INTERRUPT_ENDPOINT_SIZE,
252256
.bInterval = USB_CDC_INTERRUPT_ENDPOINT_POLLING_INTERVAL,
253257
},
254258
.data_1 = {
@@ -267,15 +271,15 @@ const usb_device_configuration_descriptor_t usb_configuration_descriptor = {
267271
.bDescriptorType = usb_descriptor_type_endpoint,
268272
.bEndpointAddress = usb_endpoint_direction_out | usb_endpoint_address_cdc_1_data,
269273
.bmAttributes = usb_endpoint_type_bulk,
270-
.wMaxPacketSize = usb_endpoints[usb_endpoint_address_cdc_1_data].rx_size,
274+
.wMaxPacketSize = USB_CDC_DATA_1_ENDPOINT_SIZE,
271275
.bInterval = 0,
272276
},
273277
.data_eptx_1 = {
274278
.bLength = sizeof(usb_configuration_descriptor.data_eptx_1),
275279
.bDescriptorType = usb_descriptor_type_endpoint,
276280
.bEndpointAddress = usb_endpoint_direction_in | usb_endpoint_address_cdc_1_data,
277281
.bmAttributes = usb_endpoint_type_bulk,
278-
.wMaxPacketSize = usb_endpoints[usb_endpoint_address_cdc_1_data].tx_size,
282+
.wMaxPacketSize = USB_CDC_DATA_1_ENDPOINT_SIZE,
279283
.bInterval = 0,
280284
},
281285
.comm_iad_2 = {
@@ -330,7 +334,7 @@ const usb_device_configuration_descriptor_t usb_configuration_descriptor = {
330334
.bDescriptorType = usb_descriptor_type_endpoint,
331335
.bEndpointAddress = usb_endpoint_direction_in | usb_endpoint_address_cdc_2_interrupt,
332336
.bmAttributes = usb_endpoint_type_interrupt,
333-
.wMaxPacketSize = usb_endpoints[usb_endpoint_address_cdc_0_interrupt].tx_size,
337+
.wMaxPacketSize = USB_CDC_INTERRUPT_ENDPOINT_SIZE,
334338
.bInterval = USB_CDC_INTERRUPT_ENDPOINT_POLLING_INTERVAL,
335339
},
336340
.data_2 = {
@@ -349,15 +353,15 @@ const usb_device_configuration_descriptor_t usb_configuration_descriptor = {
349353
.bDescriptorType = usb_descriptor_type_endpoint,
350354
.bEndpointAddress = usb_endpoint_direction_out | usb_endpoint_address_cdc_2_data,
351355
.bmAttributes = usb_endpoint_type_bulk,
352-
.wMaxPacketSize = usb_endpoints[usb_endpoint_address_cdc_2_data].rx_size,
356+
.wMaxPacketSize = USB_CDC_DATA_2_ENDPOINT_SIZE,
353357
.bInterval = 0,
354358
},
355359
.data_eptx_2 = {
356360
.bLength = sizeof(usb_configuration_descriptor.data_eptx_2),
357361
.bDescriptorType = usb_descriptor_type_endpoint,
358362
.bEndpointAddress = usb_endpoint_direction_in | usb_endpoint_address_cdc_2_data,
359363
.bmAttributes = usb_endpoint_type_bulk,
360-
.wMaxPacketSize = usb_endpoints[usb_endpoint_address_cdc_2_data].tx_size,
364+
.wMaxPacketSize = USB_CDC_DATA_2_ENDPOINT_SIZE,
361365
.bInterval = 0,
362366
},
363367

0 commit comments

Comments
 (0)