merge all maxim (32650, 32666, 32690, 78002) family into common bsp/maxim. Only support cmake build system
rename hw/mcu/analog/max32 to hw/mcu/analog/msdk
This commit is contained in:
2
.github/workflows/ci_set_matrix.py
vendored
2
.github/workflows/ci_set_matrix.py
vendored
@@ -24,7 +24,7 @@ family_list = {
|
|||||||
"lpc11 lpc13 lpc15": ["arm-gcc", "arm-clang"],
|
"lpc11 lpc13 lpc15": ["arm-gcc", "arm-clang"],
|
||||||
"lpc17 lpc18 lpc40 lpc43": ["arm-gcc", "arm-clang"],
|
"lpc17 lpc18 lpc40 lpc43": ["arm-gcc", "arm-clang"],
|
||||||
"lpc51 lpc54 lpc55": ["arm-gcc", "arm-clang"],
|
"lpc51 lpc54 lpc55": ["arm-gcc", "arm-clang"],
|
||||||
"max32650 max32666 max32690 max78002": ["arm-gcc"],
|
"maxim": ["arm-gcc"],
|
||||||
"mcx": ["arm-gcc"],
|
"mcx": ["arm-gcc"],
|
||||||
"mm32": ["arm-gcc"],
|
"mm32": ["arm-gcc"],
|
||||||
"msp430": ["msp430-gcc"],
|
"msp430": ["msp430-gcc"],
|
||||||
|
@@ -32,8 +32,6 @@ endif ()
|
|||||||
|
|
||||||
# Add example src and bsp directories
|
# Add example src and bsp directories
|
||||||
set(EXTRA_COMPONENT_DIRS "src" "${CMAKE_CURRENT_LIST_DIR}/boards" "${CMAKE_CURRENT_LIST_DIR}/components")
|
set(EXTRA_COMPONENT_DIRS "src" "${CMAKE_CURRENT_LIST_DIR}/boards" "${CMAKE_CURRENT_LIST_DIR}/components")
|
||||||
|
|
||||||
# set SDKCONFIG for each IDF Target
|
|
||||||
set(SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig)
|
set(SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig)
|
||||||
|
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
|
@@ -482,7 +482,7 @@ function(family_flash_openocd TARGET)
|
|||||||
# note skip verify since it has issue with rp2040
|
# note skip verify since it has issue with rp2040
|
||||||
add_custom_target(${TARGET}-openocd
|
add_custom_target(${TARGET}-openocd
|
||||||
DEPENDS ${TARGET}
|
DEPENDS ${TARGET}
|
||||||
COMMAND ${OPENOCD} -c "tcl_port disabled" -c "gdb_port disabled" ${OPTION_LIST} -c init -c halt -c "program $<TARGET_FILE:${TARGET}>" -c reset ${OPTION_LIST2} -c exit
|
COMMAND ${OPENOCD} -c "tcl_port disabled; gdb_port disabled" ${OPTION_LIST} -c "init; halt; program $<TARGET_FILE:${TARGET}>" -c reset ${OPTION_LIST2} -c exit
|
||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
@@ -502,10 +502,16 @@ endfunction()
|
|||||||
# Add flash openocd adi (Analog Devices) target
|
# Add flash openocd adi (Analog Devices) target
|
||||||
# included with msdk or compiled from release branch of https://github.com/analogdevicesinc/openocd
|
# included with msdk or compiled from release branch of https://github.com/analogdevicesinc/openocd
|
||||||
function(family_flash_openocd_adi TARGET)
|
function(family_flash_openocd_adi TARGET)
|
||||||
if (DEFINED $ENV{MAXIM_PATH})
|
if (DEFINED MAXIM_PATH)
|
||||||
# use openocd from msdk
|
# use openocd from msdk with MAXIM_PATH cmake variable first if the user specified it
|
||||||
set(OPENOCD ENV{MAXIM_PATH}/Tools/OpenOCD/openocd)
|
set(OPENOCD ${MAXIM_PATH}/Tools/OpenOCD/openocd)
|
||||||
set(OPENOCD_OPTION2 "-s ENV{MAXIM_PATH}/Tools/OpenOCD/scripts")
|
set(OPENOCD_OPTION2 "-s ${MAXIM_PATH}/Tools/OpenOCD/scripts")
|
||||||
|
elseif (DEFINED ENV{MAXIM_PATH})
|
||||||
|
# use openocd from msdk with MAXIM_PATH environment variable. Normalize
|
||||||
|
# since msdk can be Windows (MinGW) or Linux
|
||||||
|
file(TO_CMAKE_PATH "$ENV{MAXIM_PATH}" MAXIM_PATH_NORM)
|
||||||
|
set(OPENOCD ${MAXIM_PATH_NORM}/Tools/OpenOCD/openocd)
|
||||||
|
set(OPENOCD_OPTION2 "-s ${MAXIM_PATH_NORM}/Tools/OpenOCD/scripts")
|
||||||
else()
|
else()
|
||||||
# compiled from source
|
# compiled from source
|
||||||
if (NOT DEFINED OPENOCD_ADI_PATH)
|
if (NOT DEFINED OPENOCD_ADI_PATH)
|
||||||
|
@@ -1,46 +0,0 @@
|
|||||||
# 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.
|
|
@@ -1,10 +0,0 @@
|
|||||||
# 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()
|
|
@@ -1,2 +0,0 @@
|
|||||||
# Use the standard, non-secure linker file
|
|
||||||
LD_FILE = $(BOARD_PATH)/max32650.ld
|
|
@@ -1,10 +0,0 @@
|
|||||||
# 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()
|
|
@@ -1,2 +0,0 @@
|
|||||||
# Use the standard, non-secure linker file
|
|
||||||
LD_FILE = $(BOARD_PATH)/max32650.ld
|
|
@@ -1,119 +0,0 @@
|
|||||||
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")
|
|
||||||
}
|
|
@@ -1,5 +0,0 @@
|
|||||||
# Use the secure linker file
|
|
||||||
LD_FILE = $(BOARD_PATH)/max32651.ld
|
|
||||||
|
|
||||||
# Let the family script know the build needs to be signed
|
|
||||||
SIGNED_BUILD := 1
|
|
@@ -1,177 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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"
|
|
||||||
#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
|
|
||||||
MXC_UART_Init(ConsoleUart, CFG_BOARD_UART_BAUDRATE);
|
|
||||||
|
|
||||||
//USB
|
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
|
||||||
// Board porting API
|
|
||||||
//--------------------------------------------------------------------+
|
|
||||||
|
|
||||||
void board_led_write(bool state) {
|
|
||||||
#if LED_STATE_ON
|
|
||||||
state = !state;
|
|
||||||
#endif
|
|
||||||
if (state) {
|
|
||||||
MXC_GPIO_OutClr(LED_PORT, LED_PIN);
|
|
||||||
} else {
|
|
||||||
MXC_GPIO_OutSet(LED_PORT, LED_PIN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t board_button_read(void) {
|
|
||||||
uint32_t state = MXC_GPIO_InGet(BUTTON_PORT, BUTTON_PIN) ? 1 : 0;
|
|
||||||
return BUTTON_STATE_ACTIVE == state;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t board_get_unique_id(uint8_t id[], size_t max_len) {
|
|
||||||
uint8_t hw_id[13];//USN Buffer
|
|
||||||
MXC_SYS_GetUSN(hw_id, 13);
|
|
||||||
|
|
||||||
size_t act_len = TU_MIN(max_len, 13);
|
|
||||||
memcpy(id, hw_id, act_len);
|
|
||||||
return act_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
int board_uart_read(uint8_t *buf, int len) {
|
|
||||||
int uart_val;
|
|
||||||
int act_len = 0;
|
|
||||||
|
|
||||||
while (act_len < len) {
|
|
||||||
if ((uart_val = MXC_UART_ReadCharacterRaw(ConsoleUart)) == E_UNDERFLOW) {
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
*buf++ = (uint8_t) uart_val;
|
|
||||||
act_len++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return act_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
int board_uart_write(void const *buf, int len) {
|
|
||||||
int act_len = 0;
|
|
||||||
const uint8_t *ch_ptr = (const uint8_t *) buf;
|
|
||||||
while (act_len < len) {
|
|
||||||
MXC_UART_WriteCharacter(ConsoleUart, *ch_ptr++);
|
|
||||||
act_len++;
|
|
||||||
}
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
|
||||||
volatile uint32_t system_ticks = 0;
|
|
||||||
|
|
||||||
void SysTick_Handler(void) {
|
|
||||||
system_ticks++;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t board_millis(void) {
|
|
||||||
return system_ticks;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void HardFault_Handler(void) {
|
|
||||||
__asm("BKPT #0\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Required by __libc_init_array in startup code if we are compiling using
|
|
||||||
// -nostdlib/-nostartfiles.
|
|
||||||
void _init(void) {
|
|
||||||
}
|
|
@@ -1,169 +0,0 @@
|
|||||||
include_guard()
|
|
||||||
|
|
||||||
set(MAX32_PERIPH ${TOP}/hw/mcu/analog/max32/Libraries/PeriphDrivers)
|
|
||||||
set(MAX32_CMSIS ${TOP}/hw/mcu/analog/max32/Libraries/CMSIS)
|
|
||||||
set(CMSIS_5 ${TOP}/lib/CMSIS_5)
|
|
||||||
|
|
||||||
# include board specific information and functions
|
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
|
||||||
|
|
||||||
# Get the linker file
|
|
||||||
set(LD_FILE_Clang ${LD_FILE_GNU})
|
|
||||||
|
|
||||||
# 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)
|
|
||||||
set(JLINK_DEVICE max32650)
|
|
||||||
set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -f target/max32650.cfg")
|
|
||||||
|
|
||||||
set(FAMILY_MCUS MAX32650 CACHE INTERNAL "")
|
|
||||||
|
|
||||||
function(update_board TARGET)
|
|
||||||
target_compile_definitions(${TARGET} PUBLIC
|
|
||||||
TARGET=MAX32650
|
|
||||||
TARGET_REV=0x4131
|
|
||||||
MXC_ASSERT_ENABLE
|
|
||||||
MAX32650
|
|
||||||
IAR_PRAGMAS=0
|
|
||||||
CFG_TUSB_MCU=OPT_MCU_MAX32650
|
|
||||||
BOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
|
|
||||||
)
|
|
||||||
|
|
||||||
# Run any board specific updates
|
|
||||||
update_board_extras(${TARGET})
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
#------------------------------------
|
|
||||||
# BOARD_TARGET
|
|
||||||
#------------------------------------
|
|
||||||
# only need to be built ONCE for all examples
|
|
||||||
function(add_board_target BOARD_TARGET)
|
|
||||||
if (TARGET ${BOARD_TARGET})
|
|
||||||
return()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Startup & Linker script
|
|
||||||
set(STARTUP_FILE_GNU ${MAX32_CMSIS}/Device/Maxim/MAX32650/Source/GCC/startup_max32650.S)
|
|
||||||
set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
|
|
||||||
|
|
||||||
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
|
|
||||||
${PERIPH_SRC}/SYS/mxc_lock.c
|
|
||||||
${PERIPH_SRC}/SYS/nvic_table.c
|
|
||||||
${PERIPH_SRC}/SYS/pins_me10.c
|
|
||||||
${PERIPH_SRC}/SYS/sys_me10.c
|
|
||||||
${PERIPH_SRC}/TPU/tpu_me10.c
|
|
||||||
${PERIPH_SRC}/TPU/tpu_reva.c
|
|
||||||
${PERIPH_SRC}/FLC/flc_common.c
|
|
||||||
${PERIPH_SRC}/FLC/flc_me10.c
|
|
||||||
${PERIPH_SRC}/FLC/flc_reva.c
|
|
||||||
${PERIPH_SRC}/GPIO/gpio_common.c
|
|
||||||
${PERIPH_SRC}/GPIO/gpio_me10.c
|
|
||||||
${PERIPH_SRC}/GPIO/gpio_reva.c
|
|
||||||
${PERIPH_SRC}/ICC/icc_me10.c
|
|
||||||
${PERIPH_SRC}/ICC/icc_reva.c
|
|
||||||
${PERIPH_SRC}/ICC/icc_common.c
|
|
||||||
${PERIPH_SRC}/UART/uart_common.c
|
|
||||||
${PERIPH_SRC}/UART/uart_me10.c
|
|
||||||
${PERIPH_SRC}/UART/uart_reva.c
|
|
||||||
${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
|
|
||||||
)
|
|
||||||
target_include_directories(${BOARD_TARGET} PUBLIC
|
|
||||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
|
||||||
${MAX32_CMSIS}/Include
|
|
||||||
${MAX32_CMSIS}/Device/Maxim/MAX32650/Include
|
|
||||||
${MAX32_PERIPH}/Include/MAX32650
|
|
||||||
${PERIPH_SRC}/SYS
|
|
||||||
${PERIPH_SRC}/GPIO
|
|
||||||
${PERIPH_SRC}/TPU
|
|
||||||
${PERIPH_SRC}/ICC
|
|
||||||
${PERIPH_SRC}/FLC
|
|
||||||
${PERIPH_SRC}/UART
|
|
||||||
)
|
|
||||||
|
|
||||||
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
|
|
||||||
-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}"
|
|
||||||
)
|
|
||||||
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_MAX32650)
|
|
||||||
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})
|
|
||||||
target_compile_options(${TARGET} PRIVATE
|
|
||||||
-Wno-error=strict-prototypes
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Flashing
|
|
||||||
family_add_bin_hex(${TARGET})
|
|
||||||
family_flash_jlink(${TARGET})
|
|
||||||
family_flash_openocd_adi(${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()
|
|
@@ -1,140 +0,0 @@
|
|||||||
DEPS_SUBMODULES += lib/CMSIS_5 hw/mcu/analog/max32
|
|
||||||
|
|
||||||
# Important locations in the hw support for MCU
|
|
||||||
MAX32_CMSIS = hw/mcu/analog/max32/Libraries/CMSIS
|
|
||||||
MAX32_PERIPH = hw/mcu/analog/max32/Libraries/PeriphDrivers
|
|
||||||
|
|
||||||
# Add any board specific make rules
|
|
||||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
|
||||||
|
|
||||||
CPU_CORE ?= cortex-m4
|
|
||||||
PORT ?= 0
|
|
||||||
|
|
||||||
# GCC
|
|
||||||
SRC_S_GCC += $(MAX32_CMSIS)/Device/Maxim/MAX32650/Source/GCC/startup_max32650.S
|
|
||||||
|
|
||||||
# --------------
|
|
||||||
# Compiler Flags
|
|
||||||
# --------------
|
|
||||||
# Flags for the MAX32650/1/2 SDK
|
|
||||||
CFLAGS += -DTARGET=MAX32650 \
|
|
||||||
-DTARGET_REV=0x4131 \
|
|
||||||
-DMXC_ASSERT_ENABLE \
|
|
||||||
-DMAX32650 \
|
|
||||||
-DIAR_PRAGMAS=0
|
|
||||||
|
|
||||||
# Flags for TUSB features
|
|
||||||
CFLAGS += \
|
|
||||||
-DCFG_TUSB_MCU=OPT_MCU_MAX32650 \
|
|
||||||
-DBOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
|
|
||||||
|
|
||||||
# mcu driver cause following warnings
|
|
||||||
CFLAGS += -Wno-error=strict-prototypes \
|
|
||||||
-Wno-error=unused-parameter \
|
|
||||||
-Wno-error=cast-align \
|
|
||||||
-Wno-error=cast-qual \
|
|
||||||
-Wno-error=sign-compare
|
|
||||||
|
|
||||||
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
|
|
||||||
# -----------------
|
|
||||||
PERIPH_SRC = $(TOP)/$(MAX32_PERIPH)/Source
|
|
||||||
SRC_C += \
|
|
||||||
src/portable/mentor/musb/dcd_musb.c \
|
|
||||||
$(MAX32_CMSIS)/Device/Maxim/MAX32650/Source/heap.c \
|
|
||||||
$(MAX32_CMSIS)/Device/Maxim/MAX32650/Source/system_max32650.c \
|
|
||||||
$(MAX32_CMSIS)/Device/Maxim/MAX32650/Source/header_MAX32650.c \
|
|
||||||
$(PERIPH_SRC)/SYS/mxc_assert.c \
|
|
||||||
$(PERIPH_SRC)/SYS/mxc_delay.c \
|
|
||||||
$(PERIPH_SRC)/SYS/mxc_lock.c \
|
|
||||||
$(PERIPH_SRC)/SYS/nvic_table.c \
|
|
||||||
$(PERIPH_SRC)/SYS/pins_me10.c \
|
|
||||||
$(PERIPH_SRC)/SYS/sys_me10.c \
|
|
||||||
$(PERIPH_SRC)/FLC/flc_common.c \
|
|
||||||
$(PERIPH_SRC)/FLC/flc_me10.c \
|
|
||||||
$(PERIPH_SRC)/FLC/flc_reva.c \
|
|
||||||
$(PERIPH_SRC)/GPIO/gpio_common.c \
|
|
||||||
$(PERIPH_SRC)/GPIO/gpio_me10.c \
|
|
||||||
$(PERIPH_SRC)/GPIO/gpio_reva.c \
|
|
||||||
$(PERIPH_SRC)/ICC/icc_me10.c \
|
|
||||||
$(PERIPH_SRC)/ICC/icc_reva.c \
|
|
||||||
$(PERIPH_SRC)/ICC/icc_common.c \
|
|
||||||
$(PERIPH_SRC)/TPU/tpu_me10.c \
|
|
||||||
$(PERIPH_SRC)/TPU/tpu_reva.c \
|
|
||||||
$(PERIPH_SRC)/UART/uart_common.c \
|
|
||||||
$(PERIPH_SRC)/UART/uart_me10.c \
|
|
||||||
$(PERIPH_SRC)/UART/uart_reva.c \
|
|
||||||
|
|
||||||
INC += \
|
|
||||||
$(TOP)/$(BOARD_PATH) \
|
|
||||||
$(TOP)/$(MAX32_CMSIS)/Include \
|
|
||||||
$(TOP)/$(MAX32_CMSIS)/Device/Maxim/MAX32650/Include \
|
|
||||||
$(TOP)/$(MAX32_PERIPH)/Include/MAX32650 \
|
|
||||||
$(PERIPH_SRC)/SYS \
|
|
||||||
$(PERIPH_SRC)/GPIO \
|
|
||||||
$(PERIPH_SRC)/ICC \
|
|
||||||
$(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 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"
|
|
@@ -1,149 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
|
|
@@ -1,32 +0,0 @@
|
|||||||
# 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.
|
|
@@ -1 +0,0 @@
|
|||||||
# Nothing to be done at the board level
|
|
@@ -1 +0,0 @@
|
|||||||
# No specific build requirements for the board.
|
|
@@ -1 +0,0 @@
|
|||||||
# Nothing to be done at the board level
|
|
@@ -1 +0,0 @@
|
|||||||
# No specific build requirements for the board.
|
|
@@ -1,147 +0,0 @@
|
|||||||
include_guard()
|
|
||||||
|
|
||||||
set(MAX32_PERIPH ${TOP}/hw/mcu/analog/max32/Libraries/PeriphDrivers)
|
|
||||||
set(MAX32_CMSIS ${TOP}/hw/mcu/analog/max32/Libraries/CMSIS)
|
|
||||||
set(CMSIS_5 ${TOP}/lib/CMSIS_5)
|
|
||||||
|
|
||||||
# include board specific
|
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
|
||||||
|
|
||||||
# Get the linker file from current location (family)
|
|
||||||
set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/max32666.ld)
|
|
||||||
set(LD_FILE_Clang ${LD_FILE_GNU})
|
|
||||||
|
|
||||||
# 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)
|
|
||||||
set(JLINK_DEVICE max32666)
|
|
||||||
set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -f target/max32665.cfg")
|
|
||||||
|
|
||||||
set(FAMILY_MCUS MAX32666 CACHE INTERNAL "")
|
|
||||||
|
|
||||||
function(update_board TARGET)
|
|
||||||
target_compile_definitions(${TARGET} PUBLIC
|
|
||||||
TARGET=MAX32665
|
|
||||||
TARGET_REV=0x4131
|
|
||||||
MXC_ASSERT_ENABLE
|
|
||||||
MAX32665
|
|
||||||
IAR_PRAGMAS=0
|
|
||||||
CFG_TUSB_MCU=OPT_MCU_MAX32666
|
|
||||||
BOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
|
|
||||||
)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
#------------------------------------
|
|
||||||
# BOARD_TARGET
|
|
||||||
#------------------------------------
|
|
||||||
# only need to be built ONCE for all examples
|
|
||||||
function(add_board_target BOARD_TARGET)
|
|
||||||
if (TARGET ${BOARD_TARGET})
|
|
||||||
return()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Startup & Linker script
|
|
||||||
set(STARTUP_FILE_GNU ${MAX32_CMSIS}/Device/Maxim/MAX32665/Source/GCC/startup_max32665.S)
|
|
||||||
set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
|
|
||||||
|
|
||||||
set(PERIPH_SRC ${MAX32_PERIPH}/Source)
|
|
||||||
add_library(${BOARD_TARGET} STATIC
|
|
||||||
${MAX32_CMSIS}/Device/Maxim/MAX32665/Source/heap.c
|
|
||||||
${MAX32_CMSIS}/Device/Maxim/MAX32665/Source/system_max32665.c
|
|
||||||
${PERIPH_SRC}/SYS/mxc_assert.c
|
|
||||||
${PERIPH_SRC}/SYS/mxc_delay.c
|
|
||||||
${PERIPH_SRC}/SYS/mxc_lock.c
|
|
||||||
${PERIPH_SRC}/SYS/nvic_table.c
|
|
||||||
${PERIPH_SRC}/SYS/pins_me14.c
|
|
||||||
${PERIPH_SRC}/SYS/sys_me14.c
|
|
||||||
${PERIPH_SRC}/TPU/tpu_me14.c
|
|
||||||
${PERIPH_SRC}/TPU/tpu_reva.c
|
|
||||||
${PERIPH_SRC}/FLC/flc_common.c
|
|
||||||
${PERIPH_SRC}/FLC/flc_me14.c
|
|
||||||
${PERIPH_SRC}/FLC/flc_reva.c
|
|
||||||
${PERIPH_SRC}/GPIO/gpio_common.c
|
|
||||||
${PERIPH_SRC}/GPIO/gpio_me14.c
|
|
||||||
${PERIPH_SRC}/GPIO/gpio_reva.c
|
|
||||||
${PERIPH_SRC}/ICC/icc_me14.c
|
|
||||||
${PERIPH_SRC}/ICC/icc_reva.c
|
|
||||||
${PERIPH_SRC}/UART/uart_common.c
|
|
||||||
${PERIPH_SRC}/UART/uart_me14.c
|
|
||||||
${PERIPH_SRC}/UART/uart_reva.c
|
|
||||||
${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
|
|
||||||
)
|
|
||||||
target_include_directories(${BOARD_TARGET} PUBLIC
|
|
||||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
|
||||||
${MAX32_CMSIS}/Include
|
|
||||||
${MAX32_CMSIS}/Device/Maxim/MAX32665/Include
|
|
||||||
${MAX32_PERIPH}/Include/MAX32665
|
|
||||||
${PERIPH_SRC}/SYS
|
|
||||||
${PERIPH_SRC}/GPIO
|
|
||||||
${PERIPH_SRC}/TPU
|
|
||||||
${PERIPH_SRC}/ICC
|
|
||||||
${PERIPH_SRC}/FLC
|
|
||||||
${PERIPH_SRC}/UART
|
|
||||||
)
|
|
||||||
|
|
||||||
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_MAX32666)
|
|
||||||
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})
|
|
||||||
target_compile_options(${TARGET} PRIVATE
|
|
||||||
-Wno-error=strict-prototypes
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Flashing
|
|
||||||
family_add_bin_hex(${TARGET})
|
|
||||||
family_flash_jlink(${TARGET})
|
|
||||||
family_flash_openocd_adi(${TARGET})
|
|
||||||
endfunction()
|
|
@@ -1,93 +0,0 @@
|
|||||||
DEPS_SUBMODULES += lib/CMSIS_5 hw/mcu/analog/max32
|
|
||||||
|
|
||||||
# Important locations in the hw support for MCU
|
|
||||||
MAX32_CMSIS = hw/mcu/analog/max32/Libraries/CMSIS
|
|
||||||
MAX32_PERIPH = hw/mcu/analog/max32/Libraries/PeriphDrivers
|
|
||||||
|
|
||||||
# Add any board specific make rules
|
|
||||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
|
||||||
|
|
||||||
CPU_CORE ?= cortex-m4
|
|
||||||
PORT ?= 0
|
|
||||||
|
|
||||||
# GCC
|
|
||||||
SRC_S_GCC += $(MAX32_CMSIS)/Device/Maxim/MAX32665/Source/GCC/startup_max32665.S
|
|
||||||
LD_FILE = $(FAMILY_PATH)/max32666.ld
|
|
||||||
|
|
||||||
# --------------
|
|
||||||
# Compiler Flags
|
|
||||||
# --------------
|
|
||||||
# Flags for the MAX32665/6 SDK
|
|
||||||
CFLAGS += -DTARGET=MAX32665 \
|
|
||||||
-DTARGET_REV=0x4131 \
|
|
||||||
-DMXC_ASSERT_ENABLE \
|
|
||||||
-DMAX32665 \
|
|
||||||
-DIAR_PRAGMAS=0
|
|
||||||
|
|
||||||
# Flags for TUSB features
|
|
||||||
CFLAGS += \
|
|
||||||
-DCFG_TUSB_MCU=OPT_MCU_MAX32666 \
|
|
||||||
-DBOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
|
|
||||||
|
|
||||||
# mcu driver cause following warnings
|
|
||||||
CFLAGS += -Wno-error=strict-prototypes \
|
|
||||||
-Wno-error=unused-parameter \
|
|
||||||
-Wno-error=cast-align \
|
|
||||||
-Wno-error=cast-qual
|
|
||||||
LDFLAGS_GCC += -nostartfiles --specs=nosys.specs --specs=nano.specs
|
|
||||||
|
|
||||||
# For flash-jlink target
|
|
||||||
JLINK_DEVICE = max32666
|
|
||||||
|
|
||||||
# flash target using Jlink by default
|
|
||||||
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/max32665.cfg \
|
|
||||||
-c "program $(BUILD)/$(PROJECT).elf verify; init; reset; exit"
|
|
||||||
|
|
||||||
# -----------------
|
|
||||||
# Sources & Include
|
|
||||||
# -----------------
|
|
||||||
PERIPH_SRC = $(TOP)/$(MAX32_PERIPH)/Source
|
|
||||||
SRC_C += \
|
|
||||||
src/portable/mentor/musb/dcd_musb.c \
|
|
||||||
$(MAX32_CMSIS)/Device/Maxim/MAX32665/Source/heap.c \
|
|
||||||
$(MAX32_CMSIS)/Device/Maxim/MAX32665/Source/system_max32665.c \
|
|
||||||
$(PERIPH_SRC)/SYS/mxc_assert.c \
|
|
||||||
$(PERIPH_SRC)/SYS/mxc_delay.c \
|
|
||||||
$(PERIPH_SRC)/SYS/mxc_lock.c \
|
|
||||||
$(PERIPH_SRC)/SYS/nvic_table.c \
|
|
||||||
$(PERIPH_SRC)/SYS/pins_me14.c \
|
|
||||||
$(PERIPH_SRC)/SYS/sys_me14.c \
|
|
||||||
$(PERIPH_SRC)/FLC/flc_common.c \
|
|
||||||
$(PERIPH_SRC)/FLC/flc_me14.c \
|
|
||||||
$(PERIPH_SRC)/FLC/flc_reva.c \
|
|
||||||
$(PERIPH_SRC)/GPIO/gpio_common.c \
|
|
||||||
$(PERIPH_SRC)/GPIO/gpio_me14.c \
|
|
||||||
$(PERIPH_SRC)/GPIO/gpio_reva.c \
|
|
||||||
$(PERIPH_SRC)/ICC/icc_me14.c \
|
|
||||||
$(PERIPH_SRC)/ICC/icc_reva.c \
|
|
||||||
$(PERIPH_SRC)/TPU/tpu_me14.c \
|
|
||||||
$(PERIPH_SRC)/TPU/tpu_reva.c \
|
|
||||||
$(PERIPH_SRC)/UART/uart_common.c \
|
|
||||||
$(PERIPH_SRC)/UART/uart_me14.c \
|
|
||||||
$(PERIPH_SRC)/UART/uart_reva.c \
|
|
||||||
|
|
||||||
INC += \
|
|
||||||
$(TOP)/$(BOARD_PATH) \
|
|
||||||
$(TOP)/$(MAX32_CMSIS)/Include \
|
|
||||||
$(TOP)/$(MAX32_CMSIS)/Device/Maxim/MAX32665/Include \
|
|
||||||
$(TOP)/$(MAX32_PERIPH)/Include/MAX32665 \
|
|
||||||
$(PERIPH_SRC)/SYS \
|
|
||||||
$(PERIPH_SRC)/GPIO \
|
|
||||||
$(PERIPH_SRC)/ICC \
|
|
||||||
$(PERIPH_SRC)/FLC \
|
|
||||||
$(PERIPH_SRC)/TPU \
|
|
||||||
$(PERIPH_SRC)/UART
|
|
@@ -1,149 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
|
|
@@ -1,31 +0,0 @@
|
|||||||
# 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.
|
|
@@ -1 +0,0 @@
|
|||||||
# Nothing to be done at the board level
|
|
@@ -1 +0,0 @@
|
|||||||
# No specific build requirements for the board.
|
|
@@ -1 +0,0 @@
|
|||||||
# Nothing to be done at the board level
|
|
@@ -1 +0,0 @@
|
|||||||
# No specific build requirements for the board.
|
|
@@ -1,175 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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"
|
|
||||||
#include "mcr_regs.h"
|
|
||||||
#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
|
|
||||||
MXC_UART_Init(ConsoleUart, CFG_BOARD_UART_BAUDRATE, MXC_UART_IBRO_CLK);
|
|
||||||
|
|
||||||
//USB
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
|
||||||
// Board porting API
|
|
||||||
//--------------------------------------------------------------------+
|
|
||||||
|
|
||||||
void board_led_write(bool state) {
|
|
||||||
#if LED_STATE_ON
|
|
||||||
state = !state;
|
|
||||||
#endif
|
|
||||||
if (state) {
|
|
||||||
MXC_GPIO_OutClr(LED_PORT, LED_PIN);
|
|
||||||
} else {
|
|
||||||
MXC_GPIO_OutSet(LED_PORT, LED_PIN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t board_button_read(void) {
|
|
||||||
uint32_t state = MXC_GPIO_InGet(BUTTON_PORT, BUTTON_PIN) ? 1 : 0;
|
|
||||||
return BUTTON_STATE_ACTIVE == state;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t board_get_unique_id(uint8_t id[], size_t max_len) {
|
|
||||||
uint8_t hw_id[MXC_SYS_USN_CHECKSUM_LEN];//USN Buffer
|
|
||||||
/* All other 2nd parameter is optional checksum buffer */
|
|
||||||
MXC_SYS_GetUSN(hw_id, NULL);
|
|
||||||
|
|
||||||
size_t act_len = TU_MIN(max_len, MXC_SYS_USN_LEN);
|
|
||||||
memcpy(id, hw_id, act_len);
|
|
||||||
return act_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
int board_uart_read(uint8_t *buf, int len) {
|
|
||||||
int uart_val;
|
|
||||||
int act_len = 0;
|
|
||||||
|
|
||||||
while (act_len < len) {
|
|
||||||
if ((uart_val = MXC_UART_ReadCharacterRaw(ConsoleUart)) == E_UNDERFLOW) {
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
*buf++ = (uint8_t) uart_val;
|
|
||||||
act_len++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return act_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
int board_uart_write(void const *buf, int len) {
|
|
||||||
int act_len = 0;
|
|
||||||
const uint8_t *ch_ptr = (const uint8_t *) buf;
|
|
||||||
while (act_len < len) {
|
|
||||||
MXC_UART_WriteCharacter(ConsoleUart, *ch_ptr++);
|
|
||||||
act_len++;
|
|
||||||
}
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
|
||||||
volatile uint32_t system_ticks = 0;
|
|
||||||
|
|
||||||
void SysTick_Handler(void) {
|
|
||||||
system_ticks++;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t board_millis(void) {
|
|
||||||
return system_ticks;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void HardFault_Handler(void) {
|
|
||||||
__asm("BKPT #0\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Required by __libc_init_array in startup code if we are compiling using
|
|
||||||
// -nostdlib/-nostartfiles.
|
|
||||||
void _init(void) {
|
|
||||||
}
|
|
@@ -1,152 +0,0 @@
|
|||||||
include_guard()
|
|
||||||
|
|
||||||
set(MAX32_PERIPH ${TOP}/hw/mcu/analog/max32/Libraries/PeriphDrivers)
|
|
||||||
set(MAX32_CMSIS ${TOP}/hw/mcu/analog/max32/Libraries/CMSIS)
|
|
||||||
set(CMSIS_5 ${TOP}/lib/CMSIS_5)
|
|
||||||
|
|
||||||
# include board specific
|
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
|
||||||
|
|
||||||
# Get the linker file from current location (family)
|
|
||||||
set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/max32690.ld)
|
|
||||||
set(LD_FILE_Clang ${LD_FILE_GNU})
|
|
||||||
|
|
||||||
# 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)
|
|
||||||
set(JLINK_DEVICE max32690)
|
|
||||||
set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -f target/max32690.cfg")
|
|
||||||
|
|
||||||
set(FAMILY_MCUS MAX32690 CACHE INTERNAL "")
|
|
||||||
|
|
||||||
function(update_board TARGET)
|
|
||||||
target_compile_definitions(${TARGET} PUBLIC
|
|
||||||
TARGET=MAX32690
|
|
||||||
TARGET_REV=0x4131
|
|
||||||
MXC_ASSERT_ENABLE
|
|
||||||
MAX32690
|
|
||||||
FLASH_ORIGIN=0x10000000
|
|
||||||
FLASH_SIZE=0x340000
|
|
||||||
SRAM_ORIGIN=0x20000000
|
|
||||||
SRAM_SIZE=0x100000
|
|
||||||
IAR_PRAGMAS=0
|
|
||||||
CFG_TUSB_MCU=OPT_MCU_MAX32690
|
|
||||||
BOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
|
|
||||||
)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
#------------------------------------
|
|
||||||
# BOARD_TARGET
|
|
||||||
#------------------------------------
|
|
||||||
# only need to be built ONCE for all examples
|
|
||||||
function(add_board_target BOARD_TARGET)
|
|
||||||
if (TARGET ${BOARD_TARGET})
|
|
||||||
return()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Startup & Linker script
|
|
||||||
set(STARTUP_FILE_GNU ${MAX32_CMSIS}/Device/Maxim/MAX32690/Source/GCC/startup_max32690.S)
|
|
||||||
set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
|
|
||||||
|
|
||||||
set(PERIPH_SRC ${MAX32_PERIPH}/Source)
|
|
||||||
add_library(${BOARD_TARGET} STATIC
|
|
||||||
${MAX32_CMSIS}/Device/Maxim/MAX32690/Source/heap.c
|
|
||||||
${MAX32_CMSIS}/Device/Maxim/MAX32690/Source/system_max32690.c
|
|
||||||
${PERIPH_SRC}/SYS/mxc_assert.c
|
|
||||||
${PERIPH_SRC}/SYS/mxc_delay.c
|
|
||||||
${PERIPH_SRC}/SYS/mxc_lock.c
|
|
||||||
${PERIPH_SRC}/SYS/nvic_table.c
|
|
||||||
${PERIPH_SRC}/SYS/pins_me18.c
|
|
||||||
${PERIPH_SRC}/SYS/sys_me18.c
|
|
||||||
${PERIPH_SRC}/CTB/ctb_me18.c
|
|
||||||
${PERIPH_SRC}/CTB/ctb_reva.c
|
|
||||||
${PERIPH_SRC}/CTB/ctb_common.c
|
|
||||||
${PERIPH_SRC}/FLC/flc_common.c
|
|
||||||
${PERIPH_SRC}/FLC/flc_me18.c
|
|
||||||
${PERIPH_SRC}/FLC/flc_reva.c
|
|
||||||
${PERIPH_SRC}/GPIO/gpio_common.c
|
|
||||||
${PERIPH_SRC}/GPIO/gpio_me18.c
|
|
||||||
${PERIPH_SRC}/GPIO/gpio_reva.c
|
|
||||||
${PERIPH_SRC}/ICC/icc_me18.c
|
|
||||||
${PERIPH_SRC}/ICC/icc_reva.c
|
|
||||||
${PERIPH_SRC}/UART/uart_common.c
|
|
||||||
${PERIPH_SRC}/UART/uart_me18.c
|
|
||||||
${PERIPH_SRC}/UART/uart_revb.c
|
|
||||||
${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
|
|
||||||
)
|
|
||||||
target_include_directories(${BOARD_TARGET} PUBLIC
|
|
||||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
|
||||||
${MAX32_CMSIS}/Include
|
|
||||||
${MAX32_CMSIS}/Device/Maxim/MAX32690/Include
|
|
||||||
${MAX32_PERIPH}/Include/MAX32690
|
|
||||||
${PERIPH_SRC}/SYS
|
|
||||||
${PERIPH_SRC}/GPIO
|
|
||||||
${PERIPH_SRC}/CTB
|
|
||||||
${PERIPH_SRC}/ICC
|
|
||||||
${PERIPH_SRC}/FLC
|
|
||||||
${PERIPH_SRC}/UART
|
|
||||||
)
|
|
||||||
|
|
||||||
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_MAX32690)
|
|
||||||
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})
|
|
||||||
target_compile_options(${TARGET} PRIVATE
|
|
||||||
-Wno-error=strict-prototypes
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Flashing
|
|
||||||
family_add_bin_hex(${TARGET})
|
|
||||||
family_flash_jlink(${TARGET})
|
|
||||||
family_flash_openocd_adi(${TARGET})
|
|
||||||
endfunction()
|
|
@@ -1,101 +0,0 @@
|
|||||||
DEPS_SUBMODULES += lib/CMSIS_5 hw/mcu/analog/max32
|
|
||||||
|
|
||||||
# Important locations in the hw support for MCU
|
|
||||||
MAX32_CMSIS = hw/mcu/analog/max32/Libraries/CMSIS
|
|
||||||
MAX32_PERIPH = hw/mcu/analog/max32/Libraries/PeriphDrivers
|
|
||||||
|
|
||||||
# Add any board specific make rules
|
|
||||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
|
||||||
|
|
||||||
CPU_CORE ?= cortex-m4
|
|
||||||
PORT ?= 0
|
|
||||||
|
|
||||||
# GCC
|
|
||||||
SRC_S_GCC += $(MAX32_CMSIS)/Device/Maxim/MAX32690/Source/GCC/startup_max32690.S
|
|
||||||
LD_FILE = $(FAMILY_PATH)/max32690.ld
|
|
||||||
|
|
||||||
# --------------
|
|
||||||
# Compiler Flags
|
|
||||||
# --------------
|
|
||||||
# Flags for the MAX32690 SDK
|
|
||||||
CFLAGS += -DTARGET=MAX32690 \
|
|
||||||
-DTARGET_REV=0x4131 \
|
|
||||||
-DMXC_ASSERT_ENABLE \
|
|
||||||
-DMAX32690 \
|
|
||||||
-DFLASH_ORIGIN=0x10000000 \
|
|
||||||
-DFLASH_SIZE=0x340000 \
|
|
||||||
-DSRAM_ORIGIN=0x20000000 \
|
|
||||||
-DSRAM_SIZE=0x100000 \
|
|
||||||
-DIAR_PRAGMAS=0
|
|
||||||
|
|
||||||
# Flags for TUSB features
|
|
||||||
CFLAGS += \
|
|
||||||
-DCFG_TUSB_MCU=OPT_MCU_MAX32690 \
|
|
||||||
-DBOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
|
|
||||||
|
|
||||||
# mcu driver cause following warnings
|
|
||||||
CFLAGS += -Wno-error=unused-parameter \
|
|
||||||
-Wno-error=strict-prototypes \
|
|
||||||
-Wno-error=old-style-declaration \
|
|
||||||
-Wno-error=sign-compare \
|
|
||||||
-Wno-error=cast-qual \
|
|
||||||
-Wno-lto-type-mismatch
|
|
||||||
|
|
||||||
LDFLAGS_GCC += -nostartfiles --specs=nosys.specs --specs=nano.specs
|
|
||||||
|
|
||||||
# For flash-jlink target
|
|
||||||
JLINK_DEVICE = max32690
|
|
||||||
|
|
||||||
# flash target using Jlink by default
|
|
||||||
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/max32690.cfg \
|
|
||||||
-c "program $(BUILD)/$(PROJECT).elf verify; init; reset; exit"
|
|
||||||
|
|
||||||
# -----------------
|
|
||||||
# Sources & Include
|
|
||||||
# -----------------
|
|
||||||
PERIPH_SRC = $(TOP)/$(MAX32_PERIPH)/Source
|
|
||||||
SRC_C += \
|
|
||||||
src/portable/mentor/musb/dcd_musb.c \
|
|
||||||
$(MAX32_CMSIS)/Device/Maxim/MAX32690/Source/heap.c \
|
|
||||||
$(MAX32_CMSIS)/Device/Maxim/MAX32690/Source/system_max32690.c \
|
|
||||||
$(PERIPH_SRC)/SYS/mxc_assert.c \
|
|
||||||
$(PERIPH_SRC)/SYS/mxc_delay.c \
|
|
||||||
$(PERIPH_SRC)/SYS/mxc_lock.c \
|
|
||||||
$(PERIPH_SRC)/SYS/nvic_table.c \
|
|
||||||
$(PERIPH_SRC)/SYS/pins_me18.c \
|
|
||||||
$(PERIPH_SRC)/SYS/sys_me18.c \
|
|
||||||
$(PERIPH_SRC)/CTB/ctb_me18.c \
|
|
||||||
$(PERIPH_SRC)/CTB/ctb_reva.c \
|
|
||||||
$(PERIPH_SRC)/CTB/ctb_common.c \
|
|
||||||
$(PERIPH_SRC)/FLC/flc_common.c \
|
|
||||||
$(PERIPH_SRC)/FLC/flc_me18.c \
|
|
||||||
$(PERIPH_SRC)/FLC/flc_reva.c \
|
|
||||||
$(PERIPH_SRC)/GPIO/gpio_common.c \
|
|
||||||
$(PERIPH_SRC)/GPIO/gpio_me18.c \
|
|
||||||
$(PERIPH_SRC)/GPIO/gpio_reva.c \
|
|
||||||
$(PERIPH_SRC)/ICC/icc_me18.c \
|
|
||||||
$(PERIPH_SRC)/ICC/icc_reva.c \
|
|
||||||
$(PERIPH_SRC)/UART/uart_common.c \
|
|
||||||
$(PERIPH_SRC)/UART/uart_me18.c \
|
|
||||||
$(PERIPH_SRC)/UART/uart_revb.c \
|
|
||||||
|
|
||||||
INC += \
|
|
||||||
$(TOP)/$(BOARD_PATH) \
|
|
||||||
$(TOP)/$(MAX32_CMSIS)/Include \
|
|
||||||
$(TOP)/$(MAX32_CMSIS)/Device/Maxim/MAX32690/Include \
|
|
||||||
$(TOP)/$(MAX32_PERIPH)/Include/MAX32690 \
|
|
||||||
$(PERIPH_SRC)/SYS \
|
|
||||||
$(PERIPH_SRC)/GPIO \
|
|
||||||
$(PERIPH_SRC)/CTB \
|
|
||||||
$(PERIPH_SRC)/ICC \
|
|
||||||
$(PERIPH_SRC)/FLC \
|
|
||||||
$(PERIPH_SRC)/UART
|
|
@@ -1,149 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
|
|
@@ -1,28 +0,0 @@
|
|||||||
# 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.
|
|
@@ -1 +0,0 @@
|
|||||||
# Nothing to be done at the board level
|
|
@@ -1 +0,0 @@
|
|||||||
# No specific build requirements for the board.
|
|
@@ -1,173 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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"
|
|
||||||
#include "mcr_regs.h"
|
|
||||||
#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
|
|
||||||
MXC_UART_Init(ConsoleUart, CFG_BOARD_UART_BAUDRATE, MXC_UART_IBRO_CLK);
|
|
||||||
UART_PORT->vssel |= UART_VDDIO_BITS; //Set necessary bits to 3.3V
|
|
||||||
|
|
||||||
//USB
|
|
||||||
MXC_MCR->ldoctrl |= MXC_F_MCR_LDOCTRL_0P9EN;
|
|
||||||
MXC_SYS_ClockEnable(MXC_SYS_PERIPH_CLOCK_USB);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
|
||||||
// Board porting API
|
|
||||||
//--------------------------------------------------------------------+
|
|
||||||
|
|
||||||
void board_led_write(bool state) {
|
|
||||||
#if LED_STATE_ON
|
|
||||||
state = !state;
|
|
||||||
#endif
|
|
||||||
if (state) {
|
|
||||||
MXC_GPIO_OutClr(LED_PORT, LED_PIN);
|
|
||||||
} else {
|
|
||||||
MXC_GPIO_OutSet(LED_PORT, LED_PIN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t board_button_read(void) {
|
|
||||||
uint32_t state = MXC_GPIO_InGet(BUTTON_PORT, BUTTON_PIN) ? 1 : 0;
|
|
||||||
return BUTTON_STATE_ACTIVE == state;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t board_get_unique_id(uint8_t id[], size_t max_len) {
|
|
||||||
uint8_t hw_id[MXC_SYS_USN_CHECKSUM_LEN];//USN Buffer
|
|
||||||
/* All other 2nd parameter is optional checksum buffer */
|
|
||||||
MXC_SYS_GetUSN(hw_id, NULL);
|
|
||||||
|
|
||||||
size_t act_len = TU_MIN(max_len, MXC_SYS_USN_LEN);
|
|
||||||
memcpy(id, hw_id, act_len);
|
|
||||||
return act_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
int board_uart_read(uint8_t *buf, int len) {
|
|
||||||
int uart_val;
|
|
||||||
int act_len = 0;
|
|
||||||
|
|
||||||
while (act_len < len) {
|
|
||||||
if ((uart_val = MXC_UART_ReadCharacterRaw(ConsoleUart)) == E_UNDERFLOW) {
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
*buf++ = (uint8_t) uart_val;
|
|
||||||
act_len++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return act_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
int board_uart_write(void const *buf, int len) {
|
|
||||||
int act_len = 0;
|
|
||||||
const uint8_t *ch_ptr = (const uint8_t *) buf;
|
|
||||||
while (act_len < len) {
|
|
||||||
MXC_UART_WriteCharacter(ConsoleUart, *ch_ptr++);
|
|
||||||
act_len++;
|
|
||||||
}
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
|
||||||
volatile uint32_t system_ticks = 0;
|
|
||||||
|
|
||||||
void SysTick_Handler(void) {
|
|
||||||
system_ticks++;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t board_millis(void) {
|
|
||||||
return system_ticks;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void HardFault_Handler(void) {
|
|
||||||
__asm("BKPT #0\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Required by __libc_init_array in startup code if we are compiling using
|
|
||||||
// -nostdlib/-nostartfiles.
|
|
||||||
void _init(void) {
|
|
||||||
}
|
|
@@ -1,166 +0,0 @@
|
|||||||
include_guard()
|
|
||||||
|
|
||||||
set(MAX32_PERIPH ${TOP}/hw/mcu/analog/max32/Libraries/PeriphDrivers)
|
|
||||||
set(MAX32_CMSIS ${TOP}/hw/mcu/analog/max32/Libraries/CMSIS)
|
|
||||||
set(CMSIS_5 ${TOP}/lib/CMSIS_5)
|
|
||||||
|
|
||||||
# include board specific
|
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
|
||||||
|
|
||||||
# Get the linker file from current location (family)
|
|
||||||
set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/max78002.ld)
|
|
||||||
set(LD_FILE_Clang ${LD_FILE_GNU})
|
|
||||||
|
|
||||||
# toolchain set up
|
|
||||||
set(CMAKE_SYSTEM_CPU cortex-m4 CACHE INTERNAL "System Processor")
|
|
||||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
|
||||||
set(JLINK_DEVICE max78000)
|
|
||||||
|
|
||||||
set(FAMILY_MCUS MAX78002 CACHE INTERNAL "")
|
|
||||||
|
|
||||||
function(update_board TARGET)
|
|
||||||
target_compile_definitions(${TARGET} PUBLIC
|
|
||||||
TARGET=MAX78002
|
|
||||||
TARGET_REV=0x4131
|
|
||||||
MXC_ASSERT_ENABLE
|
|
||||||
MAX78002
|
|
||||||
IAR_PRAGMAS=0
|
|
||||||
CFG_TUSB_MCU=OPT_MCU_MAX78002
|
|
||||||
BOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
|
|
||||||
)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
#------------------------------------
|
|
||||||
# BOARD_TARGET
|
|
||||||
#------------------------------------
|
|
||||||
# only need to be built ONCE for all examples
|
|
||||||
function(add_board_target BOARD_TARGET)
|
|
||||||
if (TARGET ${BOARD_TARGET})
|
|
||||||
return()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Startup & Linker script
|
|
||||||
set(STARTUP_FILE_GNU ${MAX32_CMSIS}/Device/Maxim/MAX78002/Source/GCC/startup_max78002.S)
|
|
||||||
set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
|
|
||||||
|
|
||||||
set(PERIPH_SRC ${MAX32_PERIPH}/Source)
|
|
||||||
add_library(${BOARD_TARGET} STATIC
|
|
||||||
${MAX32_CMSIS}/Device/Maxim/MAX78002/Source/heap.c
|
|
||||||
${MAX32_CMSIS}/Device/Maxim/MAX78002/Source/system_max78002.c
|
|
||||||
${PERIPH_SRC}/SYS/mxc_assert.c
|
|
||||||
${PERIPH_SRC}/SYS/mxc_delay.c
|
|
||||||
${PERIPH_SRC}/SYS/mxc_lock.c
|
|
||||||
${PERIPH_SRC}/SYS/nvic_table.c
|
|
||||||
${PERIPH_SRC}/SYS/pins_ai87.c
|
|
||||||
${PERIPH_SRC}/SYS/sys_ai87.c
|
|
||||||
${PERIPH_SRC}/AES/aes_ai87.c
|
|
||||||
${PERIPH_SRC}/AES/aes_revb.c
|
|
||||||
${PERIPH_SRC}/FLC/flc_common.c
|
|
||||||
${PERIPH_SRC}/FLC/flc_ai87.c
|
|
||||||
${PERIPH_SRC}/FLC/flc_reva.c
|
|
||||||
${PERIPH_SRC}/GPIO/gpio_common.c
|
|
||||||
${PERIPH_SRC}/GPIO/gpio_ai87.c
|
|
||||||
${PERIPH_SRC}/GPIO/gpio_reva.c
|
|
||||||
${PERIPH_SRC}/ICC/icc_ai87.c
|
|
||||||
${PERIPH_SRC}/ICC/icc_reva.c
|
|
||||||
${PERIPH_SRC}/TRNG/trng_ai87.c
|
|
||||||
${PERIPH_SRC}/TRNG/trng_revb.c
|
|
||||||
${PERIPH_SRC}/UART/uart_common.c
|
|
||||||
${PERIPH_SRC}/UART/uart_ai87.c
|
|
||||||
${PERIPH_SRC}/UART/uart_revb.c
|
|
||||||
${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
|
|
||||||
)
|
|
||||||
target_include_directories(${BOARD_TARGET} PUBLIC
|
|
||||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
|
||||||
${MAX32_CMSIS}/Include
|
|
||||||
${MAX32_CMSIS}/Device/Maxim/MAX78002/Include
|
|
||||||
${MAX32_PERIPH}/Include/MAX78002
|
|
||||||
${PERIPH_SRC}/SYS
|
|
||||||
${PERIPH_SRC}/GPIO
|
|
||||||
${PERIPH_SRC}/AES
|
|
||||||
${PERIPH_SRC}/TRNG
|
|
||||||
${PERIPH_SRC}/ICC
|
|
||||||
${PERIPH_SRC}/FLC
|
|
||||||
${PERIPH_SRC}/UART
|
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_options(${BOARD_TARGET} PRIVATE
|
|
||||||
-Wno-error=strict-prototypes
|
|
||||||
-Wno-error=redundant-decls
|
|
||||||
)
|
|
||||||
update_board(${BOARD_TARGET})
|
|
||||||
|
|
||||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
|
||||||
target_link_options(${BOARD_TARGET} PUBLIC
|
|
||||||
"LINKER:--script=${LD_FILE_GNU}"
|
|
||||||
-nostartfiles
|
|
||||||
--specs=nosys.specs --specs=nano.specs
|
|
||||||
)
|
|
||||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
||||||
target_link_options(${BOARD_TARGET} PUBLIC
|
|
||||||
"LINKER:--script=${LD_FILE_Clang}"
|
|
||||||
)
|
|
||||||
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}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_options(${TARGET} PRIVATE
|
|
||||||
-Wno-error=strict-prototypes
|
|
||||||
-Wno-error=redundant-decls
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# Add TinyUSB target and port source
|
|
||||||
family_add_tinyusb(${TARGET} OPT_MCU_MAX78002)
|
|
||||||
target_sources(${TARGET} PUBLIC
|
|
||||||
${TOP}/src/portable/mentor/musb/dcd_musb.c
|
|
||||||
)
|
|
||||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
|
||||||
target_compile_options(${TARGET} PRIVATE
|
|
||||||
-Wno-error=strict-prototypes
|
|
||||||
-Wno-error=redundant-decls
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Flashing
|
|
||||||
family_add_bin_hex(${TARGET})
|
|
||||||
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()
|
|
@@ -1,99 +0,0 @@
|
|||||||
DEPS_SUBMODULES += lib/CMSIS_5 hw/mcu/analog/max32
|
|
||||||
|
|
||||||
# Important locations in the hw support for MCU
|
|
||||||
MAX32_CMSIS = hw/mcu/analog/max32/Libraries/CMSIS
|
|
||||||
MAX32_PERIPH = hw/mcu/analog/max32/Libraries/PeriphDrivers
|
|
||||||
|
|
||||||
# Add any board specific make rules
|
|
||||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
|
||||||
|
|
||||||
CPU_CORE ?= cortex-m4
|
|
||||||
PORT ?= 0
|
|
||||||
|
|
||||||
# GCC
|
|
||||||
SRC_S_GCC += $(MAX32_CMSIS)/Device/Maxim/MAX78002/Source/GCC/startup_max78002.S
|
|
||||||
LD_FILE = $(FAMILY_PATH)/max78002.ld
|
|
||||||
|
|
||||||
# --------------
|
|
||||||
# Compiler Flags
|
|
||||||
# --------------
|
|
||||||
# Flags for the MAX78002 SDK
|
|
||||||
CFLAGS += -DTARGET=MAX78002 \
|
|
||||||
-DTARGET_REV=0x4131 \
|
|
||||||
-DMXC_ASSERT_ENABLE \
|
|
||||||
-DMAX78002 \
|
|
||||||
-DIAR_PRAGMAS=0
|
|
||||||
|
|
||||||
# Flags for TUSB features
|
|
||||||
CFLAGS += \
|
|
||||||
-DCFG_TUSB_MCU=OPT_MCU_MAX78002 \
|
|
||||||
-DBOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
|
|
||||||
|
|
||||||
# mcu driver cause following warnings
|
|
||||||
CFLAGS += -Wno-error=redundant-decls \
|
|
||||||
-Wno-error=strict-prototypes \
|
|
||||||
-Wno-error=unused-parameter \
|
|
||||||
-Wno-error=enum-conversion \
|
|
||||||
-Wno-error=sign-compare \
|
|
||||||
-Wno-error=cast-qual
|
|
||||||
|
|
||||||
LDFLAGS_GCC += -nostartfiles --specs=nosys.specs --specs=nano.specs
|
|
||||||
|
|
||||||
# For flash-jlink target
|
|
||||||
JLINK_DEVICE = max78000
|
|
||||||
|
|
||||||
# flash target using Jlink by default
|
|
||||||
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/max78002.cfg \
|
|
||||||
-c "program $(BUILD)/$(PROJECT).elf verify; init; reset; exit"
|
|
||||||
|
|
||||||
# -----------------
|
|
||||||
# Sources & Include
|
|
||||||
# -----------------
|
|
||||||
PERIPH_SRC = $(TOP)/$(MAX32_PERIPH)/Source
|
|
||||||
SRC_C += \
|
|
||||||
src/portable/mentor/musb/dcd_musb.c \
|
|
||||||
$(MAX32_CMSIS)/Device/Maxim/MAX78002/Source/heap.c \
|
|
||||||
$(MAX32_CMSIS)/Device/Maxim/MAX78002/Source/system_max78002.c \
|
|
||||||
$(PERIPH_SRC)/SYS/mxc_assert.c \
|
|
||||||
$(PERIPH_SRC)/SYS/mxc_delay.c \
|
|
||||||
$(PERIPH_SRC)/SYS/mxc_lock.c \
|
|
||||||
$(PERIPH_SRC)/SYS/nvic_table.c \
|
|
||||||
$(PERIPH_SRC)/SYS/pins_ai87.c \
|
|
||||||
$(PERIPH_SRC)/SYS/sys_ai87.c \
|
|
||||||
$(PERIPH_SRC)/AES/aes_ai87.c \
|
|
||||||
$(PERIPH_SRC)/AES/aes_revb.c \
|
|
||||||
$(PERIPH_SRC)/FLC/flc_common.c \
|
|
||||||
$(PERIPH_SRC)/FLC/flc_ai87.c \
|
|
||||||
$(PERIPH_SRC)/FLC/flc_reva.c \
|
|
||||||
$(PERIPH_SRC)/GPIO/gpio_common.c \
|
|
||||||
$(PERIPH_SRC)/GPIO/gpio_ai87.c \
|
|
||||||
$(PERIPH_SRC)/GPIO/gpio_reva.c \
|
|
||||||
$(PERIPH_SRC)/ICC/icc_ai87.c \
|
|
||||||
$(PERIPH_SRC)/ICC/icc_reva.c \
|
|
||||||
$(PERIPH_SRC)/TRNG/trng_ai87.c \
|
|
||||||
$(PERIPH_SRC)/TRNG/trng_revb.c \
|
|
||||||
$(PERIPH_SRC)/UART/uart_common.c \
|
|
||||||
$(PERIPH_SRC)/UART/uart_ai87.c \
|
|
||||||
$(PERIPH_SRC)/UART/uart_revb.c \
|
|
||||||
|
|
||||||
INC += \
|
|
||||||
$(TOP)/$(BOARD_PATH) \
|
|
||||||
$(TOP)/$(MAX32_CMSIS)/Include \
|
|
||||||
$(TOP)/$(MAX32_CMSIS)/Device/Maxim/MAX78002/Include \
|
|
||||||
$(TOP)/$(MAX32_PERIPH)/Include/MAX78002 \
|
|
||||||
$(PERIPH_SRC)/SYS \
|
|
||||||
$(PERIPH_SRC)/GPIO \
|
|
||||||
$(PERIPH_SRC)/AES \
|
|
||||||
$(PERIPH_SRC)/ICC \
|
|
||||||
$(PERIPH_SRC)/FLC \
|
|
||||||
$(PERIPH_SRC)/TRNG \
|
|
||||||
$(PERIPH_SRC)/UART
|
|
43
hw/bsp/maxim/README.md
Normal file
43
hw/bsp/maxim/README.md
Normal file
@@ -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 `<target>-openocd` CMake
|
||||||
|
target.
|
4
hw/bsp/maxim/boards/apard32690/board.cmake
Normal file
4
hw/bsp/maxim/boards/apard32690/board.cmake
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
set(MAX_DEVICE max32690)
|
||||||
|
|
||||||
|
function(update_board TARGET)
|
||||||
|
endfunction()
|
8
hw/bsp/maxim/boards/max32650evkit/board.cmake
Normal file
8
hw/bsp/maxim/boards/max32650evkit/board.cmake
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
set(MAX_DEVICE max32650)
|
||||||
|
|
||||||
|
function(update_board TARGET)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(prepare_image TARGET_IN)
|
||||||
|
#No signing required
|
||||||
|
endfunction()
|
8
hw/bsp/maxim/boards/max32650fthr/board.cmake
Normal file
8
hw/bsp/maxim/boards/max32650fthr/board.cmake
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
set(MAX_DEVICE max32650)
|
||||||
|
|
||||||
|
function(update_board TARGET)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(prepare_image TARGET_IN)
|
||||||
|
#No signing required
|
||||||
|
endfunction()
|
@@ -1,22 +1,23 @@
|
|||||||
# Use the secure linker file
|
set(MAX_DEVICE max32650)
|
||||||
set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/max32651.ld)
|
|
||||||
|
|
||||||
function(update_board_extras TARGET)
|
# 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
|
# for the signed target, need to add the __SLA_FWK__ define
|
||||||
target_compile_definitions(${TARGET} PUBLIC
|
target_compile_definitions(${TARGET} PUBLIC
|
||||||
__SLA_FWK__
|
__SLA_FWK__
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(prepare_image TARGET_IN)
|
function(sign_image TARGET_IN)
|
||||||
#For the signed target, set up a POST_BUILD command to sign the elf file once
|
#For the signed target, set up a POST_BUILD command to sign the elf file once created
|
||||||
#created
|
|
||||||
if((WIN32) OR (MINGW) OR (MSYS))
|
if((WIN32) OR (MINGW) OR (MSYS))
|
||||||
set(SIGN_EXE "sign_app.exe")
|
set(SIGN_EXE "sign_app.exe")
|
||||||
else()
|
else()
|
||||||
set(SIGN_EXE "sign_app")
|
set(SIGN_EXE "sign_app")
|
||||||
endif()
|
endif()
|
||||||
set(MCU_PATH "${TOP}/hw/mcu/analog/max32/")
|
set(MCU_PATH "${TOP}/hw/mcu/analog/msdk/")
|
||||||
|
|
||||||
# Custom POST_BUILD command
|
# Custom POST_BUILD command
|
||||||
add_custom_command(
|
add_custom_command(
|
4
hw/bsp/maxim/boards/max32666evkit/board.cmake
Normal file
4
hw/bsp/maxim/boards/max32666evkit/board.cmake
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
set(MAX_DEVICE max32665)
|
||||||
|
|
||||||
|
function(update_board TARGET)
|
||||||
|
endfunction()
|
4
hw/bsp/maxim/boards/max32666fthr/board.cmake
Normal file
4
hw/bsp/maxim/boards/max32666fthr/board.cmake
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
set(MAX_DEVICE max32665)
|
||||||
|
|
||||||
|
function(update_board TARGET)
|
||||||
|
endfunction()
|
4
hw/bsp/maxim/boards/max32690evkit/board.cmake
Normal file
4
hw/bsp/maxim/boards/max32690evkit/board.cmake
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
set(MAX_DEVICE max32690)
|
||||||
|
|
||||||
|
function(update_board TARGET)
|
||||||
|
endfunction()
|
4
hw/bsp/maxim/boards/max78002evkit/board.cmake
Normal file
4
hw/bsp/maxim/boards/max78002evkit/board.cmake
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
set(MAX_DEVICE max78002)
|
||||||
|
|
||||||
|
function(update_board TARGET)
|
||||||
|
endfunction()
|
@@ -35,7 +35,9 @@
|
|||||||
|
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
#include "mxc_sys.h"
|
#include "mxc_sys.h"
|
||||||
|
#if __has_include("mcr_regs.h")
|
||||||
#include "mcr_regs.h"
|
#include "mcr_regs.h"
|
||||||
|
#endif
|
||||||
#include "mxc_device.h"
|
#include "mxc_device.h"
|
||||||
#include "uart.h"
|
#include "uart.h"
|
||||||
|
|
||||||
@@ -88,16 +90,45 @@ void board_init(void) {
|
|||||||
MXC_GPIO_Config(&gpioConfig);
|
MXC_GPIO_Config(&gpioConfig);
|
||||||
|
|
||||||
// UART
|
// UART
|
||||||
|
#if MAX_PERIPH_ID == 14
|
||||||
MXC_UART_Init(ConsoleUart, CFG_BOARD_UART_BAUDRATE, UART_MAP);
|
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
|
//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
|
// Startup the HIRC96M clock if it's not on already
|
||||||
if (!(MXC_GCR->clkcn & MXC_F_GCR_CLKCN_HIRC96M_EN)) {
|
if (!(MXC_GCR->clkcn & MXC_F_GCR_CLKCN_HIRC96M_EN)) {
|
||||||
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_ClockEnable(MXC_SYS_PERIPH_CLOCK_USB);
|
||||||
MXC_SYS_Reset_Periph(MXC_SYS_RESET_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
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
@@ -121,13 +152,18 @@ uint32_t board_button_read(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t board_get_unique_id(uint8_t id[], size_t max_len) {
|
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
|
uint8_t hw_id[MXC_SYS_USN_CHECKSUM_LEN]; //USN Buffer
|
||||||
/* All other 2nd parameter is optional checksum buffer */
|
MXC_SYS_GetUSN(hw_id, NULL); // 2nd parameter is optional checksum buffer
|
||||||
MXC_SYS_GetUSN(hw_id, NULL);
|
|
||||||
|
|
||||||
size_t act_len = TU_MIN(max_len, MXC_SYS_USN_LEN);
|
size_t act_len = TU_MIN(max_len, MXC_SYS_USN_LEN);
|
||||||
memcpy(id, hw_id, act_len);
|
memcpy(id, hw_id, act_len);
|
||||||
return act_len;
|
return act_len;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int board_uart_read(uint8_t *buf, int len) {
|
int board_uart_read(uint8_t *buf, int len) {
|
205
hw/bsp/maxim/family.cmake
Normal file
205
hw/bsp/maxim/family.cmake
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
|
cmake_print_variables(MAX_DEVICE)
|
||||||
|
string(TOUPPER ${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
|
||||||
|
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
|
||||||
|
)
|
||||||
|
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()
|
@@ -25,9 +25,9 @@ deps_optional = {
|
|||||||
'hw/mcu/allwinner': ['https://github.com/hathach/allwinner_driver.git',
|
'hw/mcu/allwinner': ['https://github.com/hathach/allwinner_driver.git',
|
||||||
'8e5e89e8e132c0fd90e72d5422e5d3d68232b756',
|
'8e5e89e8e132c0fd90e72d5422e5d3d68232b756',
|
||||||
'fc100s'],
|
'fc100s'],
|
||||||
'hw/mcu/analog/max32' : ['https://github.com/analogdevicesinc/msdk.git',
|
'hw/mcu/analog/msdk' : ['https://github.com/analogdevicesinc/msdk.git',
|
||||||
'b20b398d3e5e2007594e54a74ba3d2a2e50ddd75',
|
'b20b398d3e5e2007594e54a74ba3d2a2e50ddd75',
|
||||||
'max32650 max32666 max32690 max78002'],
|
'maxim'],
|
||||||
'hw/mcu/bridgetek/ft9xx/ft90x-sdk': ['https://github.com/BRTSG-FOSS/ft90x-sdk.git',
|
'hw/mcu/bridgetek/ft9xx/ft90x-sdk': ['https://github.com/BRTSG-FOSS/ft90x-sdk.git',
|
||||||
'91060164afe239fcb394122e8bf9eb24d3194eb1',
|
'91060164afe239fcb394122e8bf9eb24d3194eb1',
|
||||||
'brtmm90x'],
|
'brtmm90x'],
|
||||||
|
Reference in New Issue
Block a user