summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-06-11 12:00:20 +0700
committerhathach <[email protected]>2025-06-11 12:08:16 +0700
commit41e615d7c2c0588793bcf85f9cb5207e82a9e6f6 (patch)
treebdc7be38b6f5cc0f00fac5af34cc5b4bf876938c
parent1be7b8f781d34098b4af74cbcf06916287addf95 (diff)
add make build for maxim
-rw-r--r--examples/build_system/make/make.mk5
-rw-r--r--hw/bsp/family_support.cmake5
-rw-r--r--hw/bsp/maxim/README.md2
-rw-r--r--hw/bsp/maxim/boards/apard32690/board.h3
-rw-r--r--hw/bsp/maxim/boards/apard32690/board.mk1
-rw-r--r--hw/bsp/maxim/boards/max32650evkit/board.h3
-rw-r--r--hw/bsp/maxim/boards/max32650evkit/board.mk1
-rw-r--r--hw/bsp/maxim/boards/max32650fthr/board.h3
-rw-r--r--hw/bsp/maxim/boards/max32650fthr/board.mk1
-rw-r--r--hw/bsp/maxim/boards/max32651evkit/board.h3
-rw-r--r--hw/bsp/maxim/boards/max32651evkit/board.mk7
-rw-r--r--hw/bsp/maxim/boards/max32666evkit/board.h3
-rw-r--r--hw/bsp/maxim/boards/max32666evkit/board.mk1
-rw-r--r--hw/bsp/maxim/boards/max32666fthr/board.h3
-rw-r--r--hw/bsp/maxim/boards/max32666fthr/board.mk1
-rw-r--r--hw/bsp/maxim/boards/max32690evkit/board.h5
-rw-r--r--hw/bsp/maxim/boards/max32690evkit/board.mk1
-rw-r--r--hw/bsp/maxim/boards/max78002evkit/board.h3
-rw-r--r--hw/bsp/maxim/boards/max78002evkit/board.mk1
-rw-r--r--hw/bsp/maxim/family.cmake11
-rw-r--r--hw/bsp/maxim/family.mk190
21 files changed, 224 insertions, 29 deletions
diff --git a/examples/build_system/make/make.mk b/examples/build_system/make/make.mk
index 3101b66b9..dbc73903e 100644
--- a/examples/build_system/make/make.mk
+++ b/examples/build_system/make/make.mk
@@ -2,6 +2,9 @@
# Common make definition for all examples
# ---------------------------------------
+# upper helper function
+to_upper = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$(subst -,_,$(1))))))))))))))))))))))))))))
+
#-------------------------------------------------------------
# Toolchain
# Can be changed via TOOLCHAIN=gcc|iar or CC=arm-none-eabi-gcc|iccarm|clang
@@ -109,7 +112,7 @@ INC += \
$(TOP)/$(FAMILY_PATH) \
$(TOP)/src \
-BOARD_UPPER = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$(subst -,_,$(BOARD))))))))))))))))))))))))))))
+BOARD_UPPER = $(call to_upper,$(BOARD))
CFLAGS += -DBOARD_$(BOARD_UPPER)
ifdef CFLAGS_CLI
diff --git a/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake
index ac1276f7d..3325dbbf0 100644
--- a/hw/bsp/family_support.cmake
+++ b/hw/bsp/family_support.cmake
@@ -38,6 +38,11 @@ if (NOT DEFINED TOOLCHAIN)
set(TOOLCHAIN gcc)
endif ()
+# Optimization
+if (NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
+ set(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "Build type" FORCE)
+endif ()
+
#-------------------------------------------------------------
# FAMILY and BOARD
#-------------------------------------------------------------
diff --git a/hw/bsp/maxim/README.md b/hw/bsp/maxim/README.md
index c4b9f0bfc..e2983e899 100644
--- a/hw/bsp/maxim/README.md
+++ b/hw/bsp/maxim/README.md
@@ -39,5 +39,5 @@ 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 `<target>-openocd` CMake
+OpenOCD instance, run the `flash-msdk` Makefile rule, or `<target>-openocd` CMake
target.
diff --git a/hw/bsp/maxim/boards/apard32690/board.h b/hw/bsp/maxim/boards/apard32690/board.h
index 87b9c4e88..19f74bf56 100644
--- a/hw/bsp/maxim/boards/apard32690/board.h
+++ b/hw/bsp/maxim/boards/apard32690/board.h
@@ -32,8 +32,7 @@
#ifndef BOARD_H_
#define BOARD_H_
-#include "gpio.h"
-#include "mxc_sys.h"
+#include "max32690.h"
#ifdef __cplusplus
extern "C" {
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.h b/hw/bsp/maxim/boards/max32650evkit/board.h
index 65ed2659e..9c1f55f8e 100644
--- a/hw/bsp/maxim/boards/max32650evkit/board.h
+++ b/hw/bsp/maxim/boards/max32650evkit/board.h
@@ -32,8 +32,7 @@
#ifndef BOARD_H_
#define BOARD_H_
-#include "gpio.h"
-#include "mxc_sys.h"
+#include "max32650.h"
#ifdef __cplusplus
extern "C" {
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.h b/hw/bsp/maxim/boards/max32650fthr/board.h
index 755fa15b5..af0fa1c39 100644
--- a/hw/bsp/maxim/boards/max32650fthr/board.h
+++ b/hw/bsp/maxim/boards/max32650fthr/board.h
@@ -32,8 +32,7 @@
#ifndef BOARD_H_
#define BOARD_H_
-#include "gpio.h"
-#include "mxc_sys.h"
+#include "max32650.h"
#ifdef __cplusplus
extern "C" {
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.h b/hw/bsp/maxim/boards/max32651evkit/board.h
index 0b49ff309..dbf2a4b7c 100644
--- a/hw/bsp/maxim/boards/max32651evkit/board.h
+++ b/hw/bsp/maxim/boards/max32651evkit/board.h
@@ -32,8 +32,7 @@
#ifndef BOARD_H_
#define BOARD_H_
-#include "gpio.h"
-#include "mxc_sys.h"
+#include "max32650.h"
#ifdef __cplusplus
extern "C" {
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.h b/hw/bsp/maxim/boards/max32666evkit/board.h
index 54589444d..42965d3c5 100644
--- a/hw/bsp/maxim/boards/max32666evkit/board.h
+++ b/hw/bsp/maxim/boards/max32666evkit/board.h
@@ -32,8 +32,7 @@
#ifndef BOARD_H_
#define BOARD_H_
-#include "gpio.h"
-#include "mxc_sys.h"
+#include "max32665.h"
#ifdef __cplusplus
extern "C" {
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.h b/hw/bsp/maxim/boards/max32666fthr/board.h
index 0caea5934..fbb217949 100644
--- a/hw/bsp/maxim/boards/max32666fthr/board.h
+++ b/hw/bsp/maxim/boards/max32666fthr/board.h
@@ -32,8 +32,7 @@
#ifndef BOARD_H_
#define BOARD_H_
-#include "gpio.h"
-#include "mxc_sys.h"
+#include "max32665.h"
#ifdef __cplusplus
extern "C" {
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.h b/hw/bsp/maxim/boards/max32690evkit/board.h
index aa8dbb1de..41c73621f 100644
--- a/hw/bsp/maxim/boards/max32690evkit/board.h
+++ b/hw/bsp/maxim/boards/max32690evkit/board.h
@@ -32,13 +32,12 @@
#ifndef BOARD_H_
#define BOARD_H_
-#include "gpio.h"
-#include "mxc_sys.h"
-
#ifdef __cplusplus
extern "C" {
#endif
+#include "max32690.h"
+
// LED
#define LED_PORT MXC_GPIO0
#define LED_PIN MXC_GPIO_PIN_14
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.h b/hw/bsp/maxim/boards/max78002evkit/board.h
index 85d55d7de..8c1fc13d4 100644
--- a/hw/bsp/maxim/boards/max78002evkit/board.h
+++ b/hw/bsp/maxim/boards/max78002evkit/board.h
@@ -32,8 +32,7 @@
#ifndef BOARD_H_
#define BOARD_H_
-#include "gpio.h"
-#include "mxc_sys.h"
+#include "max78002.h"
#ifdef __cplusplus
extern "C" {
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.cmake b/hw/bsp/maxim/family.cmake
index 1fd5215ba..75daec753 100644
--- a/hw/bsp/maxim/family.cmake
+++ b/hw/bsp/maxim/family.cmake
@@ -13,8 +13,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
set(CMAKE_SYSTEM_CPU cortex-m4 CACHE INTERNAL "System Processor")
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
-cmake_print_variables(MAX_DEVICE)
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")
@@ -132,18 +132,9 @@ function(add_board_target BOARD_TARGET)
MXC_ASSERT_ENABLE
${MAX_DEVICE_UPPER}
IAR_PRAGMAS=0
- FLASH_BOOT_SIZE=${FLASH_BOOT_SIZE}
MAX_PERIPH_ID=${PERIPH_ID}
- )
-
- target_compile_definitions(${TARGET} PUBLIC
- TARGET=MAX32690
- TARGET_REV=0x4131
- MXC_ASSERT_ENABLE
- MAX32690
BOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
)
-
target_compile_options(${BOARD_TARGET} PRIVATE
-Wno-error=strict-prototypes
)
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)