Skip to content

Commit ca3925a

Browse files
authored
Merge pull request #2708 from BrentK-ADI/max32_port
Add port for Analog Devices MAX32 MCUs
2 parents b8d3c0c + 635bdc1 commit ca3925a

File tree

85 files changed

+5268
-3001
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+5268
-3001
lines changed

.github/workflows/ci_set_matrix.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"lpc11 lpc13 lpc15": ["arm-gcc", "arm-clang"],
2323
"lpc17 lpc18 lpc40 lpc43": ["arm-gcc", "arm-clang"],
2424
"lpc51 lpc54 lpc55": ["arm-gcc", "arm-clang"],
25+
"max32650 max32666 max32690 max78002": ["arm-gcc"],
2526
"mcx": ["arm-gcc"],
2627
"mm32": ["arm-gcc"],
2728
"msp430": ["msp430-gcc"],

.idea/cmake.xml

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
|Build Status| |Documentation Status| |Fuzzing Status| |License|
1+
|Build Status| |CircleCI Status| |Documentation Status| |Fuzzing Status| |License|
22

33
Sponsors
44
========
@@ -197,6 +197,8 @@ Docs
197197

198198
.. |Build Status| image:: https://github.com/hathach/tinyusb/actions/workflows/cmake_arm.yml/badge.svg
199199
:target: https://github.com/hathach/tinyusb/actions
200+
.. |CircleCI Status| image:: https://dl.circleci.com/status-badge/img/circleci/4AYHvUhFxdnY4rA7LEsdqW/QmrpoL2AjGqetvFQNqtWyq/tree/master.svg?style=svg
201+
:target: https://dl.circleci.com/status-badge/redirect/circleci/4AYHvUhFxdnY4rA7LEsdqW/QmrpoL2AjGqetvFQNqtWyq/tree/master
200202
.. |Documentation Status| image:: https://readthedocs.org/projects/tinyusb/badge/?version=latest
201203
:target: https://docs.tinyusb.org/en/latest/?badge=latest
202204
.. |Fuzzing Status| image:: https://oss-fuzz-build-logs.storage.googleapis.com/badges/tinyusb.svg

examples/build_system/make/rules.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ flash-bmp: $(BUILD)/$(PROJECT).elf
166166
debug-bmp: $(BUILD)/$(PROJECT).elf
167167
$(GDB) -ex 'target extended-remote $(BMP)' -ex 'monitor swdp_scan' -ex 'attach 1' $<
168168

169+
# --------------- TI Uniflash -----------------
170+
DSLITE ?= dslite.sh
171+
flash-uniflash: $(BUILD)/$(PROJECT).hex
172+
${DSLITE} ${UNIFLASH_OPTION} -f $<
173+
169174
#-------------- Artifacts --------------
170175

171176
# Create binary directory

examples/device/cdc_dual_ports/src/usb_descriptors.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,19 @@ enum
9898
#define EPNUM_CDC_1_OUT 0x05
9999
#define EPNUM_CDC_1_IN 0x85
100100

101-
#elif CFG_TUSB_MCU == OPT_MCU_SAMG || CFG_TUSB_MCU == OPT_MCU_SAMX7X
102-
// SAMG & SAME70 don't support a same endpoint number with different direction IN and OUT
103-
// e.g EP1 OUT & EP1 IN cannot exist together
104-
#define EPNUM_CDC_0_NOTIF 0x81
101+
#elif CFG_TUSB_MCU == OPT_MCU_CXD56
102+
// CXD56 USB driver has fixed endpoint type (bulk/interrupt/iso) and direction (IN/OUT) by its number
103+
// 0 control (IN/OUT), 1 Bulk (IN), 2 Bulk (OUT), 3 In (IN), 4 Bulk (IN), 5 Bulk (OUT), 6 In (IN)
104+
#define EPNUM_CDC_0_NOTIF 0x83
105105
#define EPNUM_CDC_0_OUT 0x02
106-
#define EPNUM_CDC_0_IN 0x83
106+
#define EPNUM_CDC_0_IN 0x81
107107

108-
#define EPNUM_CDC_1_NOTIF 0x84
108+
#define EPNUM_CDC_1_NOTIF 0x86
109109
#define EPNUM_CDC_1_OUT 0x05
110-
#define EPNUM_CDC_1_IN 0x86
110+
#define EPNUM_CDC_1_IN 0x84
111111

112-
#elif CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X
113-
// FT9XX doesn't support a same endpoint number with different direction IN and OUT
112+
#elif defined(TUD_ENDPOINT_EXCLUSIVE_NUMBER)
113+
// MCUs that don't support a same endpoint number with different direction IN and OUT defined in tusb_mcu.h
114114
// e.g EP1 OUT & EP1 IN cannot exist together
115115
#define EPNUM_CDC_0_NOTIF 0x81
116116
#define EPNUM_CDC_0_OUT 0x02

examples/device/cdc_msc/src/usb_descriptors.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,7 @@ enum {
9393
#define EPNUM_MSC_OUT 0x05
9494
#define EPNUM_MSC_IN 0x85
9595

96-
#elif CFG_TUSB_MCU == OPT_MCU_SAMG || CFG_TUSB_MCU == OPT_MCU_SAMX7X
97-
// SAMG & SAME70 don't support a same endpoint number with different direction IN and OUT
98-
// e.g EP1 OUT & EP1 IN cannot exist together
99-
#define EPNUM_CDC_NOTIF 0x81
100-
#define EPNUM_CDC_OUT 0x02
101-
#define EPNUM_CDC_IN 0x83
102-
103-
#define EPNUM_MSC_OUT 0x04
104-
#define EPNUM_MSC_IN 0x85
105-
10696
#elif CFG_TUSB_MCU == OPT_MCU_CXD56
107-
// CXD56 doesn't support a same endpoint number with different direction IN and OUT
108-
// e.g EP1 OUT & EP1 IN cannot exist together
10997
// CXD56 USB driver has fixed endpoint type (bulk/interrupt/iso) and direction (IN/OUT) by its number
11098
// 0 control (IN/OUT), 1 Bulk (IN), 2 Bulk (OUT), 3 In (IN), 4 Bulk (IN), 5 Bulk (OUT), 6 In (IN)
11199
#define EPNUM_CDC_NOTIF 0x83
@@ -115,8 +103,8 @@ enum {
115103
#define EPNUM_MSC_OUT 0x05
116104
#define EPNUM_MSC_IN 0x84
117105

118-
#elif CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X
119-
// FT9XX doesn't support a same endpoint number with different direction IN and OUT
106+
#elif defined(TUD_ENDPOINT_EXCLUSIVE_NUMBER)
107+
// MCUs that don't support a same endpoint number with different direction IN and OUT defined in tusb_mcu.h
120108
// e.g EP1 OUT & EP1 IN cannot exist together
121109
#define EPNUM_CDC_NOTIF 0x81
122110
#define EPNUM_CDC_OUT 0x02

examples/device/cdc_msc_freertos/src/usb_descriptors.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@
4242
//--------------------------------------------------------------------+
4343
// Device Descriptors
4444
//--------------------------------------------------------------------+
45-
tusb_desc_device_t const desc_device =
46-
{
45+
tusb_desc_device_t const desc_device = {
4746
.bLength = sizeof(tusb_desc_device_t),
4847
.bDescriptorType = TUSB_DESC_DEVICE,
4948
.bcdUSB = USB_BCD,
@@ -69,17 +68,15 @@ tusb_desc_device_t const desc_device =
6968

7069
// Invoked when received GET DEVICE DESCRIPTOR
7170
// Application return pointer to descriptor
72-
uint8_t const * tud_descriptor_device_cb(void)
73-
{
71+
uint8_t const *tud_descriptor_device_cb(void) {
7472
return (uint8_t const *) &desc_device;
7573
}
7674

7775
//--------------------------------------------------------------------+
7876
// Configuration Descriptor
7977
//--------------------------------------------------------------------+
8078

81-
enum
82-
{
79+
enum {
8380
ITF_NUM_CDC = 0,
8481
ITF_NUM_CDC_DATA,
8582
ITF_NUM_MSC,
@@ -96,8 +93,18 @@ enum
9693
#define EPNUM_MSC_OUT 0x05
9794
#define EPNUM_MSC_IN 0x85
9895

99-
#elif CFG_TUSB_MCU == OPT_MCU_SAMG
100-
// SAMG doesn't support a same endpoint number with different direction IN and OUT
96+
#elif CFG_TUSB_MCU == OPT_MCU_CXD56
97+
// CXD56 USB driver has fixed endpoint type (bulk/interrupt/iso) and direction (IN/OUT) by its number
98+
// 0 control (IN/OUT), 1 Bulk (IN), 2 Bulk (OUT), 3 In (IN), 4 Bulk (IN), 5 Bulk (OUT), 6 In (IN)
99+
#define EPNUM_CDC_NOTIF 0x83
100+
#define EPNUM_CDC_OUT 0x02
101+
#define EPNUM_CDC_IN 0x81
102+
103+
#define EPNUM_MSC_OUT 0x05
104+
#define EPNUM_MSC_IN 0x84
105+
106+
#elif defined(TUD_ENDPOINT_EXCLUSIVE_NUMBER)
107+
// MCUs that don't support a same endpoint number with different direction IN and OUT defined in tusb_mcu.h
101108
// e.g EP1 OUT & EP1 IN cannot exist together
102109
#define EPNUM_CDC_NOTIF 0x81
103110
#define EPNUM_CDC_OUT 0x02

examples/device/cdc_uac2/src/usb_descriptors.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,8 @@ uint8_t const * tud_descriptor_device_cb(void)
9797
#define EPNUM_CDC_OUT 0x02
9898
#define EPNUM_CDC_IN 0x82
9999

100-
#elif CFG_TUSB_MCU == OPT_MCU_SAMG || CFG_TUSB_MCU == OPT_MCU_SAMX7X
101-
// SAMG & SAME70 don't support a same endpoint number with different direction IN and OUT
102-
// e.g EP1 OUT & EP1 IN cannot exist together
103-
#define EPNUM_AUDIO_IN 0x01
104-
#define EPNUM_AUDIO_OUT 0x02
105-
106-
#define EPNUM_CDC_NOTIF 0x83
107-
#define EPNUM_CDC_OUT 0x04
108-
#define EPNUM_CDC_IN 0x85
109-
110-
#elif CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X
111-
// FT9XX doesn't support a same endpoint number with different direction IN and OUT
100+
#elif defined(TUD_ENDPOINT_EXCLUSIVE_NUMBER)
101+
// MCUs that don't support a same endpoint number with different direction IN and OUT defined in tusb_mcu.h
112102
// e.g EP1 OUT & EP1 IN cannot exist together
113103
#define EPNUM_AUDIO_IN 0x01
114104
#define EPNUM_AUDIO_OUT 0x02

examples/device/dynamic_configuration/src/usb_descriptors.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -132,21 +132,8 @@ enum
132132
#define EPNUM_1_MSC_OUT 0x02
133133
#define EPNUM_1_MSC_IN 0x82
134134

135-
#elif CFG_TUSB_MCU == OPT_MCU_SAMG
136-
// SAMG doesn't support a same endpoint number with different direction IN and OUT
137-
// e.g EP1 OUT & EP1 IN cannot exist together
138-
#define EPNUM_0_CDC_NOTIF 0x81
139-
#define EPNUM_0_CDC_OUT 0x02
140-
#define EPNUM_0_CDC_IN 0x83
141-
142-
#define EPNUM_0_MIDI_OUT 0x04
143-
#define EPNUM_0_MIDI_IN 0x85
144-
145-
#define EPNUM_1_MSC_OUT 0x01
146-
#define EPNUM_1_MSC_IN 0x82
147-
148-
#elif CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X
149-
// FT9XX doesn't support a same endpoint number with different direction IN and OUT
135+
#elif defined(TUD_ENDPOINT_EXCLUSIVE_NUMBER)
136+
// MCUs that don't support a same endpoint number with different direction IN and OUT defined in tusb_mcu.h
150137
// e.g EP1 OUT & EP1 IN cannot exist together
151138
#define EPNUM_0_CDC_NOTIF 0x81
152139
#define EPNUM_0_CDC_OUT 0x02

examples/device/midi_test/src/usb_descriptors.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,24 @@ enum
8484
#if CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX
8585
// LPC 17xx and 40xx endpoint type (bulk/interrupt/iso) are fixed by its number
8686
// 0 control, 1 In, 2 Bulk, 3 Iso, 4 In etc ...
87-
#define EPNUM_MIDI_OUT 0x02
88-
#define EPNUM_MIDI_IN 0x02
89-
#elif CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X
90-
// On Bridgetek FT9xx endpoint numbers must be unique...
91-
#define EPNUM_MIDI_OUT 0x02
92-
#define EPNUM_MIDI_IN 0x03
87+
#define EPNUM_MIDI_OUT 0x02
88+
#define EPNUM_MIDI_IN 0x82
89+
90+
#elif CFG_TUSB_MCU == OPT_MCU_CXD56
91+
// CXD56 USB driver has fixed endpoint type (bulk/interrupt/iso) and direction (IN/OUT) by its number
92+
// 0 control (IN/OUT), 1 Bulk (IN), 2 Bulk (OUT), 3 In (IN), 4 Bulk (IN), 5 Bulk (OUT), 6 In (IN)
93+
#define EPNUM_MIDI_OUT 0x02
94+
#define EPNUM_MIDI_IN 0x81
95+
96+
#elif defined(TUD_ENDPOINT_EXCLUSIVE_NUMBER)
97+
// MCUs that don't support a same endpoint number with different direction IN and OUT defined in tusb_mcu.h
98+
// e.g EP1 OUT & EP1 IN cannot exist together
99+
#define EPNUM_MIDI_OUT 0x01
100+
#define EPNUM_MIDI_IN 0x82
101+
93102
#else
94-
#define EPNUM_MIDI_OUT 0x01
95-
#define EPNUM_MIDI_IN 0x01
103+
#define EPNUM_MIDI_OUT 0x01
104+
#define EPNUM_MIDI_IN 0x81
96105
#endif
97106

98107
uint8_t const desc_fs_configuration[] =

examples/device/msc_dual_lun/src/usb_descriptors.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,17 @@ enum
8585
#define EPNUM_MSC_OUT 0x02
8686
#define EPNUM_MSC_IN 0x82
8787

88-
#elif CFG_TUSB_MCU == OPT_MCU_SAMG
89-
// SAMG doesn't support a same endpoint number with different direction IN and OUT
90-
// e.g EP1 OUT & EP1 IN cannot exist together
91-
#define EPNUM_MSC_OUT 0x01
92-
#define EPNUM_MSC_IN 0x82
93-
94-
#elif CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X
95-
// FT9XX doesn't support a same endpoint number with different direction IN and OUT
88+
#elif CFG_TUSB_MCU == OPT_MCU_CXD56
89+
// CXD56 USB driver has fixed endpoint type (bulk/interrupt/iso) and direction (IN/OUT) by its number
90+
// 0 control (IN/OUT), 1 Bulk (IN), 2 Bulk (OUT), 3 In (IN), 4 Bulk (IN), 5 Bulk (OUT), 6 In (IN)
91+
#define EPNUM_MSC_OUT 0x02
92+
#define EPNUM_MSC_IN 0x81
93+
94+
#elif defined(TUD_ENDPOINT_EXCLUSIVE_NUMBER)
95+
// MCUs that don't support a same endpoint number with different direction IN and OUT defined in tusb_mcu.h
9696
// e.g EP1 OUT & EP1 IN cannot exist together
97-
#define EPNUM_MSC_OUT 0x01
98-
#define EPNUM_MSC_IN 0x82
97+
#define EPNUM_MSC_OUT 0x01
98+
#define EPNUM_MSC_IN 0x82
9999

100100
#else
101101
#define EPNUM_MSC_OUT 0x01

examples/device/net_lwip_webserver/src/tusb_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ extern "C" {
9191
#define USE_ECM 1
9292
#elif TU_CHECK_MCU(OPT_MCU_STM32F0, OPT_MCU_STM32F1)
9393
#define USE_ECM 1
94+
#elif TU_CHECK_MCU(OPT_MCU_MAX32690, OPT_MCU_MAX32650, OPT_MCU_MAX32666, OPT_MCU_MAX78002)
95+
#define USE_ECM 1
9496
#else
9597
#define USE_ECM 0
9698
#define INCLUDE_IPERF

examples/device/net_lwip_webserver/src/usb_descriptors.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,15 @@ uint8_t const * tud_descriptor_device_cb(void)
113113
#define EPNUM_NET_OUT 0x02
114114
#define EPNUM_NET_IN 0x82
115115

116-
#elif CFG_TUSB_MCU == OPT_MCU_SAMG || CFG_TUSB_MCU == OPT_MCU_SAMX7X
117-
// SAMG & SAME70 don't support a same endpoint number with different direction IN and OUT
116+
#elif CFG_TUSB_MCU == OPT_MCU_CXD56
117+
// CXD56 USB driver has fixed endpoint type (bulk/interrupt/iso) and direction (IN/OUT) by its number
118+
// 0 control (IN/OUT), 1 Bulk (IN), 2 Bulk (OUT), 3 In (IN), 4 Bulk (IN), 5 Bulk (OUT), 6 In (IN)
119+
#define EPNUM_NET_NOTIF 0x83
120+
#define EPNUM_NET_OUT 0x02
121+
#define EPNUM_NET_IN 0x81
122+
123+
#elif defined(TUD_ENDPOINT_EXCLUSIVE_NUMBER)
124+
// MCUs that don't support a same endpoint number with different direction IN and OUT defined in tusb_mcu.h
118125
// e.g EP1 OUT & EP1 IN cannot exist together
119126
#define EPNUM_NET_NOTIF 0x81
120127
#define EPNUM_NET_OUT 0x02

examples/device/uac2_headset/src/usb_descriptors.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,21 @@ uint8_t const * tud_descriptor_device_cb(void)
8484
#define EPNUM_AUDIO_OUT 0x03
8585
#define EPNUM_AUDIO_INT 0x01
8686

87+
#elif CFG_TUSB_MCU == OPT_MCU_CXD56
88+
// CXD56 USB driver has fixed endpoint type (bulk/interrupt/iso) and direction (IN/OUT) by its number
89+
// 0 control (IN/OUT), 1 Bulk (IN), 2 Bulk (OUT), 3 In (IN), 4 Bulk (IN), 5 Bulk (OUT), 6 In (IN)
90+
// #define EPNUM_AUDIO_IN 0x01
91+
// #define EPNUM_AUDIO_OUT 0x02
92+
// #define EPNUM_AUDIO_INT 0x03
93+
8794
#elif CFG_TUSB_MCU == OPT_MCU_NRF5X
8895
// ISO endpoints for NRF5x are fixed to 0x08 (0x88)
8996
#define EPNUM_AUDIO_IN 0x08
9097
#define EPNUM_AUDIO_OUT 0x08
9198
#define EPNUM_AUDIO_INT 0x01
9299

93-
#elif CFG_TUSB_MCU == OPT_MCU_SAMG || CFG_TUSB_MCU == OPT_MCU_SAMX7X
94-
// SAMG & SAME70 don't support a same endpoint number with different direction IN and OUT
95-
// e.g EP1 OUT & EP1 IN cannot exist together
96-
#define EPNUM_AUDIO_IN 0x01
97-
#define EPNUM_AUDIO_OUT 0x02
98-
#define EPNUM_AUDIO_INT 0x03
99-
100-
#elif CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X
101-
// FT9XX doesn't support a same endpoint number with different direction IN and OUT
100+
#elif defined(TUD_ENDPOINT_EXCLUSIVE_NUMBER)
101+
// MCUs that don't support a same endpoint number with different direction IN and OUT defined in tusb_mcu.h
102102
// e.g EP1 OUT & EP1 IN cannot exist together
103103
#define EPNUM_AUDIO_IN 0x01
104104
#define EPNUM_AUDIO_OUT 0x02

examples/device/uac2_speaker_fb/src/usb_descriptors.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,8 @@ uint8_t const * tud_hid_descriptor_report_cb(uint8_t itf)
131131
#define EPNUM_AUDIO_OUT 0x08
132132
#define EPNUM_DEBUG 0x01
133133

134-
#elif CFG_TUSB_MCU == OPT_MCU_SAMG || CFG_TUSB_MCU == OPT_MCU_SAMX7X
135-
// SAMG & SAME70 don't support a same endpoint number with different direction IN and OUT
136-
// e.g EP1 OUT & EP1 IN cannot exist together
137-
#define EPNUM_AUDIO_FB 0x01
138-
#define EPNUM_AUDIO_OUT 0x02
139-
#define EPNUM_DEBUG 0x03
140-
141-
#elif CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X
142-
// FT9XX doesn't support a same endpoint number with different direction IN and OUT
134+
#elif defined(TUD_ENDPOINT_EXCLUSIVE_NUMBER)
135+
// MCUs that don't support a same endpoint number with different direction IN and OUT defined in tusb_mcu.h
143136
// e.g EP1 OUT & EP1 IN cannot exist together
144137
#define EPNUM_AUDIO_FB 0x01
145138
#define EPNUM_AUDIO_OUT 0x02

0 commit comments

Comments
 (0)