summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrent Kowal <[email protected]>2024-07-01 17:31:38 -0400
committerBrent Kowal <[email protected]>2024-07-01 17:31:38 -0400
commit2353c4ffbaa50072d89008df7a06a7732c824018 (patch)
tree0255e975a33bf06bfb39cdf89062228e8f142dd2
parent0b82af61f3ca7f6b708399c49519fb109ab33abb (diff)
Add MAX78002 Support
-Added support for MAX78002, MAX78002EVKIT -Added provisions for remaining MAX32 USB parts
-rw-r--r--examples/device/cdc_msc/src/usb_descriptors.c3
-rw-r--r--examples/device/cdc_msc_freertos/src/usb_descriptors.c3
-rw-r--r--examples/device/cdc_uac2/src/usb_descriptors.c3
-rw-r--r--examples/device/dynamic_configuration/src/usb_descriptors.c3
-rw-r--r--examples/device/midi_test/src/usb_descriptors.c3
-rw-r--r--examples/device/msc_dual_lun/src/usb_descriptors.c3
-rw-r--r--examples/device/net_lwip_webserver/src/tusb_config.h2
-rw-r--r--examples/device/net_lwip_webserver/src/usb_descriptors.c3
-rw-r--r--examples/device/uac2_headset/src/usb_descriptors.c3
-rw-r--r--examples/device/webusb_serial/src/usb_descriptors.c3
-rw-r--r--hw/bsp/board_mcu.h9
-rw-r--r--hw/bsp/max78002/FreeRTOSConfig/FreeRTOSConfig.h149
-rw-r--r--hw/bsp/max78002/boards/max78002evkit/board.cmake1
-rw-r--r--hw/bsp/max78002/boards/max78002evkit/board.h58
-rw-r--r--hw/bsp/max78002/boards/max78002evkit/board.mk1
-rw-r--r--hw/bsp/max78002/family.c158
-rw-r--r--hw/bsp/max78002/family.cmake152
-rw-r--r--hw/bsp/max78002/family.mk104
-rw-r--r--hw/bsp/max78002/max78002.ld180
-rw-r--r--src/common/tusb_mcu.h3
-rw-r--r--src/portable/analog/max32/dcd_max32.c3
-rw-r--r--src/tusb_option.h3
-rw-r--r--tools/get_deps.py2
23 files changed, 839 insertions, 13 deletions
diff --git a/examples/device/cdc_msc/src/usb_descriptors.c b/examples/device/cdc_msc/src/usb_descriptors.c
index 1ca614f4e..fac7cce8f 100644
--- a/examples/device/cdc_msc/src/usb_descriptors.c
+++ b/examples/device/cdc_msc/src/usb_descriptors.c
@@ -125,7 +125,8 @@ enum {
#define EPNUM_MSC_OUT 0x04
#define EPNUM_MSC_IN 0x85
-#elif CFG_TUSB_MCU == OPT_MCU_MAX32690
+#elif CFG_TUSB_MCU == OPT_MCU_MAX32690 || CFG_TUSB_MCU == OPT_MCU_MAX32650 || \
+ CFG_TUSB_MCU == OPT_MCU_MAX32666 || CFG_TUSB_MCU == OPT_MCU_MAX78002
// MAX32 doesn't support a same endpoint number with different direction IN and OUT
// e.g EP1 OUT & EP1 IN cannot exist together
#define EPNUM_CDC_NOTIF 0x81
diff --git a/examples/device/cdc_msc_freertos/src/usb_descriptors.c b/examples/device/cdc_msc_freertos/src/usb_descriptors.c
index f563e80d3..917b73e10 100644
--- a/examples/device/cdc_msc_freertos/src/usb_descriptors.c
+++ b/examples/device/cdc_msc_freertos/src/usb_descriptors.c
@@ -106,7 +106,8 @@ enum
#define EPNUM_MSC_OUT 0x04
#define EPNUM_MSC_IN 0x85
-#elif CFG_TUSB_MCU == OPT_MCU_MAX32690
+#elif CFG_TUSB_MCU == OPT_MCU_MAX32690 || CFG_TUSB_MCU == OPT_MCU_MAX32650 || \
+ CFG_TUSB_MCU == OPT_MCU_MAX32666 || CFG_TUSB_MCU == OPT_MCU_MAX78002
// MAX32 doesn't support a same endpoint number with different direction IN and OUT
// e.g EP1 OUT & EP1 IN cannot exist together
#define EPNUM_CDC_NOTIF 0x81
diff --git a/examples/device/cdc_uac2/src/usb_descriptors.c b/examples/device/cdc_uac2/src/usb_descriptors.c
index 43e8cf3d7..ab1a2ee83 100644
--- a/examples/device/cdc_uac2/src/usb_descriptors.c
+++ b/examples/device/cdc_uac2/src/usb_descriptors.c
@@ -117,7 +117,8 @@ uint8_t const * tud_descriptor_device_cb(void)
#define EPNUM_CDC_OUT 0x04
#define EPNUM_CDC_IN 0x85
-#elif CFG_TUSB_MCU == OPT_MCU_MAX32690
+#elif CFG_TUSB_MCU == OPT_MCU_MAX32690 || CFG_TUSB_MCU == OPT_MCU_MAX32650 || \
+ CFG_TUSB_MCU == OPT_MCU_MAX32666 || CFG_TUSB_MCU == OPT_MCU_MAX78002
// MAX32 doesn't support a same endpoint number with different direction IN and OUT
// e.g EP1 OUT & EP1 IN cannot exist together
#define EPNUM_AUDIO_IN 0x01
diff --git a/examples/device/dynamic_configuration/src/usb_descriptors.c b/examples/device/dynamic_configuration/src/usb_descriptors.c
index eebdd4f69..20f237155 100644
--- a/examples/device/dynamic_configuration/src/usb_descriptors.c
+++ b/examples/device/dynamic_configuration/src/usb_descriptors.c
@@ -158,7 +158,8 @@ enum
#define EPNUM_1_MSC_OUT 0x01
#define EPNUM_1_MSC_IN 0x82
-#elif CFG_TUSB_MCU == OPT_MCU_MAX32690
+#elif CFG_TUSB_MCU == OPT_MCU_MAX32690 || CFG_TUSB_MCU == OPT_MCU_MAX32650 || \
+ CFG_TUSB_MCU == OPT_MCU_MAX32666 || CFG_TUSB_MCU == OPT_MCU_MAX78002
// FT9XX doesn't support a same endpoint number with different direction IN and OUT
// e.g EP1 OUT & EP1 IN cannot exist together
#define EPNUM_0_CDC_NOTIF 0x81
diff --git a/examples/device/midi_test/src/usb_descriptors.c b/examples/device/midi_test/src/usb_descriptors.c
index 797b50ab2..41e6e1818 100644
--- a/examples/device/midi_test/src/usb_descriptors.c
+++ b/examples/device/midi_test/src/usb_descriptors.c
@@ -90,7 +90,8 @@ enum
// On Bridgetek FT9xx endpoint numbers must be unique...
#define EPNUM_MIDI_OUT 0x02
#define EPNUM_MIDI_IN 0x03
-#elif CFG_TUSB_MCU == OPT_MCU_MAX32690
+#elif CFG_TUSB_MCU == OPT_MCU_MAX32690 || CFG_TUSB_MCU == OPT_MCU_MAX32650 || \
+ CFG_TUSB_MCU == OPT_MCU_MAX32666 || CFG_TUSB_MCU == OPT_MCU_MAX78002
// On MAX32 endpoint numbers must be unique...
#define EPNUM_MIDI_OUT 0x02
#define EPNUM_MIDI_IN 0x03
diff --git a/examples/device/msc_dual_lun/src/usb_descriptors.c b/examples/device/msc_dual_lun/src/usb_descriptors.c
index e32466228..c55bab0d8 100644
--- a/examples/device/msc_dual_lun/src/usb_descriptors.c
+++ b/examples/device/msc_dual_lun/src/usb_descriptors.c
@@ -97,7 +97,8 @@ enum
#define EPNUM_MSC_OUT 0x01
#define EPNUM_MSC_IN 0x82
-#elif CFG_TUSB_MCU == OPT_MCU_MAX32690
+#elif CFG_TUSB_MCU == OPT_MCU_MAX32690 || CFG_TUSB_MCU == OPT_MCU_MAX32650 || \
+ CFG_TUSB_MCU == OPT_MCU_MAX32666 || CFG_TUSB_MCU == OPT_MCU_MAX78002
// MAX32 doesn't support a same endpoint number with different direction IN and OUT
// e.g EP1 OUT & EP1 IN cannot exist together
#define EPNUM_MSC_OUT 0x01
diff --git a/examples/device/net_lwip_webserver/src/tusb_config.h b/examples/device/net_lwip_webserver/src/tusb_config.h
index 2f641f33e..22082fc81 100644
--- a/examples/device/net_lwip_webserver/src/tusb_config.h
+++ b/examples/device/net_lwip_webserver/src/tusb_config.h
@@ -91,7 +91,7 @@ extern "C" {
#define USE_ECM 1
#elif TU_CHECK_MCU(OPT_MCU_STM32F0, OPT_MCU_STM32F1)
#define USE_ECM 1
-#elif TU_CHECK_MCU(OPT_MCU_MAX32690)
+#elif TU_CHECK_MCU(OPT_MCU_MAX32690, OPT_MCU_MAX32650, OPT_MCU_MAX32666, OPT_MCU_MAX78002)
#define USE_ECM 1
#else
#define USE_ECM 0
diff --git a/examples/device/net_lwip_webserver/src/usb_descriptors.c b/examples/device/net_lwip_webserver/src/usb_descriptors.c
index ba30b869e..012e1bcd8 100644
--- a/examples/device/net_lwip_webserver/src/usb_descriptors.c
+++ b/examples/device/net_lwip_webserver/src/usb_descriptors.c
@@ -120,7 +120,8 @@ uint8_t const * tud_descriptor_device_cb(void)
#define EPNUM_NET_OUT 0x02
#define EPNUM_NET_IN 0x83
-#elif CFG_TUSB_MCU == OPT_MCU_MAX32690
+#elif CFG_TUSB_MCU == OPT_MCU_MAX32690 || CFG_TUSB_MCU == OPT_MCU_MAX32650 || \
+ CFG_TUSB_MCU == OPT_MCU_MAX32666 || CFG_TUSB_MCU == OPT_MCU_MAX78002
// MAX32 doesn't support a same endpoint number with different direction IN and OUT
// e.g EP1 OUT & EP1 IN cannot exist together
#define EPNUM_NET_NOTIF 0x81
diff --git a/examples/device/uac2_headset/src/usb_descriptors.c b/examples/device/uac2_headset/src/usb_descriptors.c
index bfc8a4ab5..a042ad206 100644
--- a/examples/device/uac2_headset/src/usb_descriptors.c
+++ b/examples/device/uac2_headset/src/usb_descriptors.c
@@ -104,7 +104,8 @@ uint8_t const * tud_descriptor_device_cb(void)
#define EPNUM_AUDIO_OUT 0x02
#define EPNUM_AUDIO_INT 0x03
-#elif CFG_TUSB_MCU == OPT_MCU_MAX32690
+#elif CFG_TUSB_MCU == OPT_MCU_MAX32690 || CFG_TUSB_MCU == OPT_MCU_MAX32650 || \
+ CFG_TUSB_MCU == OPT_MCU_MAX32666 || CFG_TUSB_MCU == OPT_MCU_MAX78002
// MAX32 doesn't support a same endpoint number with different direction IN and OUT
// e.g EP1 OUT & EP1 IN cannot exist together
#define EPNUM_AUDIO_IN 0x01
diff --git a/examples/device/webusb_serial/src/usb_descriptors.c b/examples/device/webusb_serial/src/usb_descriptors.c
index bcfbe590e..ae1051af6 100644
--- a/examples/device/webusb_serial/src/usb_descriptors.c
+++ b/examples/device/webusb_serial/src/usb_descriptors.c
@@ -105,7 +105,8 @@ enum
#define EPNUM_CDC_OUT 3
#define EPNUM_VENDOR_IN 4
#define EPNUM_VENDOR_OUT 5
-#elif CFG_TUSB_MCU == OPT_MCU_MAX32690
+#elif CFG_TUSB_MCU == OPT_MCU_MAX32690 || CFG_TUSB_MCU == OPT_MCU_MAX32650 || \
+ CFG_TUSB_MCU == OPT_MCU_MAX32666 || CFG_TUSB_MCU == OPT_MCU_MAX78002
// MAX32 doesn't support a same endpoint number with different direction IN and OUT
// e.g EP1 OUT & EP1 IN cannot exist together
#define EPNUM_CDC_IN 2
diff --git a/hw/bsp/board_mcu.h b/hw/bsp/board_mcu.h
index 436164c35..d3a33cf36 100644
--- a/hw/bsp/board_mcu.h
+++ b/hw/bsp/board_mcu.h
@@ -173,6 +173,15 @@
#elif CFG_TUSB_MCU == OPT_MCU_MAX32690
#include "max32690.h"
+#elif CFG_TUSB_MCU == OPT_MCU_MAX32650
+ #include "max32650.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_MAX32666
+ #include "max32665.h"
+
+#elif CFG_TUSB_MCU == OPT_MCU_MAX78002
+ #include "max78002.h"
+
#else
#error "Missing MCU header"
#endif
diff --git a/hw/bsp/max78002/FreeRTOSConfig/FreeRTOSConfig.h b/hw/bsp/max78002/FreeRTOSConfig/FreeRTOSConfig.h
new file mode 100644
index 000000000..e5a76af85
--- /dev/null
+++ b/hw/bsp/max78002/FreeRTOSConfig/FreeRTOSConfig.h
@@ -0,0 +1,149 @@
+/*
+ * FreeRTOS Kernel V10.0.0
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software. If you wish to use our Amazon
+ * FreeRTOS name, please do so in a fair use way that does not cause confusion.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * http://www.FreeRTOS.org
+ * http://aws.amazon.com/freertos
+ *
+ * 1 tab == 4 spaces!
+ */
+
+
+#ifndef FREERTOS_CONFIG_H
+#define FREERTOS_CONFIG_H
+
+/*-----------------------------------------------------------
+ * Application specific definitions.
+ *
+ * These definitions should be adjusted for your particular hardware and
+ * application requirements.
+ *
+ * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
+ * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
+ *
+ * See http://www.freertos.org/a00110.html.
+ *----------------------------------------------------------*/
+
+// skip if included from IAR assembler
+#ifndef __IASMARM__
+ #include "mxc_device.h"
+#endif
+
+/* Cortex M23/M33 port configuration. */
+#define configENABLE_MPU 0
+#define configENABLE_FPU 1
+#define configENABLE_TRUSTZONE 0
+#define configMINIMAL_SECURE_STACK_SIZE (1024)
+
+#define configUSE_PREEMPTION 1
+#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
+#define configCPU_CLOCK_HZ SystemCoreClock
+#define configTICK_RATE_HZ ( 1000 )
+#define configMAX_PRIORITIES ( 5 )
+#define configMINIMAL_STACK_SIZE ( 128 )
+#define configTOTAL_HEAP_SIZE ( configSUPPORT_DYNAMIC_ALLOCATION*4*1024 )
+#define configMAX_TASK_NAME_LEN 16
+#define configUSE_16_BIT_TICKS 0
+#define configIDLE_SHOULD_YIELD 1
+#define configUSE_MUTEXES 1
+#define configUSE_RECURSIVE_MUTEXES 1
+#define configUSE_COUNTING_SEMAPHORES 1
+#define configQUEUE_REGISTRY_SIZE 4
+#define configUSE_QUEUE_SETS 0
+#define configUSE_TIME_SLICING 0
+#define configUSE_NEWLIB_REENTRANT 0
+#define configENABLE_BACKWARD_COMPATIBILITY 1
+#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
+
+#define configSUPPORT_STATIC_ALLOCATION 1
+#define configSUPPORT_DYNAMIC_ALLOCATION 0
+
+/* Hook function related definitions. */
+#define configUSE_IDLE_HOOK 0
+#define configUSE_TICK_HOOK 0
+#define configUSE_MALLOC_FAILED_HOOK 0 // cause nested extern warning
+#define configCHECK_FOR_STACK_OVERFLOW 2
+#define configCHECK_HANDLER_INSTALLATION 0
+
+/* Run time and task stats gathering related definitions. */
+#define configGENERATE_RUN_TIME_STATS 0
+#define configRECORD_STACK_HIGH_ADDRESS 1
+#define configUSE_TRACE_FACILITY 1 // legacy trace
+#define configUSE_STATS_FORMATTING_FUNCTIONS 0
+
+/* Co-routine definitions. */
+#define configUSE_CO_ROUTINES 0
+#define configMAX_CO_ROUTINE_PRIORITIES 2
+
+/* Software timer related definitions. */
+#define configUSE_TIMERS 1
+#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES-2)
+#define configTIMER_QUEUE_LENGTH 32
+#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
+
+/* Optional functions - most linkers will remove unused functions anyway. */
+#define INCLUDE_vTaskPrioritySet 0
+#define INCLUDE_uxTaskPriorityGet 0
+#define INCLUDE_vTaskDelete 0
+#define INCLUDE_vTaskSuspend 1 // required for queue, semaphore, mutex to be blocked indefinitely with portMAX_DELAY
+#define INCLUDE_xResumeFromISR 0
+#define INCLUDE_vTaskDelayUntil 1
+#define INCLUDE_vTaskDelay 1
+#define INCLUDE_xTaskGetSchedulerState 0
+#define INCLUDE_xTaskGetCurrentTaskHandle 1
+#define INCLUDE_uxTaskGetStackHighWaterMark 0
+#define INCLUDE_xTaskGetIdleTaskHandle 0
+#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
+#define INCLUDE_pcTaskGetTaskName 0
+#define INCLUDE_eTaskGetState 0
+#define INCLUDE_xEventGroupSetBitFromISR 0
+#define INCLUDE_xTimerPendFunctionCall 0
+
+/* FreeRTOS hooks to NVIC vectors */
+#define xPortPendSVHandler PendSV_Handler
+#define xPortSysTickHandler SysTick_Handler
+#define vPortSVCHandler SVC_Handler
+
+//--------------------------------------------------------------------+
+// Interrupt nesting behavior configuration.
+//--------------------------------------------------------------------+
+
+// For Cortex-M specific: __NVIC_PRIO_BITS is defined in mcu header
+#define configPRIO_BITS __NVIC_PRIO_BITS
+
+/* The lowest interrupt priority that can be used in a call to a "set priority" function. */
+#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1<<configPRIO_BITS) - 1)
+
+/* The highest interrupt priority that can be used by any interrupt service
+routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
+INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
+PRIORITY THAN THIS! (higher priorities are lower numeric values. */
+#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
+
+/* Interrupt priorities used by the kernel port layer itself. These are generic
+to all Cortex-M ports, and do not rely on any particular library functions. */
+#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
+
+/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
+See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
+#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
+
+#endif
diff --git a/hw/bsp/max78002/boards/max78002evkit/board.cmake b/hw/bsp/max78002/boards/max78002evkit/board.cmake
new file mode 100644
index 000000000..9dc6962eb
--- /dev/null
+++ b/hw/bsp/max78002/boards/max78002evkit/board.cmake
@@ -0,0 +1 @@
+# Nothing to be done at the board level
diff --git a/hw/bsp/max78002/boards/max78002evkit/board.h b/hw/bsp/max78002/boards/max78002evkit/board.h
new file mode 100644
index 000000000..f8102c394
--- /dev/null
+++ b/hw/bsp/max78002/boards/max78002evkit/board.h
@@ -0,0 +1,58 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2024, Brent Kowal (Analog Devices, Inc)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * This file is part of the TinyUSB stack.
+ */
+
+#ifndef BOARD_H_
+#define BOARD_H_
+
+#include "gpio.h"
+#include "mxc_sys.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// LED
+#define LED_PORT MXC_GPIO2
+#define LED_PIN MXC_GPIO_PIN_4
+#define LED_VDDIO MXC_GPIO_VSSEL_VDDIOH
+#define LED_STATE_ON 1
+
+// Button
+#define BUTTON_PORT MXC_GPIO2
+#define BUTTON_PIN MXC_GPIO_PIN_6
+#define BUTTON_PULL MXC_GPIO_PAD_PULL_UP
+#define BUTTON_STATE_ACTIVE 0
+
+// UART Enable for EvKit's Integrated FTDI Adapter. Pin Mux handled by the HAL
+#define UART_NUM 0
+#define UART_PORT MXC_GPIO0
+#define UART_VDDIO_BITS 0xF
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BOARD_H_ */
diff --git a/hw/bsp/max78002/boards/max78002evkit/board.mk b/hw/bsp/max78002/boards/max78002evkit/board.mk
new file mode 100644
index 000000000..a813a5327
--- /dev/null
+++ b/hw/bsp/max78002/boards/max78002evkit/board.mk
@@ -0,0 +1 @@
+# No specific build requirements for the board.
diff --git a/hw/bsp/max78002/family.c b/hw/bsp/max78002/family.c
new file mode 100644
index 000000000..c105f056b
--- /dev/null
+++ b/hw/bsp/max78002/family.c
@@ -0,0 +1,158 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2024 Brent Kowal (Analog Devices, Inc)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * This file is part of the TinyUSB stack.
+ */
+
+#include "board.h"
+#include "bsp/board_api.h"
+#include "gpio.h"
+#include "mcr_regs.h"
+#include "mxc_device.h"
+#include "uart.h"
+
+//--------------------------------------------------------------------+
+// Forward USB interrupt events to TinyUSB IRQ Handler
+//--------------------------------------------------------------------+
+void USB_IRQHandler(void) {
+ tud_int_handler(0);
+}
+
+//--------------------------------------------------------------------+
+// MACRO TYPEDEF CONSTANT ENUM
+//--------------------------------------------------------------------+
+mxc_uart_regs_t *ConsoleUart = MXC_UART_GET_UART(UART_NUM);
+
+void board_init(void) {
+#if CFG_TUSB_OS == OPT_OS_NONE
+ // 1ms tick timer
+ SysTick_Config(SystemCoreClock / 1000);
+#elif CFG_TUSB_OS == OPT_OS_FREERTOS
+ // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
+ NVIC_SetPriority(USB_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
+#endif
+ mxc_gpio_cfg_t gpioConfig;
+
+ // LED
+ gpioConfig.drvstr = MXC_GPIO_DRVSTR_0;
+ gpioConfig.func = MXC_GPIO_FUNC_OUT;
+ gpioConfig.mask = LED_PIN;
+ gpioConfig.pad = MXC_GPIO_PAD_NONE;
+ gpioConfig.port = LED_PORT;
+ gpioConfig.vssel = LED_VDDIO;
+ MXC_GPIO_Config(&gpioConfig);
+ board_led_write(false);
+
+ // Button
+ gpioConfig.drvstr = MXC_GPIO_DRVSTR_0;
+ gpioConfig.func = MXC_GPIO_FUNC_IN;
+ gpioConfig.mask = BUTTON_PIN;
+ gpioConfig.pad = BUTTON_PULL;
+ gpioConfig.port = BUTTON_PORT;
+ gpioConfig.vssel = MXC_GPIO_VSSEL_VDDIO;
+ MXC_GPIO_Config(&gpioConfig);
+
+ // UART
+ MXC_UART_Init(ConsoleUart, CFG_BOARD_UART_BAUDRATE, MXC_UART_IBRO_CLK);
+ UART_PORT->vssel |= UART_VDDIO_BITS; //Set necessary bits to 3.3V
+
+ //USB
+ MXC_MCR->ldoctrl |= MXC_F_MCR_LDOCTRL_0P9EN;
+ MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_USB);
+}
+
+//--------------------------------------------------------------------+
+// Board porting API
+//--------------------------------------------------------------------+
+
+void board_led_write(bool state) {
+#if LED_STATE_ON
+ state = !state;
+#endif
+ if (state) {
+ MXC_GPIO_OutClr(LED_PORT, LED_PIN);
+ } else {
+ MXC_GPIO_OutSet(LED_PORT, LED_PIN);
+ }
+}
+
+uint32_t board_button_read(void) {
+ uint32_t state = MXC_GPIO_InGet(BUTTON_PORT, BUTTON_PIN) ? 1 : 0;
+ return BUTTON_STATE_ACTIVE == state;
+}
+
+size_t board_get_unique_id(uint8_t id[], size_t max_len) {
+ uint8_t hw_id[MXC_SYS_USN_CHECKSUM_LEN];//USN Buffer
+ /* All other 2nd parameter is optional checkum buffer */
+ MXC_SYS_GetUSN(hw_id, NULL);
+
+ size_t act_len = TU_MIN(max_len, MXC_SYS_USN_LEN);
+ memcpy(id, hw_id, act_len);
+ return act_len;
+}
+
+int board_uart_read(uint8_t *buf, int len) {
+ int uart_val;
+ int act_len = 0;
+
+ while (act_len < len) {
+ if ((uart_val = MXC_UART_ReadCharacterRaw(ConsoleUart)) == E_UNDERFLOW) {
+ break;
+ } else {
+ *buf++ = (uint8_t) uart_val;
+ act_len++;
+ }
+ }
+ return act_len;
+}
+
+int board_uart_write(void const *buf, int len) {
+ int act_len = 0;
+ const uint8_t *ch_ptr = (const uint8_t *) buf;
+ while (act_len < len) {
+ MXC_UART_WriteCharacter(ConsoleUart, *ch_ptr++);
+ act_len++;
+ }
+ return len;
+}
+
+#if CFG_TUSB_OS == OPT_OS_NONE
+volatile uint32_t system_ticks = 0;
+
+void SysTick_Handler(void) {
+ system_ticks++;
+}
+
+uint32_t board_millis(void) {
+ return system_ticks;
+}
+#endif
+
+void HardFault_Handler(void) {
+ __asm("BKPT #0\n");
+}
+
+// Required by __libc_init_array in startup code if we are compiling using
+// -nostdlib/-nostartfiles.
+void _init(void) {
+}
diff --git a/hw/bsp/max78002/family.cmake b/hw/bsp/max78002/family.cmake
new file mode 100644
index 000000000..43b172b9f
--- /dev/null
+++ b/hw/bsp/max78002/family.cmake
@@ -0,0 +1,152 @@
+include_guard()
+
+set(MAX32_PERIPH ${TOP}/hw/mcu/analog/max32/Libraries/PeriphDrivers)
+set(MAX32_CMSIS ${TOP}/hw/mcu/analog/max32/Libraries/CMSIS)
+set(CMSIS_5 ${TOP}/lib/CMSIS_5)
+
+# include board specific
+include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
+
+# Get the linker file from current location (family)
+set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/max78002.ld)
+set(LD_FILE_Clang ${LD_FILE_GNU})
+
+# toolchain set up
+set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
+set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
+set(JLINK_DEVICE max78000)
+
+set(FAMILY_MCUS MAX78002 CACHE INTERNAL "")
+
+function(update_board TARGET)
+ target_compile_definitions(${TARGET} PUBLIC
+ TARGET=MAX78002
+ TARGET_REV=0x4131
+ MXC_ASSERT_ENABLE
+ MAX78002
+ IAR_PRAGMAS=0
+ CFG_TUSB_MCU=OPT_MCU_MAX78002
+ BOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
+ )
+endfunction()
+
+#------------------------------------
+# BOARD_TARGET
+#------------------------------------
+# only need to be built ONCE for all examples
+function(add_board_target BOARD_TARGET)
+ if (TARGET ${BOARD_TARGET})
+ return()
+ endif ()
+
+ # Startup & Linker script
+ set(STARTUP_FILE_GNU ${MAX32_CMSIS}/Device/Maxim/MAX78002/Source/GCC/startup_max78002.S)
+ set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
+ #set(STARTUP_FILE_IAR ?)
+
+ set(PERIPH_SRC ${MAX32_PERIPH}/Source)
+ add_library(${BOARD_TARGET} STATIC
+ ${MAX32_CMSIS}/Device/Maxim/MAX78002/Source/heap.c
+ ${MAX32_CMSIS}/Device/Maxim/MAX78002/Source/system_max78002.c
+ ${PERIPH_SRC}/SYS/mxc_assert.c
+ ${PERIPH_SRC}/SYS/mxc_delay.c
+ ${PERIPH_SRC}/SYS/mxc_lock.c
+ ${PERIPH_SRC}/SYS/nvic_table.c
+ ${PERIPH_SRC}/SYS/pins_ai87.c
+ ${PERIPH_SRC}/SYS/sys_ai87.c
+ ${PERIPH_SRC}/AES/aes_ai87.c
+ ${PERIPH_SRC}/AES/aes_revb.c
+ ${PERIPH_SRC}/FLC/flc_common.c
+ ${PERIPH_SRC}/FLC/flc_ai87.c
+ ${PERIPH_SRC}/FLC/flc_reva.c
+ ${PERIPH_SRC}/GPIO/gpio_common.c
+ ${PERIPH_SRC}/GPIO/gpio_ai87.c
+ ${PERIPH_SRC}/GPIO/gpio_reva.c
+ ${PERIPH_SRC}/ICC/icc_ai87.c
+ ${PERIPH_SRC}/ICC/icc_reva.c
+ ${PERIPH_SRC}/TRNG/trng_ai87.c
+ ${PERIPH_SRC}/TRNG/trng_revb.c
+ ${PERIPH_SRC}/UART/uart_common.c
+ ${PERIPH_SRC}/UART/uart_ai87.c
+ ${PERIPH_SRC}/UART/uart_revb.c
+ ${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
+ )
+ target_include_directories(${BOARD_TARGET} PUBLIC
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}
+ ${CMSIS_5}/CMSIS/Core/Include
+ ${MAX32_CMSIS}/Include
+ ${MAX32_CMSIS}/Device/Maxim/MAX78002/Include
+ ${MAX32_PERIPH}/Include/MAX78002
+ ${PERIPH_SRC}/SYS
+ ${PERIPH_SRC}/GPIO
+ ${PERIPH_SRC}/AES
+ ${PERIPH_SRC}/TRNG
+ ${PERIPH_SRC}/ICC
+ ${PERIPH_SRC}/FLC
+ ${PERIPH_SRC}/UART
+ )
+
+ target_compile_options(${TARGET} PRIVATE
+ -Wno-error=strict-prototypes
+ -Wno-error=redundant-decls
+ )
+ update_board(${BOARD_TARGET})
+
+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_link_options(${BOARD_TARGET} PUBLIC
+ "LINKER:--script=${LD_FILE_GNU}"
+ -nostartfiles
+ --specs=nosys.specs --specs=nano.specs
+ )
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ target_link_options(${BOARD_TARGET} PUBLIC
+ "LINKER:--script=${LD_FILE_Clang}"
+ )
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
+ target_link_options(${BOARD_TARGET} PUBLIC
+ "LINKER:--config=${LD_FILE_IAR}"
+ )
+ endif ()
+endfunction()
+
+
+#------------------------------------
+# Functions
+#------------------------------------
+function(family_configure_example TARGET RTOS)
+ family_configure_common(${TARGET} ${RTOS})
+
+ # Board target
+ add_board_target(board_${BOARD})
+
+ #---------- Port Specific ----------
+ # These files are built for each example since it depends on example's tusb_config.h
+ target_sources(${TARGET} PUBLIC
+ # BSP
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
+ )
+ target_include_directories(${TARGET} PUBLIC
+ # family, hw, board
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
+ )
+
+ # Add TinyUSB target and port source
+ family_add_tinyusb(${TARGET} OPT_MCU_MAX78002 ${RTOS})
+ target_sources(${TARGET}-tinyusb PUBLIC
+ ${TOP}/src/portable/analog/max32/dcd_max32.c
+ )
+ target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
+ target_compile_options(${TARGET}-tinyusb PRIVATE
+ -Wno-error=strict-prototypes
+ -Wno-error=redundant-decls
+ )
+
+ # Link dependencies
+ target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
+
+ # Flashing
+ family_flash_jlink(${TARGET})
+endfunction()
diff --git a/hw/bsp/max78002/family.mk b/hw/bsp/max78002/family.mk
new file mode 100644
index 000000000..825920596
--- /dev/null
+++ b/hw/bsp/max78002/family.mk
@@ -0,0 +1,104 @@
+DEPS_SUBMODULES += lib/CMSIS_5 hw/mcu/analog/max32
+
+# Important locations in the hw support for MCU
+MAX32_CMSIS = hw/mcu/analog/max32/Libraries/CMSIS
+MAX32_PERIPH = hw/mcu/analog/max32/Libraries/PeriphDrivers
+
+# Add any board specific make rules
+include $(TOP)/$(BOARD_PATH)/board.mk
+
+CPU_CORE ?= cortex-m4
+PORT ?= 0
+
+# GCC
+SRC_S_GCC += $(MAX32_CMSIS)/Device/Maxim/MAX78002/Source/GCC/startup_max78002.S
+LD_FILE = $(FAMILY_PATH)/max78002.ld
+
+# IAR
+#SRC_S_IAR +=
+
+# --------------
+# Compiler Flags
+# --------------
+# Flags for the MAX78002 SDK
+CFLAGS += -DTARGET=MAX78002 \
+ -DTARGET_REV=0x4131 \
+ -DMXC_ASSERT_ENABLE \
+ -DMAX78002 \
+ -DIAR_PRAGMAS=0
+
+# Flags for TUSB features
+CFLAGS += \
+ -DCFG_TUSB_MCU=OPT_MCU_MAX78002 \
+ -DBOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
+
+# mcu driver cause following warnings
+CFLAGS += -Wno-error=redundant-decls \
+ -Wno-error=strict-prototypes \
+ -Wno-error=unused-parameter \
+ -Wno-error=enum-conversion \
+ -Wno-error=sign-compare \
+ -Wno-error=cast-qual
+
+LDFLAGS_GCC += -nostartfiles --specs=nosys.specs --specs=nano.specs
+
+# For flash-jlink target
+JLINK_DEVICE = max78000
+
+# flash target using Jlik
+flash: flash-jlink
+
+# Optional flash option when running within an installed MSDK to use OpenOCD
+# Mainline OpenOCD does not yet have the MAX32's flash algorithm integrated.
+# If the MSDK is installed, flash-msdk can be run to utilize the the modified
+# openocd with the algorithms
+MAXIM_PATH := $(subst \,/,$(MAXIM_PATH))
+flash-msdk:
+ $(MAXIM_PATH)/Tools/OpenOCD/openocd -s $(MAXIM_PATH)/Tools/OpenOCD/scripts \
+ -f interface/cmsis-dap.cfg -f target/max78002.cfg \
+ -c "program $(BUILD)/$(PROJECT).elf verify; init; reset; exit"
+
+# -----------------
+# Sources & Include
+# -----------------
+PERIPH_SRC = $(TOP)/$(MAX32_PERIPH)/Source
+SRC_C += \
+ src/portable/analog/max32/dcd_max32.c \
+ $(MAX32_CMSIS)/Device/Maxim/MAX78002/Source/heap.c \
+ $(MAX32_CMSIS)/Device/Maxim/MAX78002/Source/system_max78002.c \
+ $(PERIPH_SRC)/SYS/mxc_assert.c \
+ $(PERIPH_SRC)/SYS/mxc_delay.c \
+ $(PERIPH_SRC)/SYS/mxc_lock.c \
+ $(PERIPH_SRC)/SYS/nvic_table.c \
+ $(PERIPH_SRC)/SYS/pins_ai87.c \
+ $(PERIPH_SRC)/SYS/sys_ai87.c \
+ $(PERIPH_SRC)/AES/aes_ai87.c \
+ $(PERIPH_SRC)/AES/aes_revb.c \
+ $(PERIPH_SRC)/FLC/flc_common.c \
+ $(PERIPH_SRC)/FLC/flc_ai87.c \
+ $(PERIPH_SRC)/FLC/flc_reva.c \
+ $(PERIPH_SRC)/GPIO/gpio_common.c \
+ $(PERIPH_SRC)/GPIO/gpio_ai87.c \
+ $(PERIPH_SRC)/GPIO/gpio_reva.c \
+ $(PERIPH_SRC)/ICC/icc_ai87.c \
+ $(PERIPH_SRC)/ICC/icc_reva.c \
+ $(PERIPH_SRC)/TRNG/trng_ai87.c \
+ $(PERIPH_SRC)/TRNG/trng_revb.c \
+ $(PERIPH_SRC)/UART/uart_common.c \
+ $(PERIPH_SRC)/UART/uart_ai87.c \
+ $(PERIPH_SRC)/UART/uart_revb.c \
+
+
+INC += \
+ $(TOP)/$(BOARD_PATH) \
+ $(TOP)/lib/CMSIS_5/CMSIS/Core/Include \
+ $(TOP)/$(MAX32_CMSIS)/Include \
+ $(TOP)/$(MAX32_CMSIS)/Device/Maxim/MAX78002/Include \
+ $(TOP)/$(MAX32_PERIPH)/Include/MAX78002 \
+ $(PERIPH_SRC)/SYS \
+ $(PERIPH_SRC)/GPIO \
+ $(PERIPH_SRC)/AES \
+ $(PERIPH_SRC)/ICC \
+ $(PERIPH_SRC)/FLC \
+ $(PERIPH_SRC)/TRNG \
+ $(PERIPH_SRC)/UART
diff --git a/hw/bsp/max78002/max78002.ld b/hw/bsp/max78002/max78002.ld
new file mode 100644
index 000000000..5f9ed9356
--- /dev/null
+++ b/hw/bsp/max78002/max78002.ld
@@ -0,0 +1,180 @@
+MEMORY {
+ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x00010000 /* 64 kB ROM */
+ FLASH (rx) : ORIGIN = 0x10000000, LENGTH = 0x00280000 /* 2.5 MB Flash */
+ SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00060000 /* 384 kB SRAM */
+ /*CSI2 (rwx) : ORIGIN = 0x2001F000, LENGTH = 0x00001000 4096 B CSI2 Buffer */
+}
+
+SECTIONS {
+ .rom :
+ {
+ KEEP(*(.rom_vector))
+ *(.rom_handlers*)
+ } > ROM
+
+ .text :
+ {
+ _text = .;
+ KEEP(*(.isr_vector))
+ EXCLUDE_FILE (*riscv.o) *(.text*) /* Program code (exclude RISCV code) */
+ *(.rodata*) /* read-only data: "const" */
+
+ KEEP(*(.init))
+ KEEP(*(.fini))
+
+ /* .ctors */
+ *crtbegin.o(.ctors)
+ *crtbegin?.o(.ctors)
+ *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
+ *(SORT(.ctors.*))
+ *(.ctors)
+
+ /* .dtors */
+ *crtbegin.o(.dtors)
+ *crtbegin?.o(.dtors)
+ *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
+ *(SORT(.dtors.*))
+ *(.dtors)
+
+ /* C++ Exception handling */
+ KEEP(*(.eh_frame*))
+ _etext = .;
+ } > FLASH
+
+ .ARM.extab :
+ {
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ } > FLASH
+
+ /* Binary import */
+ .bin_storage :
+ {
+ FILL(0xFF)
+ _bin_start_ = .;
+ KEEP(*(.bin_storage_img))
+ _bin_end_ = .;
+ . = ALIGN(4);
+ } > FLASH
+
+ .rom_code :
+ {
+ . = ALIGN(16);
+ _sran_code = .;
+ *(.rom_code_section)
+ _esran_code = .;
+ } > ROM
+
+ .flash_code :
+ {
+ . = ALIGN(16);
+ _sran_code = .;
+ *(.flash_code_section)
+ _esran_code = .;
+ } > FLASH
+
+ .sram_code :
+ {
+ . = ALIGN(16);
+ _sran_code = .;
+ *(.sram_code_section)
+ _esran_code = .;
+ } > SRAM
+
+ /* it's used for C++ exception handling */
+ /* we need to keep this to avoid overlapping */
+ .ARM.exidx :
+ {
+ __exidx_start = .;
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+ __exidx_end = .;
+ } > FLASH
+
+ .data :
+ {
+ _data = ALIGN(., 4);
+ _csi = . + 0x20000;
+ *(vtable)
+ *(.data*) /*read-write initialized data: initialized global variable*/
+
+
+ /* These array sections are used by __libc_init_array to call static C++ constructors */
+ . = ALIGN(4);
+ /* preinit data */
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP(*(.preinit_array))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+
+ . = ALIGN(4);
+ /* init data */
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP(*(SORT(.init_array.*)))
+ KEEP(*(.init_array))
+ PROVIDE_HIDDEN (__init_array_end = .);
+
+ . = ALIGN(4);
+ /* finit data */
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP(*(SORT(.fini_array.*)))
+ KEEP(*(.fini_array))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+
+ _edata = ALIGN(., 4);
+
+ } > SRAM AT>FLASH
+ __load_data = LOADADDR(.data);
+
+ .bss :
+ {
+ . = ALIGN(4);
+ _bss = .;
+ *(.bss*) /*read-write zero initialized data: uninitialzed global variable*/
+ *(COMMON)
+ _ebss = ALIGN(., 4);
+ } > SRAM
+
+ .shared :
+ {
+ . = ALIGN(4);
+ _shared = .;
+ *(.mailbox*)
+ . = ALIGN(4);
+ *(.shared*) /*read-write zero initialized data: uninitialzed global variable*/
+ _eshared = ALIGN(., 4);
+ } > SRAM
+ __shared_data = LOADADDR(.shared);
+
+ /* Set stack top to end of RAM, and stack limit move down by
+ * size of stack_dummy section */
+ __StackTop = ORIGIN(SRAM) + LENGTH(SRAM);
+ __StackLimit = __StackTop - SIZEOF(.stack_dummy);
+
+ /* .stack_dummy section doesn't contains any symbols. It is only
+ * used for linker to calculate size of stack sections, and assign
+ * values to stack symbols later */
+ .stack_dummy (COPY):
+ {
+ *(.stack*)
+ } > SRAM
+
+ .heap (COPY):
+ {
+ . = ALIGN(4);
+ *(.heap*)
+ __HeapLimit = ABSOLUTE(__StackLimit);
+ } > SRAM
+
+ PROVIDE(__stack = __StackTop);
+
+ /* Check if data + heap + stack exceeds RAM limit */
+ ASSERT(__StackLimit >= _ebss, "region RAM overflowed with stack")
+
+ /* Section used by RISCV loader projects. See RISCV_LOAD documentation in the build system. */
+ .riscv_flash :
+ {
+ /* Align address to mod 256 with a small offset. This is required to match the flash page size.*/
+ . = ALIGN(256); /* ALIGN operatator is used here. Note that (. & 0x1FFFFF00) was used in the past, but a strange bug was seen on Windows where the & did not behave as expected.*/
+ . += 0x100;
+ _riscv_boot = .;
+ KEEP(*riscv.o (.text*))
+ } > FLASH
+}
diff --git a/src/common/tusb_mcu.h b/src/common/tusb_mcu.h
index a68e160bd..07cdf3ff0 100644
--- a/src/common/tusb_mcu.h
+++ b/src/common/tusb_mcu.h
@@ -455,7 +455,8 @@
//--------------------------------------------------------------------+
// Analog Devices
//--------------------------------------------------------------------+
-#elif TU_CHECK_MCU(OPT_MCU_MAX32690)
+#elif TU_CHECK_MCU(OPT_MCU_MAX32690, OPT_MCU_MAX32666, \
+ OPT_MCU_MAX32650, OPT_MCU_MAX78002)
#define TUP_DCD_ENDPOINT_MAX 12
#define TUP_RHPORT_HIGHSPEED 1
diff --git a/src/portable/analog/max32/dcd_max32.c b/src/portable/analog/max32/dcd_max32.c
index b3370ddd1..7226003de 100644
--- a/src/portable/analog/max32/dcd_max32.c
+++ b/src/portable/analog/max32/dcd_max32.c
@@ -27,7 +27,8 @@
#include "tusb_option.h"
-#if CFG_TUD_ENABLED && TU_CHECK_MCU(OPT_MCU_MAX32690)
+#if CFG_TUD_ENABLED && \
+ TU_CHECK_MCU(OPT_MCU_MAX32690, OPT_MCU_MAX32650, OPT_MCU_MAX32666, OPT_MCU_MAX78002)
#if __GNUC__ > 8 && defined(__ARM_FEATURE_UNALIGNED)
/* GCC warns that an address may be unaligned, even though
diff --git a/src/tusb_option.h b/src/tusb_option.h
index 18f78b49c..1290d605c 100644
--- a/src/tusb_option.h
+++ b/src/tusb_option.h
@@ -190,6 +190,9 @@
// Analog Devices
#define OPT_MCU_MAX32690 2400 ///< ADI MAX32690
+#define OPT_MCU_MAX32666 2401 ///< ADI MAX32666/5
+#define OPT_MCU_MAX32650 2402 ///< ADI MAX32650/1/2
+#define OPT_MCU_MAX78002 2403 ///< ADI MAX78002
// Check if configured MCU is one of listed
// Apply _TU_CHECK_MCU with || as separator to list of input
diff --git a/tools/get_deps.py b/tools/get_deps.py
index e05cc4d76..fe548f4ab 100644
--- a/tools/get_deps.py
+++ b/tools/get_deps.py
@@ -26,7 +26,7 @@ deps_optional = {
'fc100s'],
'hw/mcu/analog/max32' : ['https://github.com/analogdevicesinc/msdk.git',
'b20b398d3e5e2007594e54a74ba3d2a2e50ddd75',
- 'max32690'],
+ 'max32690 max32650 max32666 max78002'],
'hw/mcu/bridgetek/ft9xx/ft90x-sdk': ['https://github.com/BRTSG-FOSS/ft90x-sdk.git',
'91060164afe239fcb394122e8bf9eb24d3194eb1',
'brtmm90x'],