summaryrefslogtreecommitdiff
path: root/hw/bsp/maxim
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-07-02 18:18:52 +0700
committerhathach <[email protected]>2025-07-02 18:18:52 +0700
commitcf3966efd9fc552d641ea1e76e5aaad3ace3afd2 (patch)
treed59add439dcbfcd6e2cd9fec9aaecc413e5b5509 /hw/bsp/maxim
parentf10467e711017fb05a6e0ee496e451e2e8834549 (diff)
parent963971c6aa14411f0cc6f0c4f727d199c738e2a5 (diff)
Merge branch 'master' into fork/HiFiPhile/dcd_notif
Diffstat (limited to 'hw/bsp/maxim')
-rw-r--r--hw/bsp/maxim/FreeRTOSConfig/FreeRTOSConfig.h149
-rw-r--r--hw/bsp/maxim/README.md43
-rw-r--r--hw/bsp/maxim/boards/apard32690/board.cmake4
-rw-r--r--hw/bsp/maxim/boards/apard32690/board.h60
-rw-r--r--hw/bsp/maxim/boards/apard32690/board.mk1
-rw-r--r--hw/bsp/maxim/boards/max32650evkit/board.cmake8
-rw-r--r--hw/bsp/maxim/boards/max32650evkit/board.h60
-rw-r--r--hw/bsp/maxim/boards/max32650evkit/board.mk1
-rw-r--r--hw/bsp/maxim/boards/max32650fthr/board.cmake8
-rw-r--r--hw/bsp/maxim/boards/max32650fthr/board.h61
-rw-r--r--hw/bsp/maxim/boards/max32650fthr/board.mk1
-rw-r--r--hw/bsp/maxim/boards/max32651evkit/board.cmake31
-rw-r--r--hw/bsp/maxim/boards/max32651evkit/board.h60
-rw-r--r--hw/bsp/maxim/boards/max32651evkit/board.mk7
-rw-r--r--hw/bsp/maxim/boards/max32666evkit/board.cmake4
-rw-r--r--hw/bsp/maxim/boards/max32666evkit/board.h61
-rw-r--r--hw/bsp/maxim/boards/max32666evkit/board.mk1
-rw-r--r--hw/bsp/maxim/boards/max32666fthr/board.cmake4
-rw-r--r--hw/bsp/maxim/boards/max32666fthr/board.h61
-rw-r--r--hw/bsp/maxim/boards/max32666fthr/board.mk1
-rw-r--r--hw/bsp/maxim/boards/max32690evkit/board.cmake4
-rw-r--r--hw/bsp/maxim/boards/max32690evkit/board.h60
-rw-r--r--hw/bsp/maxim/boards/max32690evkit/board.mk1
-rw-r--r--hw/bsp/maxim/boards/max78002evkit/board.cmake4
-rw-r--r--hw/bsp/maxim/boards/max78002evkit/board.h62
-rw-r--r--hw/bsp/maxim/boards/max78002evkit/board.mk1
-rw-r--r--hw/bsp/maxim/family.c213
-rw-r--r--hw/bsp/maxim/family.cmake196
-rw-r--r--hw/bsp/maxim/family.mk190
-rw-r--r--hw/bsp/maxim/linker/max32650.ld119
-rw-r--r--hw/bsp/maxim/linker/max32651.ld132
-rw-r--r--hw/bsp/maxim/linker/max32665.ld135
-rw-r--r--hw/bsp/maxim/linker/max32690.ld164
-rw-r--r--hw/bsp/maxim/linker/max78002.ld182
34 files changed, 2089 insertions, 0 deletions
diff --git a/hw/bsp/maxim/FreeRTOSConfig/FreeRTOSConfig.h b/hw/bsp/maxim/FreeRTOSConfig/FreeRTOSConfig.h
new file mode 100644
index 000000000..e5a76af85
--- /dev/null
+++ b/hw/bsp/maxim/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/maxim/README.md b/hw/bsp/maxim/README.md
new file mode 100644
index 000000000..e2983e899
--- /dev/null
+++ b/hw/bsp/maxim/README.md
@@ -0,0 +1,43 @@
+# Analog Devices MAXIM
+
+This BSP is for working with the Analog microcontrollers
+ - [MAX32650](https://www.analog.com/en/products/max32650.html),
+ - [MAX32651](https://www.analog.com/en/products/max32651.html)
+ - [MAX32652](https://www.analog.com/en/products/max32652.html)
+ - [MAX32665](https://www.analog.com/en/products/max32665.html)
+ - [MAX32666](https://www.analog.com/en/products/max32666.html)
+ - [MAX32690](https://www.analog.com/en/products/max32690.html)
+ - [MAX78002](https://www.analog.com/en/products/max78002.html) AI microcontroller.
+
+The following boards are supported:
+ * [MAX32650EVKIT](https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32650-evkit.html)
+ * [MAX32650FTHR](https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32650fthr.html)
+ * [MAX32651EVKIT](https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32651-evkit.html) (Secure Bootloader)
+ * [MAX32666EVKIT](https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32666evkit.html)
+ * [MAX32666FTHR](https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32666fthr.html)
+ * [MAX32690EVKIT](https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32690evkit.html)
+ * [AD-APARD32690-SL](https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/ad-apard32690-sl.html)
+ * [MAX78002EVKIT](https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max78002evkit.html)
+
+This part family leverages the Maxim Microcontrollers SDK (MSDK) for the device
+interfaces and hardware abstraction layers. This source code package is fetched
+as part of the get-deps script.
+
+The microcontroller utilizes the standard GNU ARM toolchain. If this toolchain
+is not already available on your build machine, it can be installed by using the
+bundled MSDK installation. Details on downloading and installing can be found
+in the [User's Guide](https://analogdevicesinc.github.io/msdk//USERGUIDE/).
+
+## Flashing
+
+The default flashing behavior in this BSP is to utilize JLink. This can be done
+by running the `flash` or `flash-jlink` rule for Makefiles, or the
+`<target>-jlink` target for CMake.
+
+Most the Evaluation Kit and boards are shipped with a CMSIS-DAP
+compatible debug probe. However, at the time of writing, the necessary flashing
+algorithms for OpenOCD have not yet been incorporated into the OpenOCD master
+branch. To utilize the provided debug probes, please install the bundled MSDK
+package which includes the appropriate OpenOCD modifications. To leverage this
+OpenOCD instance, run the `flash-msdk` Makefile rule, or `<target>-openocd` CMake
+target.
diff --git a/hw/bsp/maxim/boards/apard32690/board.cmake b/hw/bsp/maxim/boards/apard32690/board.cmake
new file mode 100644
index 000000000..a03d05f8d
--- /dev/null
+++ b/hw/bsp/maxim/boards/apard32690/board.cmake
@@ -0,0 +1,4 @@
+set(MAX_DEVICE max32690)
+
+function(update_board TARGET)
+endfunction()
diff --git a/hw/bsp/maxim/boards/apard32690/board.h b/hw/bsp/maxim/boards/apard32690/board.h
new file mode 100644
index 000000000..19f74bf56
--- /dev/null
+++ b/hw/bsp/maxim/boards/apard32690/board.h
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+/* metadata:
+ name: APARD32690-SL
+ url: https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/ad-apard32690-sl.html
+*/
+
+#ifndef BOARD_H_
+#define BOARD_H_
+
+#include "max32690.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// LED
+#define LED_PORT MXC_GPIO2
+#define LED_PIN MXC_GPIO_PIN_1
+#define LED_VDDIO MXC_GPIO_VSSEL_VDDIOH
+#define LED_STATE_ON 1
+
+// Button
+#define BUTTON_PORT MXC_GPIO1
+#define BUTTON_PIN MXC_GPIO_PIN_27
+#define BUTTON_PULL MXC_GPIO_PAD_NONE
+#define BUTTON_STATE_ACTIVE 1
+
+// UART Enable for UART on ARM SWD Connector
+#define UART_NUM 0
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BOARD_H_ */
diff --git a/hw/bsp/maxim/boards/apard32690/board.mk b/hw/bsp/maxim/boards/apard32690/board.mk
new file mode 100644
index 000000000..d8a0c9cae
--- /dev/null
+++ b/hw/bsp/maxim/boards/apard32690/board.mk
@@ -0,0 +1 @@
+MAX_DEVICE = max32690
diff --git a/hw/bsp/maxim/boards/max32650evkit/board.cmake b/hw/bsp/maxim/boards/max32650evkit/board.cmake
new file mode 100644
index 000000000..59721e756
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32650evkit/board.cmake
@@ -0,0 +1,8 @@
+set(MAX_DEVICE max32650)
+
+function(update_board TARGET)
+endfunction()
+
+function(prepare_image TARGET_IN)
+ #No signing required
+endfunction()
diff --git a/hw/bsp/maxim/boards/max32650evkit/board.h b/hw/bsp/maxim/boards/max32650evkit/board.h
new file mode 100644
index 000000000..0dfc074fa
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32650evkit/board.h
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+/* metadata:
+ name: MAX32650 EVKIT
+ url: https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32650-evkit.html
+*/
+
+#ifndef BOARD_H_
+#define BOARD_H_
+
+#include "max32650.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// LED
+#define LED_PORT MXC_GPIO2
+#define LED_PIN MXC_GPIO_PIN_25
+#define LED_VDDIO MXC_GPIO_VSSEL_VDDIOH
+#define LED_STATE_ON 0
+
+// Button
+#define BUTTON_PORT MXC_GPIO2
+#define BUTTON_PIN MXC_GPIO_PIN_28
+#define BUTTON_PULL MXC_GPIO_PAD_WEAK_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
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BOARD_H_ */
diff --git a/hw/bsp/maxim/boards/max32650evkit/board.mk b/hw/bsp/maxim/boards/max32650evkit/board.mk
new file mode 100644
index 000000000..3a4108005
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32650evkit/board.mk
@@ -0,0 +1 @@
+MAX_DEVICE = max32650
diff --git a/hw/bsp/maxim/boards/max32650fthr/board.cmake b/hw/bsp/maxim/boards/max32650fthr/board.cmake
new file mode 100644
index 000000000..59721e756
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32650fthr/board.cmake
@@ -0,0 +1,8 @@
+set(MAX_DEVICE max32650)
+
+function(update_board TARGET)
+endfunction()
+
+function(prepare_image TARGET_IN)
+ #No signing required
+endfunction()
diff --git a/hw/bsp/maxim/boards/max32650fthr/board.h b/hw/bsp/maxim/boards/max32650fthr/board.h
new file mode 100644
index 000000000..af0fa1c39
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32650fthr/board.h
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+/* metadata:
+ name: MAX32650 Feather
+ url: https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32650fthr.html
+*/
+
+#ifndef BOARD_H_
+#define BOARD_H_
+
+#include "max32650.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// LED
+#define LED_PORT MXC_GPIO1
+#define LED_PIN MXC_GPIO_PIN_14
+#define LED_VDDIO MXC_GPIO_VSSEL_VDDIO
+#define LED_STATE_ON 0
+
+// Button
+#define BUTTON_PORT MXC_GPIO1
+#define BUTTON_PIN MXC_GPIO_PIN_19
+#define BUTTON_PULL MXC_GPIO_PAD_WEAK_PULL_UP
+#define BUTTON_STATE_ACTIVE 0
+
+// UART Enable for SWD UART Pins. Pin Mux handled by the HAL
+#define UART_NUM 0
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BOARD_H_ */
diff --git a/hw/bsp/maxim/boards/max32650fthr/board.mk b/hw/bsp/maxim/boards/max32650fthr/board.mk
new file mode 100644
index 000000000..3a4108005
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32650fthr/board.mk
@@ -0,0 +1 @@
+MAX_DEVICE = max32650
diff --git a/hw/bsp/maxim/boards/max32651evkit/board.cmake b/hw/bsp/maxim/boards/max32651evkit/board.cmake
new file mode 100644
index 000000000..773989126
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32651evkit/board.cmake
@@ -0,0 +1,31 @@
+set(MAX_DEVICE max32650)
+
+# Use the secure linker file
+set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/../../linker/max32651.ld)
+
+function(update_board TARGET)
+ # for the signed target, need to add the __SLA_FWK__ define
+ target_compile_definitions(${TARGET} PUBLIC
+ __SLA_FWK__
+ )
+endfunction()
+
+function(sign_image TARGET_IN)
+ #For the signed target, set up a POST_BUILD command to sign the elf file once created
+ if((WIN32) OR (MINGW) OR (MSYS))
+ set(SIGN_EXE "sign_app.exe")
+ else()
+ set(SIGN_EXE "sign_app")
+ endif()
+ set(MCU_PATH "${TOP}/hw/mcu/analog/msdk/")
+
+ # Custom POST_BUILD command
+ add_custom_command(
+ TARGET ${TARGET_IN} POST_BUILD
+ COMMAND ${CMAKE_OBJCOPY} $<TARGET_FILE:${TARGET_IN}> -R .sig -O binary $<TARGET_FILE_DIR:${TARGET_IN}>/${TARGET_IN}.bin
+ COMMAND ${MCU_PATH}/Tools/SBT/bin/${SIGN_EXE} -c MAX32651 key_file=${MCU_PATH}/Tools/SBT/devices/MAX32651/keys/maximtestcrk.key
+ ca=$<TARGET_FILE_DIR:${TARGET_IN}>/${TARGET_IN}.bin sca=$<TARGET_FILE_DIR:${TARGET_IN}>/${TARGET_IN}.sbin
+ COMMAND ${CMAKE_OBJCOPY} $<TARGET_FILE:${TARGET_IN}> --update-section .sig=$<TARGET_FILE_DIR:${TARGET_IN}>/${TARGET_IN}.sig
+ VERBATIM
+ )
+endfunction()
diff --git a/hw/bsp/maxim/boards/max32651evkit/board.h b/hw/bsp/maxim/boards/max32651evkit/board.h
new file mode 100644
index 000000000..dbf2a4b7c
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32651evkit/board.h
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+/* metadata:
+ name: MAX32651 EVKIT
+ url: https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32651-evkit.html
+*/
+
+#ifndef BOARD_H_
+#define BOARD_H_
+
+#include "max32650.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// LED
+#define LED_PORT MXC_GPIO2
+#define LED_PIN MXC_GPIO_PIN_25
+#define LED_VDDIO MXC_GPIO_VSSEL_VDDIOH
+#define LED_STATE_ON 0
+
+// Button
+#define BUTTON_PORT MXC_GPIO2
+#define BUTTON_PIN MXC_GPIO_PIN_28
+#define BUTTON_PULL MXC_GPIO_PAD_WEAK_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
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BOARD_H_ */
diff --git a/hw/bsp/maxim/boards/max32651evkit/board.mk b/hw/bsp/maxim/boards/max32651evkit/board.mk
new file mode 100644
index 000000000..5d4971148
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32651evkit/board.mk
@@ -0,0 +1,7 @@
+MAX_DEVICE = max32650
+
+# Use the secure linker file
+LD_FILE = $(FAMILY_PATH)/linker/max32651.ld
+
+# Let the family script know the build needs to be signed
+SIGNED_BUILD := 1
diff --git a/hw/bsp/maxim/boards/max32666evkit/board.cmake b/hw/bsp/maxim/boards/max32666evkit/board.cmake
new file mode 100644
index 000000000..e7116b603
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32666evkit/board.cmake
@@ -0,0 +1,4 @@
+set(MAX_DEVICE max32665)
+
+function(update_board TARGET)
+endfunction()
diff --git a/hw/bsp/maxim/boards/max32666evkit/board.h b/hw/bsp/maxim/boards/max32666evkit/board.h
new file mode 100644
index 000000000..42965d3c5
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32666evkit/board.h
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+/* metadata:
+ name: MAX32666 EVKIT
+ url: https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32666evkit.html
+*/
+
+#ifndef BOARD_H_
+#define BOARD_H_
+
+#include "max32665.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// LED
+#define LED_PORT MXC_GPIO1
+#define LED_PIN MXC_GPIO_PIN_14
+#define LED_VDDIO MXC_GPIO_VSSEL_VDDIOH
+#define LED_STATE_ON 0
+
+// Button
+#define BUTTON_PORT MXC_GPIO1
+#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 1
+#define UART_MAP MAP_A
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BOARD_H_ */
diff --git a/hw/bsp/maxim/boards/max32666evkit/board.mk b/hw/bsp/maxim/boards/max32666evkit/board.mk
new file mode 100644
index 000000000..a1cf3045d
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32666evkit/board.mk
@@ -0,0 +1 @@
+MAX_DEVICE = max32665
diff --git a/hw/bsp/maxim/boards/max32666fthr/board.cmake b/hw/bsp/maxim/boards/max32666fthr/board.cmake
new file mode 100644
index 000000000..e7116b603
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32666fthr/board.cmake
@@ -0,0 +1,4 @@
+set(MAX_DEVICE max32665)
+
+function(update_board TARGET)
+endfunction()
diff --git a/hw/bsp/maxim/boards/max32666fthr/board.h b/hw/bsp/maxim/boards/max32666fthr/board.h
new file mode 100644
index 000000000..fbb217949
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32666fthr/board.h
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+/* metadata:
+ name: MAX32666 Feather
+ url: https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32666fthr.html
+*/
+
+#ifndef BOARD_H_
+#define BOARD_H_
+
+#include "max32665.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// LED
+#define LED_PORT MXC_GPIO0
+#define LED_PIN MXC_GPIO_PIN_29
+#define LED_VDDIO MXC_GPIO_VSSEL_VDDIOH
+#define LED_STATE_ON 0
+
+// Button
+#define BUTTON_PORT MXC_GPIO1
+#define BUTTON_PIN MXC_GPIO_PIN_10
+#define BUTTON_PULL MXC_GPIO_PAD_PULL_UP
+#define BUTTON_STATE_ACTIVE 0
+
+// UART Enable for UART on SWD. Pin Mux handled by the HAL
+#define UART_NUM 1
+#define UART_MAP MAP_B
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BOARD_H_ */
diff --git a/hw/bsp/maxim/boards/max32666fthr/board.mk b/hw/bsp/maxim/boards/max32666fthr/board.mk
new file mode 100644
index 000000000..a1cf3045d
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32666fthr/board.mk
@@ -0,0 +1 @@
+MAX_DEVICE = max32665
diff --git a/hw/bsp/maxim/boards/max32690evkit/board.cmake b/hw/bsp/maxim/boards/max32690evkit/board.cmake
new file mode 100644
index 000000000..a03d05f8d
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32690evkit/board.cmake
@@ -0,0 +1,4 @@
+set(MAX_DEVICE max32690)
+
+function(update_board TARGET)
+endfunction()
diff --git a/hw/bsp/maxim/boards/max32690evkit/board.h b/hw/bsp/maxim/boards/max32690evkit/board.h
new file mode 100644
index 000000000..41c73621f
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32690evkit/board.h
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+/* metadata:
+ name: MAX32690 EVKIT
+ url: https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32690evkit.html
+*/
+
+#ifndef BOARD_H_
+#define BOARD_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "max32690.h"
+
+// LED
+#define LED_PORT MXC_GPIO0
+#define LED_PIN MXC_GPIO_PIN_14
+#define LED_VDDIO MXC_GPIO_VSSEL_VDDIOH
+#define LED_STATE_ON 0
+
+// Button
+#define BUTTON_PORT MXC_GPIO4
+#define BUTTON_PIN MXC_GPIO_PIN_0
+#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 2
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BOARD_H_ */
diff --git a/hw/bsp/maxim/boards/max32690evkit/board.mk b/hw/bsp/maxim/boards/max32690evkit/board.mk
new file mode 100644
index 000000000..d8a0c9cae
--- /dev/null
+++ b/hw/bsp/maxim/boards/max32690evkit/board.mk
@@ -0,0 +1 @@
+MAX_DEVICE = max32690
diff --git a/hw/bsp/maxim/boards/max78002evkit/board.cmake b/hw/bsp/maxim/boards/max78002evkit/board.cmake
new file mode 100644
index 000000000..dd4c3c215
--- /dev/null
+++ b/hw/bsp/maxim/boards/max78002evkit/board.cmake
@@ -0,0 +1,4 @@
+set(MAX_DEVICE max78002)
+
+function(update_board TARGET)
+endfunction()
diff --git a/hw/bsp/maxim/boards/max78002evkit/board.h b/hw/bsp/maxim/boards/max78002evkit/board.h
new file mode 100644
index 000000000..8c1fc13d4
--- /dev/null
+++ b/hw/bsp/maxim/boards/max78002evkit/board.h
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+/* metadata:
+ name: MAX78002 EVKIT
+ url: https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max78002evkit.html
+*/
+
+#ifndef BOARD_H_
+#define BOARD_H_
+
+#include "max78002.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/maxim/boards/max78002evkit/board.mk b/hw/bsp/maxim/boards/max78002evkit/board.mk
new file mode 100644
index 000000000..b19e95187
--- /dev/null
+++ b/hw/bsp/maxim/boards/max78002evkit/board.mk
@@ -0,0 +1 @@
+MAX_DEVICE = max78002
diff --git a/hw/bsp/maxim/family.c b/hw/bsp/maxim/family.c
new file mode 100644
index 000000000..0ef6b8c4d
--- /dev/null
+++ b/hw/bsp/maxim/family.c
@@ -0,0 +1,213 @@
+/*
+ * 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.
+ */
+
+/* metadata:
+ manufacturer: Analog Devices
+*/
+
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstrict-prototypes" // _mxc_crit_get_state()
+#endif
+
+#include "gpio.h"
+#include "mxc_sys.h"
+#if __has_include("mcr_regs.h")
+#include "mcr_regs.h"
+#endif
+#include "mxc_device.h"
+#include "uart.h"
+
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+
+#include "board.h"
+#include "bsp/board_api.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
+#if MAX_PERIPH_ID == 14
+ MXC_UART_Init(ConsoleUart, CFG_BOARD_UART_BAUDRATE, UART_MAP);
+#elif MAX_PERIPH_ID == 18 || MAX_PERIPH_ID == 87
+ MXC_UART_Init(ConsoleUart, CFG_BOARD_UART_BAUDRATE, MXC_UART_IBRO_CLK);
+ #if MAX_PERIPH_ID == 87
+ UART_PORT->vssel |= UART_VDDIO_BITS; // Set necessary bits to 3.3V
+ #endif
+#endif
+
+ //USB
+#if defined(MAX32650)
+ // Startup the HIRC96M clock if it's not on already
+ if (!(MXC_GCR->clk_ctrl & MXC_F_GCR_CLK_CTRL_HIRC96_EN)) {
+ MXC_GCR->clk_ctrl |= MXC_F_GCR_CLK_CTRL_HIRC96_EN;
+ MXC_SYS_Clock_Timeout(MXC_F_GCR_CLK_CTRL_HIRC96_RDY);
+ }
+ MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_USB);
+ MXC_SYS_Reset_Periph(MXC_SYS_RESET_USB);
+
+#elif defined(MAX32665) || defined(MAX32666)
+ // Startup the HIRC96M clock if it's not on already
+ if (!(MXC_GCR->clkcn & MXC_F_GCR_CLKCN_HIRC96M_EN)) {
+ MXC_GCR->clkcn |= MXC_F_GCR_CLKCN_HIRC96M_EN;
+ }
+ MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_USB);
+ MXC_SYS_Reset_Periph(MXC_SYS_RESET_USB);
+
+#elif defined(MAX32690)
+ MXC_SYS_ClockSourceEnable(MXC_SYS_CLOCK_IPO);
+ MXC_MCR->ldoctrl |= MXC_F_MCR_LDOCTRL_0P9EN;
+ MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_USB);
+ MXC_SYS_Reset_Periph(MXC_SYS_RESET0_USB);
+
+# elif defined(MAX78002)
+ MXC_MCR->ldoctrl |= MXC_F_MCR_LDOCTRL_0P9EN;
+ MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_USB);
+#else
+ #error "Unsupported MAXIM MCU for board_dfu_init"
+#endif
+}
+
+//--------------------------------------------------------------------+
+// 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) {
+#if defined(MAX32650)
+ // USN is 13 bytes on this device
+ MXC_SYS_GetUSN(id, 13);
+ return 13;
+#else
+ uint8_t hw_id[MXC_SYS_USN_CHECKSUM_LEN]; //USN Buffer
+ MXC_SYS_GetUSN(hw_id, NULL); // 2nd parameter is optional checksum buffer
+
+ size_t act_len = TU_MIN(max_len, MXC_SYS_USN_LEN);
+ memcpy(id, hw_id, act_len);
+ return act_len;
+#endif
+}
+
+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/maxim/family.cmake b/hw/bsp/maxim/family.cmake
new file mode 100644
index 000000000..75daec753
--- /dev/null
+++ b/hw/bsp/maxim/family.cmake
@@ -0,0 +1,196 @@
+include_guard()
+
+# stub: overridden by board.cmake if needed
+function(sign_image TARGET_IN)
+endfunction()
+
+set(MSDK_LIB ${TOP}/hw/mcu/analog/msdk/Libraries)
+
+# include board specific
+include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
+
+# toolchain set up
+set(CMAKE_SYSTEM_CPU cortex-m4 CACHE INTERNAL "System Processor")
+set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
+
+string(TOUPPER ${MAX_DEVICE} MAX_DEVICE_UPPER)
+cmake_print_variables(MAX_DEVICE MAX_DEVICE_UPPER)
+
+set(JLINK_DEVICE ${MAX_DEVICE})
+set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -f target/${MAX_DEVICE}.cfg")
+
+set(FAMILY_MCUS ${MAX_DEVICE_UPPER} CACHE INTERNAL "")
+
+if (${MAX_DEVICE} STREQUAL "max32650")
+ set(PERIPH_ID 10)
+ set(PERIPH_SUFFIX "me")
+elseif (${MAX_DEVICE} STREQUAL "max32665" OR ${MAX_DEVICE} STREQUAL "max32666")
+ set(PERIPH_ID 14)
+ set(PERIPH_SUFFIX "me")
+elseif (${MAX_DEVICE} STREQUAL "max32690")
+ set(PERIPH_ID 18)
+ set(PERIPH_SUFFIX "me")
+elseif (${MAX_DEVICE} STREQUAL "max78002")
+ set(PERIPH_ID 87)
+ set(PERIPH_SUFFIX "ai")
+else()
+ message(FATAL_ERROR "Unsupported MAX device: ${MAX_DEVICE}")
+endif()
+
+#------------------------------------
+# 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 ${MSDK_LIB}/CMSIS/Device/Maxim/${MAX_DEVICE_UPPER}/Source/GCC/startup_${MAX_DEVICE}.S)
+ set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
+
+ if (NOT DEFINED LD_FILE_GNU)
+ set(LD_FILE_GNU ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/linker/${MAX_DEVICE}.ld)
+ endif ()
+ set(LD_FILE_Clang ${LD_FILE_GNU})
+
+ # Common
+ add_library(${BOARD_TARGET} STATIC
+ ${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
+ ${MSDK_LIB}/CMSIS/Device/Maxim/${MAX_DEVICE_UPPER}/Source/heap.c
+ ${MSDK_LIB}/CMSIS/Device/Maxim/${MAX_DEVICE_UPPER}/Source/system_${MAX_DEVICE}.c
+ ${MSDK_LIB}/PeriphDrivers/Source/SYS/mxc_assert.c
+ ${MSDK_LIB}/PeriphDrivers/Source/SYS/mxc_delay.c
+ ${MSDK_LIB}/PeriphDrivers/Source/SYS/mxc_lock.c
+ ${MSDK_LIB}/PeriphDrivers/Source/SYS/nvic_table.c
+ ${MSDK_LIB}/PeriphDrivers/Source/SYS/pins_${PERIPH_SUFFIX}${PERIPH_ID}.c
+ ${MSDK_LIB}/PeriphDrivers/Source/SYS/sys_${PERIPH_SUFFIX}${PERIPH_ID}.c
+ ${MSDK_LIB}/PeriphDrivers/Source/FLC/flc_common.c
+ ${MSDK_LIB}/PeriphDrivers/Source/FLC/flc_${PERIPH_SUFFIX}${PERIPH_ID}.c
+ ${MSDK_LIB}/PeriphDrivers/Source/FLC/flc_reva.c
+ ${MSDK_LIB}/PeriphDrivers/Source/GPIO/gpio_common.c
+ ${MSDK_LIB}/PeriphDrivers/Source/GPIO/gpio_${PERIPH_SUFFIX}${PERIPH_ID}.c
+ ${MSDK_LIB}/PeriphDrivers/Source/GPIO/gpio_reva.c
+ ${MSDK_LIB}/PeriphDrivers/Source/ICC/icc_${PERIPH_SUFFIX}${PERIPH_ID}.c
+ ${MSDK_LIB}/PeriphDrivers/Source/ICC/icc_reva.c
+ ${MSDK_LIB}/PeriphDrivers/Source/UART/uart_common.c
+ ${MSDK_LIB}/PeriphDrivers/Source/UART/uart_${PERIPH_SUFFIX}${PERIPH_ID}.c
+ )
+ target_include_directories(${BOARD_TARGET} PUBLIC
+ ${MSDK_LIB}/CMSIS/5.9.0/Core/Include
+ ${MSDK_LIB}/CMSIS/Device/Maxim/${MAX_DEVICE_UPPER}/Include
+ ${MSDK_LIB}/PeriphDrivers/Include/${MAX_DEVICE_UPPER}
+ ${MSDK_LIB}/PeriphDrivers/Source/SYS
+ ${MSDK_LIB}/PeriphDrivers/Source/GPIO
+ ${MSDK_LIB}/PeriphDrivers/Source/ICC
+ ${MSDK_LIB}/PeriphDrivers/Source/FLC
+ ${MSDK_LIB}/PeriphDrivers/Source/UART
+ )
+
+ # device specific
+ if (${MAX_DEVICE} STREQUAL "max32650" OR
+ ${MAX_DEVICE} STREQUAL "max32665" OR ${MAX_DEVICE} STREQUAL "max32666")
+ target_sources(${BOARD_TARGET} PRIVATE
+ ${MSDK_LIB}/PeriphDrivers/Source/ICC/icc_common.c
+ ${MSDK_LIB}/PeriphDrivers/Source/TPU/tpu_${PERIPH_SUFFIX}${PERIPH_ID}.c
+ ${MSDK_LIB}/PeriphDrivers/Source/TPU/tpu_reva.c
+ ${MSDK_LIB}/PeriphDrivers/Source/UART/uart_reva.c
+ )
+ target_include_directories(${BOARD_TARGET} PUBLIC
+ ${MSDK_LIB}/PeriphDrivers/Source/TPU
+ )
+ elseif (${MAX_DEVICE} STREQUAL "max32690")
+ target_sources(${BOARD_TARGET} PRIVATE
+ ${MSDK_LIB}/PeriphDrivers/Source/CTB/ctb_${PERIPH_SUFFIX}${PERIPH_ID}.c
+ ${MSDK_LIB}/PeriphDrivers/Source/CTB/ctb_reva.c
+ ${MSDK_LIB}/PeriphDrivers/Source/CTB/ctb_common.c
+ ${MSDK_LIB}/PeriphDrivers/Source/UART/uart_revb.c
+ )
+ target_include_directories(${BOARD_TARGET} PUBLIC
+ ${MSDK_LIB}/PeriphDrivers/Source/CTB
+ )
+ elseif (${MAX_DEVICE} STREQUAL "max78002")
+ target_sources(${BOARD_TARGET} PRIVATE
+ ${MSDK_LIB}/PeriphDrivers/Source/AES/aes_${PERIPH_SUFFIX}${PERIPH_ID}.c
+ ${MSDK_LIB}/PeriphDrivers/Source/AES/aes_revb.c
+ ${MSDK_LIB}/PeriphDrivers/Source/TRNG/trng_${PERIPH_SUFFIX}${PERIPH_ID}.c
+ ${MSDK_LIB}/PeriphDrivers/Source/TRNG/trng_revb.c
+ ${MSDK_LIB}/PeriphDrivers/Source/UART/uart_revb.c
+ )
+ target_include_directories(${BOARD_TARGET} PUBLIC
+ ${MSDK_LIB}/PeriphDrivers/Source/AES
+ ${MSDK_LIB}/PeriphDrivers/Source/TRNG
+ )
+ else()
+ message(FATAL_ERROR "Unsupported MAX device: ${MAX_DEVICE}")
+ endif()
+
+ target_compile_definitions(${BOARD_TARGET} PUBLIC
+ TARGET=${MAX_DEVICE_UPPER}
+ TARGET_REV=0x4131
+ MXC_ASSERT_ENABLE
+ ${MAX_DEVICE_UPPER}
+ IAR_PRAGMAS=0
+ MAX_PERIPH_ID=${PERIPH_ID}
+ BOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
+ )
+ target_compile_options(${BOARD_TARGET} PRIVATE
+ -Wno-error=strict-prototypes
+ )
+ 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}"
+ )
+ 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_${MAX_DEVICE_UPPER})
+ target_sources(${TARGET} PUBLIC
+ ${TOP}/src/portable/mentor/musb/dcd_musb.c
+ )
+ target_compile_options(${TARGET} PRIVATE
+ -Wno-error=strict-prototypes
+ )
+ target_link_libraries(${TARGET} PUBLIC board_${BOARD})
+
+ # Flashing
+ family_add_bin_hex(${TARGET})
+ family_flash_jlink(${TARGET})
+
+ sign_image(${TARGET}) # for secured device such as max32651
+ family_flash_openocd_adi(${TARGET})
+endfunction()
diff --git a/hw/bsp/maxim/family.mk b/hw/bsp/maxim/family.mk
new file mode 100644
index 000000000..3ddf8cf39
--- /dev/null
+++ b/hw/bsp/maxim/family.mk
@@ -0,0 +1,190 @@
+MSDK_LIB = hw/mcu/analog/msdk/Libraries
+
+# Add any board specific make rules
+include $(TOP)/$(BOARD_PATH)/board.mk
+
+CPU_CORE ?= cortex-m4
+PORT ?= 0
+JLINK_DEVICE = ${MAX_DEVICE}
+MAX_DEVICE_UPPER = $(call to_upper,${MAX_DEVICE})
+
+ifeq ($(MAX_DEVICE),max32650)
+ PERIPH_ID = 10
+ PERIPH_SUFFIX = me
+endif
+
+ifneq ($(filter $(MAX_DEVICE),max32665 max32666),)
+ PERIPH_ID = 14
+ PERIPH_SUFFIX = me
+endif
+
+ifeq ($(MAX_DEVICE),max32690)
+ PERIPH_ID = 18
+ PERIPH_SUFFIX = me
+endif
+
+ifeq ($(MAX_DEVICE),max78002)
+ PERIPH_ID = 87
+ PERIPH_SUFFIX = ai
+endif
+
+ifndef PERIPH_ID
+ $(error Unsupported MAX device: ${MAX_DEVICE})
+endif
+
+# Configure the flash rule. By default, use JLink.
+SIGNED_BUILD ?= 0
+DEFAULT_FLASH = flash-jlink
+
+# --------------
+# Compiler Flags
+# --------------
+CFLAGS += \
+ -DTARGET=${MAX_DEVICE_UPPER}\
+ -DTARGET_REV=0x4131 \
+ -DMXC_ASSERT_ENABLE \
+ -D${MAX_DEVICE_UPPER} \
+ -DIAR_PRAGMAS=0 \
+ -DMAX_PERIPH_ID=${PERIPH_ID} \
+ -DCFG_TUSB_MCU=OPT_MCU_${MAX_DEVICE_UPPER} \
+ -DBOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
+
+# mcu driver cause following warnings
+CFLAGS += \
+ -Wno-error=old-style-declaration \
+ -Wno-error=redundant-decls \
+ -Wno-error=strict-prototypes \
+ -Wno-error=unused-parameter \
+ -Wno-error=cast-align \
+ -Wno-error=cast-qual \
+ -Wno-error=sign-compare \
+ -Wno-error=enum-conversion \
+
+LDFLAGS_GCC += -nostartfiles --specs=nosys.specs --specs=nano.specs
+LD_FILE_GCC ?= $(FAMILY_PATH)/linker/${MAX_DEVICE}.ld
+
+# If the applications needs to be signed (for the MAX32651), sign it first and
+# then need to use MSDK's OpenOCD to flash it
+# Also need to include the __SLA_FWK__ define to enable the signed header into
+# memory
+ifeq ($(SIGNED_BUILD), 1)
+# Extra definitions to build for the secure part
+CFLAGS += -D__SLA_FWK__
+DEFAULT_FLASH := sign-build flash-msdk
+endif
+
+# -----------------
+# Sources & Include
+# -----------------
+
+# common
+SRC_C += \
+ src/portable/mentor/musb/dcd_musb.c \
+ ${MSDK_LIB}/CMSIS/Device/Maxim/${MAX_DEVICE_UPPER}/Source/heap.c \
+ ${MSDK_LIB}/CMSIS/Device/Maxim/${MAX_DEVICE_UPPER}/Source/system_${MAX_DEVICE}.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/SYS/mxc_assert.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/SYS/mxc_delay.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/SYS/mxc_lock.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/SYS/nvic_table.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/SYS/pins_${PERIPH_SUFFIX}${PERIPH_ID}.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/SYS/sys_${PERIPH_SUFFIX}${PERIPH_ID}.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/FLC/flc_common.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/FLC/flc_${PERIPH_SUFFIX}${PERIPH_ID}.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/FLC/flc_reva.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/GPIO/gpio_common.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/GPIO/gpio_${PERIPH_SUFFIX}${PERIPH_ID}.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/GPIO/gpio_reva.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/ICC/icc_${PERIPH_SUFFIX}${PERIPH_ID}.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/ICC/icc_reva.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/UART/uart_common.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/UART/uart_${PERIPH_SUFFIX}${PERIPH_ID}.c \
+
+SRC_S_GCC += ${MSDK_LIB}/CMSIS/Device/Maxim/${MAX_DEVICE_UPPER}/Source/GCC/startup_${MAX_DEVICE}.S
+
+INC += \
+ $(TOP)/$(BOARD_PATH) \
+ $(TOP)/${MSDK_LIB}/CMSIS/5.9.0/Core/Include \
+ $(TOP)/${MSDK_LIB}/CMSIS/Device/Maxim/${MAX_DEVICE_UPPER}/Include \
+ $(TOP)/${MSDK_LIB}/PeriphDrivers/Include/${MAX_DEVICE_UPPER} \
+ $(TOP)/${MSDK_LIB}/PeriphDrivers/Source/SYS \
+ $(TOP)/${MSDK_LIB}/PeriphDrivers/Source/GPIO \
+ $(TOP)/${MSDK_LIB}/PeriphDrivers/Source/ICC \
+ $(TOP)/${MSDK_LIB}/PeriphDrivers/Source/FLC \
+ $(TOP)/${MSDK_LIB}/PeriphDrivers/Source/UART \
+
+# device specific
+ifneq ($(filter $(MAX_DEVICE),max32650 max32665 max32666),)
+ SRC_C += \
+ ${MSDK_LIB}/PeriphDrivers/Source/ICC/icc_common.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/TPU/tpu_${PERIPH_SUFFIX}${PERIPH_ID}.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/TPU/tpu_reva.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/UART/uart_reva.c \
+
+ INC += $(TOP)/${MSDK_LIB}/PeriphDrivers/Source/TPU
+endif
+
+ifeq (${MAX_DEVICE},max32690)
+ SRC_C += \
+ ${MSDK_LIB}/PeriphDrivers/Source/CTB/ctb_${PERIPH_SUFFIX}${PERIPH_ID}.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/CTB/ctb_reva.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/CTB/ctb_common.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/UART/uart_revb.c \
+
+ INC += ${TOP}/${MSDK_LIB}/PeriphDrivers/Source/CTB
+endif
+
+ifeq (${MAX_DEVICE},max78002)
+ SRC_C += \
+ ${MSDK_LIB}/PeriphDrivers/Source/AES/aes_${PERIPH_SUFFIX}${PERIPH_ID}.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/AES/aes_revb.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/TRNG/trng_${PERIPH_SUFFIX}${PERIPH_ID}.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/TRNG/trng_revb.c \
+ ${MSDK_LIB}/PeriphDrivers/Source/UART/uart_revb.c \
+
+ INC += \
+ ${TOP}/${MSDK_LIB}/PeriphDrivers/Source/AES \
+ ${TOP}/${MSDK_LIB}/PeriphDrivers/Source/TRNG
+endif
+
+
+# The MAX32651EVKIT is pin for pin identical to the MAX32650EVKIT, however the
+# MAX32651 has a secure bootloader which requires the image to be signed before
+# loading into flash. All MAX32651EVKIT's have the same key for evaluation
+# purposes, so create a special flash rule to sign the binary and flash using
+# the MSDK.
+MCU_PATH = $(TOP)/hw/mcu/analog/msdk/
+# Assume no extension for sign utility
+SIGN_EXE = sign_app
+ifeq ($(OS), Windows_NT)
+# Must use .exe extension on Windows, since the binaries
+# for Linux may live in the same place.
+SIGN_EXE := sign_app.exe
+else
+UNAME = $(shell uname -s)
+ifneq ($(findstring MSYS_NT,$(UNAME)),)
+# Must also use .exe extension for MSYS2
+SIGN_EXE := sign_app.exe
+endif
+endif
+
+# Rule to sign the build. This will in-place modify the existing .elf file
+# an populate the .sig section with the signature value
+sign-build: $(BUILD)/$(PROJECT).elf
+ $(OBJCOPY) $(BUILD)/$(PROJECT).elf -R .sig -O binary $(BUILD)/$(PROJECT).bin
+ $(MCU_PATH)/Tools/SBT/bin/$(SIGN_EXE) -c MAX32651 \
+ key_file="$(MCU_PATH)/Tools/SBT/devices/MAX32651/keys/maximtestcrk.key" \
+ ca=$(BUILD)/$(PROJECT).bin sca=$(BUILD)/$(PROJECT).sbin
+ $(OBJCOPY) $(BUILD)/$(PROJECT).elf --update-section .sig=$(BUILD)/$(PROJECT).sig
+
+# 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: $(BUILD)/$(PROJECT).elf
+ $(MAXIM_PATH)/Tools/OpenOCD/openocd -s $(MAXIM_PATH)/Tools/OpenOCD/scripts \
+ -f interface/cmsis-dap.cfg -f target/max32650.cfg \
+ -c "program $(BUILD)/$(PROJECT).elf verify; init; reset; exit"
+
+# Configure the flash rule
+flash: $(DEFAULT_FLASH)
diff --git a/hw/bsp/maxim/linker/max32650.ld b/hw/bsp/maxim/linker/max32650.ld
new file mode 100644
index 000000000..0e56a91ec
--- /dev/null
+++ b/hw/bsp/maxim/linker/max32650.ld
@@ -0,0 +1,119 @@
+MEMORY {
+ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x00010000 /* 64kB ROM */
+ FLASH (rx) : ORIGIN = 0x10000000, LENGTH = 0x00300000 /* 3MB flash */
+ SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00100000 /* 1MB SRAM */
+}
+
+SECTIONS {
+ .text :
+ {
+ _text = .;
+ KEEP(*(.isr_vector))
+ *(.text*) /* program 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
+
+ /* 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);
+ *(vtable)
+ *(.data*) /*read-write initialized data: initialized global variable*/
+ *(.spix_config*) /* SPIX configuration functions need to be run from SRAM */
+ *(.flashprog*) /* Flash program */
+
+
+ /* 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: uninitialized global variable*/
+ *(COMMON)
+ _ebss = ALIGN(., 4);
+ } > SRAM
+
+ /* 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);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ *(.heap*)
+ __HeapLimit = ABSOLUTE(__StackLimit);
+ } > SRAM
+
+ PROVIDE(__stack = __StackTop);
+
+ /* Check if data + heap + stack exceeds RAM limit */
+ ASSERT(__StackLimit >= _ebss, "region RAM overflowed with stack")
+}
diff --git a/hw/bsp/maxim/linker/max32651.ld b/hw/bsp/maxim/linker/max32651.ld
new file mode 100644
index 000000000..3921d10f2
--- /dev/null
+++ b/hw/bsp/maxim/linker/max32651.ld
@@ -0,0 +1,132 @@
+MEMORY {
+ HEADER (rx): ORIGIN = 0x10000000, LENGTH = 0x200
+ FLASH (rx) : ORIGIN = 0x10000200, LENGTH = 0x002FFE00 /* 3MB flash */
+ SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00100000 /* 1MB SRAM */
+}
+
+/* Added Oct 9, 2018 to go to correct reset vector. */
+ENTRY(Reset_Handler)
+PROVIDE( _start_SWAP = (((Reset_Handler) >> 24) | (((Reset_Handler) & 0x00FF0000) >> 8) | (((Reset_Handler) & 0x0000FF00) << 8) | ((Reset_Handler) << 24)));
+PROVIDE_HIDDEN( _SLA_Size = _endimage - __end_header );
+PROVIDE( _SLA_Size_SWAP = (((_SLA_Size) >> 24) | (((_SLA_Size) & 0x00FF0000) >> 8) | (((_SLA_Size) & 0x0000FF00) << 8) | ((_SLA_Size) << 24)));
+
+/* Sections Definitions */
+SECTIONS {
+ .sb_sla_header : ALIGN(4)
+ {
+ FILL(0xFF)
+ KEEP(*(.sb_sla_header)) /* Header for ROM code */
+ __end_header = . ;
+ . = ALIGN(512);
+ } > HEADER
+
+ .text :
+ {
+ _text = .;
+ KEEP(*(.isr_vector))
+ *(.text*) /* program code */
+ *(.rodata*) /* read-only data: "const" */
+
+ KEEP(*(.init))
+ KEEP(*(.fini))
+
+ /* C++ Exception handling */
+ KEEP(*(.eh_frame*))
+ _etext = .;
+ } > FLASH
+
+ /* it's used for C++ exception handling */
+ /* we need to keep this to avoid overlapping */
+ .ARM.exidx :
+ {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } > FLASH
+
+ .data :
+ {
+ _data = ALIGN(., 4);
+ *(.data*) /*read-write initialized data: initialized global variable*/
+ *(.spix_config*) /* SPIX configuration functions need to be run from SRAM */
+ *(.flashprog*) /* Flash program */
+
+
+ /* 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);
+ _enddata = LOADADDR(.data)+SIZEOF(.data);
+
+ .sb_sla_trailer : AT(_enddata)
+ {
+ KEEP(*(.sb_sla_trailer))
+ /* Align image with 16 byte boundary to conform to flash encryption block size. */
+ FILL(0xDEADC0DE);
+ /* NOTE: The FILL and ALIGN will not work unless something is written to the section. So, we use LONG. */
+ LONG(0xDEADC0DE);
+ . = ALIGN(16);
+ } > FLASH
+ _endimage = LOADADDR(.sb_sla_trailer)+SIZEOF(.sb_sla_trailer);
+ .sig :
+ {
+ KEEP(*(.sig))
+ LONG(0xDEADBEEF);
+
+ } > FLASH
+ .bss :
+ {
+ . = ALIGN(4);
+ _bss = .;
+ *(.bss*) /*read-write zero initialized data: uninitialized global variable*/
+ *(COMMON)
+ _ebss = ALIGN(., 4);
+ } > SRAM
+
+ /* 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);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ *(.heap*)
+ __HeapLimit = ABSOLUTE(__StackLimit);
+ } > SRAM
+
+ PROVIDE(__stack = __StackTop);
+
+ /* Check if data + heap + stack exceeds RAM limit */
+ ASSERT(__StackLimit >= _ebss, "region RAM overflowed with stack")
+}
diff --git a/hw/bsp/maxim/linker/max32665.ld b/hw/bsp/maxim/linker/max32665.ld
new file mode 100644
index 000000000..06c124247
--- /dev/null
+++ b/hw/bsp/maxim/linker/max32665.ld
@@ -0,0 +1,135 @@
+/* SPID and SPIX Sections here are maximum possible sizes */
+/* If used, they should be adjusted for the external Flash/RAM size */
+MEMORY {
+
+ SPIX (rx) : ORIGIN = 0x08000000, LENGTH = 0x08000000
+ FLASH (rx) : ORIGIN = 0x10000000, LENGTH = 0x00100000
+ SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x0008C000
+ SPID (rw) : ORIGIN = 0x80000000, LENGTH = 512M
+}
+
+/* Sections Definitions */
+SECTIONS {
+ .text :
+ {
+ _text = .;
+ KEEP(*(.isr_vector))
+ *(.text*) /* program 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
+
+ /* This section will keep the SPIX data until loaded into the external device */
+ /* Upon initialization of SPIX (user code needs to do this) */
+ .xip_section :
+ {
+ KEEP(*(.xip_section*))
+ } > SPIX AT>FLASH
+
+ __load_start_xip = LOADADDR(.xip_section);
+ __load_length_xip = SIZEOF(.xip_section);
+
+ /* 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);
+ *(vtable)
+ *(.data*) /*read-write initialized data: initialized global variable*/
+ *(.spix_config*) /* SPIX configuration functions need to be run from SRAM */
+ *(.flashprog*) /* Flash program */
+
+
+ /* 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: uninitialized global variable*/
+ *(COMMON)
+ _ebss = ALIGN(., 4);
+ } > SRAM
+
+ /* Setup the stack for Core 1, it will only be used if the user code
+ * includes a definition of Stack_Size_Core1, which defines the space
+ * reserved above the main core's stack for core 1's stack */
+
+ __StackTop_Core1 = ORIGIN(SRAM) + LENGTH(SRAM);
+ __StackLimit_Core1 = DEFINED(Stack_Size_Core1) ? __StackTop_Core1 - Stack_Size_Core1 : __StackTop_Core1;
+
+ /* Set stack top to end of RAM, and stack limit move down by Stack_Size.
+ * If core 1 is used, set the stack to the bottom of Core 1's stack region */
+
+ __StackTop = DEFINED(Stack_Size_Core1) ? __StackLimit_Core1 : ORIGIN(SRAM) + LENGTH(SRAM);
+ __StackLimit = __StackTop - Stack_Size;
+
+ .heap (COPY):
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ *(.heap*)
+ __HeapLimit = ABSOLUTE(__StackLimit);
+ } > SRAM
+
+ PROVIDE(__stack = __StackTop);
+
+ /* Check if data + heap + stack(s) exceeds RAM limit */
+ ASSERT(__StackLimit >= _ebss, "region RAM overflowed with stack")
+}
diff --git a/hw/bsp/maxim/linker/max32690.ld b/hw/bsp/maxim/linker/max32690.ld
new file mode 100644
index 000000000..64b906a54
--- /dev/null
+++ b/hw/bsp/maxim/linker/max32690.ld
@@ -0,0 +1,164 @@
+MEMORY {
+ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x00020000 /* 128kB ROM */
+ FLASH (rx) : ORIGIN = 0x10000000, LENGTH = 0x00340000
+ SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00100000
+
+ /*
+ * Note that CS0/CS1 address mappings may be reversed using MXC_HPC->mbr0 and ->mbr1
+ * The following mappings are selected for simplicity
+ */
+ HPB_CS0 (rwx) : ORIGIN = 0x60000000, LENGTH = 0x10000000 /* External Hyperbus/Xccelabus chip select 0 */
+ HPB_CS1 (rwx) : ORIGIN = 0x70000000, LENGTH = 0x10000000 /* External Hyperbus/Xccelabus chip select 1 */
+}
+
+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
+
+ /* These sections allow code to be compiled/linked for HPB addresses, but reside in
+ * flash until copied by code to the external HPB flash device
+ */
+ .hpb_cs0_section :
+ {
+ __hpb_cs0_start = ABSOLUTE(.);
+ KEEP(*(.hpb_cs0_section*))
+ } > HPB_CS0 AT>FLASH
+
+ __load_start_hpb_cs0 = LOADADDR(.hpb_cs0_section);
+ __load_length_hpb_cs0 = SIZEOF(.hpb_cs0_section);
+
+ .hpb_cs1_section :
+ {
+ __hpb_cs1_start = ABSOLUTE(.);
+ KEEP(*(.hpb_cs1_section*))
+ } > HPB_CS1 AT>FLASH
+
+ __load_start_hpb_cs1 = LOADADDR(.hpb_cs1_section);
+ __load_length_hpb_cs1 = SIZEOF(.hpb_cs1_section);
+
+ /* Binary import */
+ .bin_storage :
+ {
+ FILL(0xFF)
+ _bin_start_ = .;
+ KEEP(*(.bin_storage_img))
+ _bin_end_ = .;
+ . = ALIGN(4);
+ } > FLASH
+
+ /* 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);
+ *(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 = .);
+
+ /* Run the flash programming functions from SRAM */
+ *(.flashprog)
+
+ _edata = ALIGN(., 4);
+ } > SRAM AT>FLASH
+ __load_data = LOADADDR(.data);
+
+ .bss :
+ {
+ . = ALIGN(4);
+ _bss = .;
+ *(.bss*) /*read-write zero initialized data: uninitialized global variable*/
+ *(COMMON)
+ _ebss = ALIGN(., 4);
+ } > SRAM
+
+ /* 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);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ *(.heap*)
+ __HeapLimit = ABSOLUTE(__StackLimit);
+ } > SRAM
+
+ PROVIDE(__stack = __StackTop);
+
+ /* Check if data + heap + stack exceeds RAM limit */
+ ASSERT(__StackLimit >= _ebss, "region RAM overflowed with stack")
+}
diff --git a/hw/bsp/maxim/linker/max78002.ld b/hw/bsp/maxim/linker/max78002.ld
new file mode 100644
index 000000000..e5c4866ee
--- /dev/null
+++ b/hw/bsp/maxim/linker/max78002.ld
@@ -0,0 +1,182 @@
+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: uninitialized global variable*/
+ *(COMMON)
+ _ebss = ALIGN(., 4);
+ } > SRAM
+
+ .shared :
+ {
+ . = ALIGN(4);
+ _shared = .;
+ *(.mailbox*)
+ . = ALIGN(4);
+ *(.shared*) /*read-write zero initialized data: uninitialized 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);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ *(.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
+}