-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(CMSIS): MAX32657 bring up (#1285)
Co-authored-by: EricB-ADI <[email protected]>
- Loading branch information
1 parent
1b95c3c
commit 6e61aa3
Showing
14 changed files
with
376 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/****************************************************************************** | ||
* | ||
* Copyright (C) 2024 Analog Devices, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
******************************************************************************/ | ||
|
||
/** | ||
* @file board.h | ||
* @brief Board support package API. | ||
*/ | ||
|
||
#include <stdio.h> | ||
|
||
#ifndef LIBRARIES_BOARDS_MAX32657_WLP_BENCH_INCLUDE_BOARD_H_ | ||
#define LIBRARIES_BOARDS_MAX32657_WLP_BENCH_INCLUDE_BOARD_H_ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#ifndef CONSOLE_UART | ||
#define CONSOLE_UART 0 /// UART instance to use for console | ||
#endif | ||
|
||
#ifndef CONSOLE_BAUD | ||
#define CONSOLE_BAUD 115200 /// Console baud rate | ||
#endif | ||
|
||
#ifdef LED_OFF | ||
#undef LED_OFF | ||
#endif | ||
#define LED_OFF 1 /// Override inactive state of LEDs | ||
|
||
#ifdef LED_ON | ||
#undef LED_ON | ||
#endif | ||
#define LED_ON 0 /// Override active state of LEDs | ||
|
||
#define LED1 0 | ||
#define LED_RED LED1 | ||
|
||
#define LED2 1 | ||
#define LED_GREEN LED2 | ||
|
||
/** | ||
* \brief Initialize the BSP and board interfaces. | ||
* \returns #E_NO_ERROR if everything is successful | ||
*/ | ||
int Board_Init(void); | ||
|
||
/** | ||
* \brief Initialize or reinitialize the console. This may be necessary if the | ||
* system clock rate is changed. | ||
* \returns #E_NO_ERROR if everything is successful | ||
*/ | ||
int Console_Init(void); | ||
|
||
/** | ||
* \brief Shutdown the console. | ||
* \returns #E_NO_ERROR if everything is successful | ||
*/ | ||
int Console_Shutdown(void); | ||
|
||
/** | ||
* \brief Attempt to prepare the console for sleep. | ||
* \returns #E_NO_ERROR if ready to sleep, #E_BUSY if not ready for sleep. | ||
*/ | ||
int Console_PrepForSleep(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // LIBRARIES_BOARDS_MAX32657_WLP_BENCH_INCLUDE_BOARD_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
/****************************************************************************** | ||
* | ||
* Copyright (C) 2024 Analog Devices, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
******************************************************************************/ | ||
|
||
#include <stdio.h> | ||
#include "mxc_device.h" | ||
#include "mxc_sys.h" | ||
#include "mxc_assert.h" | ||
#include "board.h" | ||
#include "uart.h" | ||
#include "gpio.h" | ||
#include "mxc_pins.h" | ||
#include "led.h" | ||
#include "pb.h" | ||
|
||
/***** Global Variables *****/ | ||
mxc_uart_regs_t *ConsoleUart = MXC_UART_GET_UART(CONSOLE_UART); | ||
extern uint32_t SystemCoreClock; | ||
|
||
// clang-format off | ||
const mxc_gpio_cfg_t pb_pin[] = { | ||
// TODO(ME30): Add push-buttons | ||
{ MXC_GPIO0, MXC_GPIO_PIN_0, MXC_GPIO_FUNC_IN, MXC_GPIO_PAD_PULL_UP, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 } | ||
}; | ||
const unsigned int num_pbs = (sizeof(pb_pin) / sizeof(mxc_gpio_cfg_t)); | ||
|
||
const mxc_gpio_cfg_t led_pin[] = { | ||
// System LED | ||
{ MXC_GPIO0, MXC_GPIO_PIN_1, MXC_GPIO_FUNC_OUT, MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 }, | ||
{ MXC_GPIO0, MXC_GPIO_PIN_8, MXC_GPIO_FUNC_OUT, MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 }, | ||
|
||
//BLE Debug | ||
{ MXC_GPIO0, MXC_GPIO_PIN_10, MXC_GPIO_FUNC_OUT, MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 }, // TX | ||
{ MXC_GPIO0, MXC_GPIO_PIN_11, MXC_GPIO_FUNC_OUT, MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 }, // RX | ||
{ MXC_GPIO0, MXC_GPIO_PIN_12, MXC_GPIO_FUNC_OUT, MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 }, // RX OK | ||
{ MXC_GPIO0, MXC_GPIO_PIN_13, MXC_GPIO_FUNC_OUT, MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 }, // RX Timeout | ||
{ MXC_GPIO0, MXC_GPIO_PIN_2, MXC_GPIO_FUNC_OUT, MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 }, // RX CRC FAIL | ||
{ MXC_GPIO0, MXC_GPIO_PIN_7, MXC_GPIO_FUNC_OUT, MXC_GPIO_PAD_NONE, MXC_GPIO_VSSEL_VDDIO, MXC_GPIO_DRVSTR_0 } // BB ISR | ||
}; | ||
const unsigned int num_leds = (sizeof(led_pin) / sizeof(mxc_gpio_cfg_t)); | ||
// clang-format on | ||
|
||
/***** File Scope Variables *****/ | ||
|
||
/******************************************************************************/ | ||
void mxc_assert(const char *expr, const char *file, int line) | ||
{ | ||
printf("MXC_ASSERT %s #%d: (%s)\n", file, line, expr); | ||
|
||
while (1) {} | ||
} | ||
|
||
/******************************************************************************/ | ||
/** | ||
* NOTE: This weak definition is included to support Push Button interrupts in | ||
* case the user does not define this interrupt handler in their application. | ||
**/ | ||
__weak void GPIO0_IRQHandler(void) | ||
{ | ||
MXC_GPIO_Handler(MXC_GPIO_GET_IDX(MXC_GPIO0)); | ||
} | ||
|
||
/******************************************************************************/ | ||
int Board_Init(void) | ||
{ | ||
int err; | ||
|
||
if ((err = Console_Init()) < E_NO_ERROR) { | ||
return err; | ||
} | ||
|
||
if ((err = PB_Init()) != E_NO_ERROR) { | ||
MXC_ASSERT_FAIL(); | ||
return err; | ||
} | ||
|
||
if ((err = LED_Init()) != E_NO_ERROR) { | ||
MXC_ASSERT_FAIL(); | ||
return err; | ||
} | ||
|
||
return E_NO_ERROR; | ||
} | ||
|
||
/******************************************************************************/ | ||
int Console_Init(void) | ||
{ | ||
int err; | ||
|
||
if ((err = MXC_UART_Init(ConsoleUart, CONSOLE_BAUD, MXC_UART_APB_CLK)) != E_NO_ERROR) { | ||
return err; | ||
} | ||
|
||
return E_NO_ERROR; | ||
} | ||
|
||
int Console_Shutdown(void) | ||
{ | ||
int err; | ||
|
||
if ((err = MXC_UART_Shutdown(ConsoleUart)) != E_NO_ERROR) { | ||
return err; | ||
} | ||
|
||
return E_NO_ERROR; | ||
} | ||
|
||
/******************************************************************************/ | ||
void NMI_Handler(void) | ||
{ | ||
__NOP(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CMSIS-DAP, interface/cmsis-dap.cfg | ||
MAX32625_PICO, interface/cmsis-dap.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
############################################################################### | ||
# | ||
# Copyright (C) 2024 Analog Devices, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
############################################################################## | ||
|
||
ifeq "$(BOARD_DIR)" "" | ||
BOARD_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) | ||
endif | ||
|
||
# Source files for this test (add path to VPATH below) | ||
SRCS += board.c | ||
SRCS += stdio.c | ||
SRCS += led.c | ||
SRCS += pb.c | ||
|
||
MISC_DRIVERS_DIR ?= $(MAXIM_PATH)/Libraries/MiscDrivers | ||
|
||
# Where to find BSP source files | ||
VPATH += $(BOARD_DIR)/Source | ||
VPATH += $(MISC_DRIVERS_DIR) | ||
VPATH += $(MISC_DRIVERS_DIR)/LED | ||
VPATH += $(MISC_DRIVERS_DIR)/PushButton | ||
|
||
# Where to find BSP header files | ||
IPATH += $(BOARD_DIR)/Include | ||
IPATH += $(MISC_DRIVERS_DIR) | ||
IPATH += $(MISC_DRIVERS_DIR)/LED | ||
IPATH += $(MISC_DRIVERS_DIR)/PushButton |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO: Add list of supported examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
max32657.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.