Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ITM tracing for Ambiq Apollo3 targets #15280

Merged
merged 3 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions targets/TARGET_Ambiq_Micro/TARGET_Apollo3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ target_sources(mbed-apollo3
device/sleep.c
device/spi_api.c
device/us_ticker.c
device/itm_api.c

sdk/CMSIS/AmbiqMicro/Source/system_apollo3.c

Expand Down
48 changes: 48 additions & 0 deletions targets/TARGET_Ambiq_Micro/TARGET_Apollo3/device/itm_api.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* mbed Microcontroller Library
* Copyright (c) 2017 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* 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.
*/

#if DEVICE_ITM

#include "hal/itm_api.h"
#include "cmsis.h"
#include "am_bsp.h"

#include <stdbool.h>

/* SWO frequency: 1000 kHz */

#ifndef AM_BSP_GPIO_ITM_SWO
#define AM_GPIO_ITM_SWO 22

const am_hal_gpio_pincfg_t g_AM_GPIO_ITM_SWO =
{
.uFuncSel = AM_HAL_PIN_22_SWO,
.eDriveStrength = AM_HAL_GPIO_PIN_DRIVESTRENGTH_2MA
};
#endif


void itm_init(void)
{
#ifdef AM_BSP_GPIO_ITM_SWO
am_bsp_itm_printf_enable();
16L-YT marked this conversation as resolved.
Show resolved Hide resolved
#else
am_bsp_itm_printf_enable(AM_GPIO_ITM_SWO,g_AM_GPIO_ITM_SWO);
#endif
}

#endif
3 changes: 2 additions & 1 deletion targets/targets.json
Original file line number Diff line number Diff line change
Expand Up @@ -9061,7 +9061,8 @@
"FLASH",
"SPI",
"I2C",
"SLEEP"
"SLEEP",
"ITM"
],
"components": [
"FLASHIAP"
Expand Down