Skip to content

Commit e2e927e

Browse files
authored
Merge pull request #15280 from 16L-YT/master
Support ITM tracing for Ambiq Apollo3 targets
2 parents 6fd736b + 7a10808 commit e2e927e

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

targets/TARGET_Ambiq_Micro/TARGET_Apollo3/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ target_sources(mbed-apollo3
5151
device/sleep.c
5252
device/spi_api.c
5353
device/us_ticker.c
54+
device/itm_api.c
5455

5556
sdk/CMSIS/AmbiqMicro/Source/system_apollo3.c
5657

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2017 ARM Limited
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#if DEVICE_ITM
19+
20+
#include "hal/itm_api.h"
21+
#include "cmsis.h"
22+
#include "am_bsp.h"
23+
24+
#include <stdbool.h>
25+
26+
/* SWO frequency: 1000 kHz */
27+
28+
#ifndef AM_BSP_GPIO_ITM_SWO
29+
#define AM_GPIO_ITM_SWO 22
30+
31+
const am_hal_gpio_pincfg_t g_AM_GPIO_ITM_SWO =
32+
{
33+
.uFuncSel = AM_HAL_PIN_22_SWO,
34+
.eDriveStrength = AM_HAL_GPIO_PIN_DRIVESTRENGTH_2MA
35+
};
36+
#endif
37+
38+
39+
void itm_init(void)
40+
{
41+
#ifdef AM_BSP_GPIO_ITM_SWO
42+
am_bsp_itm_printf_enable();
43+
#else
44+
am_bsp_itm_printf_enable(AM_GPIO_ITM_SWO,g_AM_GPIO_ITM_SWO);
45+
#endif
46+
}
47+
48+
#endif

targets/targets.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9061,7 +9061,8 @@
90619061
"FLASH",
90629062
"SPI",
90639063
"I2C",
9064-
"SLEEP"
9064+
"SLEEP",
9065+
"ITM"
90659066
],
90669067
"components": [
90679068
"FLASHIAP"

0 commit comments

Comments
 (0)