BSP Cleanup

- Added MSDK flash rules for CMake
 - Removed partial IAR support. Uniform GCC support across MAX32 parts
 - Updated build scripts for correctly signing the MAX32651
 - Added README files for the BSPs to describe flashing and limitiations
This commit is contained in:
Brent Kowal 2024-07-10 15:18:59 -04:00
parent 0c37f93bc8
commit f49725d2c9
18 changed files with 325 additions and 121 deletions

46
hw/bsp/max32650/README.md Normal file
View File

@ -0,0 +1,46 @@
# Analog Devices MAX32650/1/2
This BSP is for working with the Analog Devices
[MAX32650](https://www.analog.com/en/products/max32650.html),
[MAX32651](https://www.analog.com/en/products/max32651.html) and
[MAX32652](https://www.analog.com/en/products/max32652.html)
microcontrollers. 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)
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 microcontrollers utilize 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
### MAX32650 and MAX32652
The default flashing behavior in this BSP for the MAX32650 and MAX32652 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.
Both the Evaluation Kit and Feather 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>-msdk` CMake
target.
### MAX32651
The MAX32651 features an integrated secure bootloader which requires the
application image be signed prior to flashing. Both the Makefile and CMake
scripts account for this signing automatically when building for the
MAX32651EVKIT.
To flash the signed image, the MSDK's OpenOCD variant must be used. To flash
the MAX32651EVKIT please install the bundled MSDK, and utilize the `flash-msdk`
and `<target>-msdk` rule and target.

View File

@ -1 +1,10 @@
# Use the standard, non-secure linker file
set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/max32650.ld)
function(update_board_extras TARGET)
#No extra arguments
endfunction()
function(prepare_image TARGET_IN)
#No signing required
endfunction()

View File

@ -1,17 +1,2 @@
# Use the standard, non-secure linker file
LD_FILE = $(BOARD_PATH)/max32650.ld
# For flash-jlink target
JLINK_DEVICE = max32650
# 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: $(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"

View File

@ -1 +1,10 @@
# Use the standard, non-secure linker file
set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/max32650.ld)
function(update_board_extras TARGET)
#No extra arguments
endfunction()
function(prepare_image TARGET_IN)
#No signing required
endfunction()

View File

@ -1,17 +1,2 @@
# Use the standard, non-secure linker file
LD_FILE = $(BOARD_PATH)/max32650.ld
# For flash-jlink target
JLINK_DEVICE = max32650
# 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: $(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"

View File

@ -1 +1,30 @@
# Use the secure linker file
set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/max32651.ld)
function(update_board_extras TARGET)
# for the signed target, need to add the __SLA_FWK__ define
target_compile_definitions(${TARGET} PUBLIC
__SLA_FWK__
)
endfunction()
function(prepare_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/max32/")
# 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()

View File

@ -1,42 +1,5 @@
# Use the secure linker file
LD_FILE = $(BOARD_PATH)/max32651.ld
CFLAGS += -D__SLA_FWK__
# For flash-jlink target
JLINK_DEVICE = max32650
# flash target using MSDK signing the image
flash: flash-msdk-signed
MAXIM_PATH := $(subst \,/,$(MAXIM_PATH))
# 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.
# For the MAX32650, the regular flash, flash-jlink and flash-msdk are sufficient
MCU_PATH = $(TOP)/hw/mcu/analog/max32/
# 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
flash-msdk-signed: $(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
$(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"
# Let the family script know the build needs to be signed
SIGNED_BUILD := 1

View File

@ -4,10 +4,10 @@ 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 board specific information and functions
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
# Get the linker file from current location (family)
# Get the linker file
set(LD_FILE_Clang ${LD_FILE_GNU})
# toolchain set up
@ -27,6 +27,9 @@ function(update_board TARGET)
CFG_TUSB_MCU=OPT_MCU_MAX32650
BOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
)
# Run any board specific updates
update_board_extras(${TARGET})
endfunction()
#------------------------------------
@ -41,11 +44,11 @@ function(add_board_target BOARD_TARGET)
# Startup & Linker script
set(STARTUP_FILE_GNU ${MAX32_CMSIS}/Device/Maxim/MAX32650/Source/GCC/startup_max32650.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/MAX32650/Source/heap.c
${MAX32_CMSIS}/Device/Maxim/MAX32650/Source/header_MAX32650.c
${MAX32_CMSIS}/Device/Maxim/MAX32650/Source/system_max32650.c
${PERIPH_SRC}/SYS/mxc_assert.c
${PERIPH_SRC}/SYS/mxc_delay.c
@ -93,15 +96,12 @@ function(add_board_target BOARD_TARGET)
"LINKER:--script=${LD_FILE_GNU}"
-nostartfiles
--specs=nosys.specs --specs=nano.specs
-u sb_header #Needed when linking libraries to not lose the Signing header
)
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()
@ -148,5 +148,21 @@ function(family_configure_example TARGET RTOS)
# Flashing
family_flash_jlink(${TARGET})
# Add the optional MSDK OpenOCD flashing
family_flash_msdk(${TARGET})
endfunction()
function(family_flash_msdk TARGET)
# Prepare the image (signed) if the board requires it
prepare_image(${TARGET})
set(MAXIM_PATH "$ENV{MAXIM_PATH}")
add_custom_target(${TARGET}-msdk
DEPENDS ${TARGET}
COMMAND ${MAXIM_PATH}/Tools/OpenOCD/openocd -s ${MAXIM_PATH}/Tools/OpenOCD/scripts
-f interface/cmsis-dap.cfg -f target/max32650.cfg
-c "program $<TARGET_FILE:${TARGET}> verify; init; reset; exit"
VERBATIM
)
endfunction()

View File

@ -13,9 +13,6 @@ PORT ?= 0
# GCC
SRC_S_GCC += $(MAX32_CMSIS)/Device/Maxim/MAX32650/Source/GCC/startup_max32650.S
# IAR
#SRC_S_IAR += ?
# --------------
# Compiler Flags
# --------------
@ -40,6 +37,26 @@ CFLAGS += -Wno-error=strict-prototypes \
LDFLAGS_GCC += -nostartfiles --specs=nosys.specs --specs=nano.specs
# Configure the flash rule. By default, use JLink.
SIGNED_BUILD ?= 0
DEFAULT_FLASH = flash-jlink
# 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
# For flash-jlink target
JLINK_DEVICE = max32650
# Configure the flash rule
flash: $(DEFAULT_FLASH)
# -----------------
# Sources & Include
# -----------------
@ -70,7 +87,6 @@ SRC_C += \
$(PERIPH_SRC)/UART/uart_me10.c \
$(PERIPH_SRC)/UART/uart_reva.c \
INC += \
$(TOP)/$(BOARD_PATH) \
$(TOP)/lib/CMSIS_5/CMSIS/Core/Include \
@ -83,3 +99,43 @@ INC += \
$(PERIPH_SRC)/FLC \
$(PERIPH_SRC)/TPU \
$(PERIPH_SRC)/UART
# 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/max32/
# 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 modifiy 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"

32
hw/bsp/max32666/README.md Normal file
View File

@ -0,0 +1,32 @@
# Analog Devices MAX32665/6
This BSP is for working with the Analog Devices
[MAX32665](https://www.analog.com/en/products/max32665.html) and
[MAX32666](https://www.analog.com/en/products/max32666.html) microcontrollers.
The following boards are supported:
* [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)
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 microcontrollers utilize 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.
Both the Evaluation Kit and Feather 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>-msdk` CMake
target.

View File

@ -42,7 +42,6 @@ function(add_board_target BOARD_TARGET)
# Startup & Linker script
set(STARTUP_FILE_GNU ${MAX32_CMSIS}/Device/Maxim/MAX32665/Source/GCC/startup_max32665.S)
set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
set(STARTUP_FILE_IAR ${MAX32_CMSIS}/Device/Maxim/MAX32665/Source/IAR/startup_max32665.S)
set(PERIPH_SRC ${MAX32_PERIPH}/Source)
add_library(${BOARD_TARGET} STATIC
@ -98,10 +97,6 @@ function(add_board_target BOARD_TARGET)
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()
@ -148,4 +143,18 @@ function(family_configure_example TARGET RTOS)
# Flashing
family_flash_jlink(${TARGET})
family_flash_msdk(${TARGET})
endfunction()
# Add flash msdk target
function(family_flash_msdk TARGET)
set(MAXIM_PATH "$ENV{MAXIM_PATH}")
add_custom_target(${TARGET}-msdk
DEPENDS ${TARGET}
COMMAND ${MAXIM_PATH}/Tools/OpenOCD/openocd -s ${MAXIM_PATH}/Tools/OpenOCD/scripts
-f interface/cmsis-dap.cfg -f target/max32665.cfg
-c "program $<TARGET_FILE:${TARGET}> verify; init; reset; exit"
VERBATIM
)
endfunction()

View File

@ -14,9 +14,6 @@ PORT ?= 0
SRC_S_GCC += $(MAX32_CMSIS)/Device/Maxim/MAX32665/Source/GCC/startup_max32665.S
LD_FILE = $(FAMILY_PATH)/max32666.ld
# IAR
#SRC_S_IAR += ?
# --------------
# Compiler Flags
# --------------
@ -42,7 +39,7 @@ LDFLAGS_GCC += -nostartfiles --specs=nosys.specs --specs=nano.specs
# For flash-jlink target
JLINK_DEVICE = max32666
# flash target using Jlik
# flash target using Jlink by default
flash: flash-jlink
# Optional flash option when running within an installed MSDK to use OpenOCD
@ -83,7 +80,6 @@ SRC_C += \
$(PERIPH_SRC)/UART/uart_me14.c \
$(PERIPH_SRC)/UART/uart_reva.c \
INC += \
$(TOP)/$(BOARD_PATH) \
$(TOP)/lib/CMSIS_5/CMSIS/Core/Include \

31
hw/bsp/max32690/README.md Normal file
View File

@ -0,0 +1,31 @@
# Analog Devices MAX32690
This BSP is for working with the Analog Devices
[MAX32690](https://www.analog.com/en/products/max32690.html) microcontroller.
The following boards are supported:
* [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)
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.
Both the Evaluation Kit and APARD 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>-msdk` CMake
target.

View File

@ -46,7 +46,6 @@ function(add_board_target BOARD_TARGET)
# Startup & Linker script
set(STARTUP_FILE_GNU ${MAX32_CMSIS}/Device/Maxim/MAX32690/Source/GCC/startup_max32690.s)
set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
set(STARTUP_FILE_IAR ${MAX32_CMSIS}/Device/Maxim/MAX32690/Source/IAR/startup_max32690.s)
set(PERIPH_SRC ${MAX32_PERIPH}/Source)
add_library(${BOARD_TARGET} STATIC
@ -103,10 +102,6 @@ function(add_board_target BOARD_TARGET)
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()
@ -153,4 +148,18 @@ function(family_configure_example TARGET RTOS)
# Flashing
family_flash_jlink(${TARGET})
family_flash_msdk(${TARGET})
endfunction()
# Add flash msdk target
function(family_flash_msdk TARGET)
set(MAXIM_PATH "$ENV{MAXIM_PATH}")
add_custom_target(${TARGET}-msdk
DEPENDS ${TARGET}
COMMAND ${MAXIM_PATH}/Tools/OpenOCD/openocd -s ${MAXIM_PATH}/Tools/OpenOCD/scripts
-f interface/cmsis-dap.cfg -f target/max32690.cfg
-c "program $<TARGET_FILE:${TARGET}> verify; init; reset; exit"
VERBATIM
)
endfunction()

View File

@ -14,9 +14,6 @@ PORT ?= 0
SRC_S_GCC += $(MAX32_CMSIS)/Device/Maxim/MAX32690/Source/GCC/startup_max32690.s
LD_FILE = $(FAMILY_PATH)/max32690.ld
# IAR
SRC_S_IAR += $(MAX32_CMSIS)/Device/Maxim/MAX32690/Source/IAR/startup_max32690.s
# --------------
# Compiler Flags
# --------------
@ -49,7 +46,7 @@ LDFLAGS_GCC += -nostartfiles --specs=nosys.specs --specs=nano.specs
# For flash-jlink target
JLINK_DEVICE = max32690
# flash target using Jlik
# flash target using Jlink by default
flash: flash-jlink
# Optional flash option when running within an installed MSDK to use OpenOCD
@ -91,7 +88,6 @@ SRC_C += \
$(PERIPH_SRC)/UART/uart_me18.c \
$(PERIPH_SRC)/UART/uart_revb.c \
INC += \
$(TOP)/$(BOARD_PATH) \
$(TOP)/lib/CMSIS_5/CMSIS/Core/Include \

28
hw/bsp/max78002/README.md Normal file
View File

@ -0,0 +1,28 @@
# Analog Devices MAX78002
This BSP is for working with the Analog Devices
[MAX78002](https://www.analog.com/en/products/max78002.html) AI microcontroller.
The following boards are supported:
* [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.
The Evaluation Kit is 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>-msdk` CMake target.

View File

@ -42,7 +42,6 @@ function(add_board_target BOARD_TARGET)
# 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
@ -102,10 +101,6 @@ function(add_board_target BOARD_TARGET)
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()
@ -155,4 +150,18 @@ function(family_configure_example TARGET RTOS)
# Flashing
family_flash_jlink(${TARGET})
family_flash_msdk(${TARGET})
endfunction()
# Add flash msdk target
function(family_flash_msdk TARGET)
set(MAXIM_PATH "$ENV{MAXIM_PATH}")
add_custom_target(${TARGET}-msdk
DEPENDS ${TARGET}
COMMAND ${MAXIM_PATH}/Tools/OpenOCD/openocd -s ${MAXIM_PATH}/Tools/OpenOCD/scripts
-f interface/cmsis-dap.cfg -f target/max78002.cfg
-c "program $<TARGET_FILE:${TARGET}> verify; init; reset; exit"
VERBATIM
)
endfunction()

View File

@ -14,9 +14,6 @@ PORT ?= 0
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
# --------------
@ -45,7 +42,7 @@ LDFLAGS_GCC += -nostartfiles --specs=nosys.specs --specs=nano.specs
# For flash-jlink target
JLINK_DEVICE = max78000
# flash target using Jlik
# flash target using Jlink by default
flash: flash-jlink
# Optional flash option when running within an installed MSDK to use OpenOCD
@ -88,7 +85,6 @@ SRC_C += \
$(PERIPH_SRC)/UART/uart_ai87.c \
$(PERIPH_SRC)/UART/uart_revb.c \
INC += \
$(TOP)/$(BOARD_PATH) \
$(TOP)/lib/CMSIS_5/CMSIS/Core/Include \