Skip to content

Commit 787229a

Browse files
committed
add etm trace for 6m5
1 parent ec02ddf commit 787229a

File tree

3 files changed

+54
-5
lines changed

3 files changed

+54
-5
lines changed

hw/bsp/ra/boards/ra6m5_ek/board.h

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,20 @@ extern "C" {
3838
#define BUTTON_STATE_ACTIVE 0
3939

4040
const ioport_pin_cfg_t board_pin_cfg[] = {
41-
{.pin = BSP_IO_PORT_04_PIN_07, .pin_cfg = ((uint32_t) IOPORT_CFG_PERIPHERAL_PIN | (uint32_t) IOPORT_PERIPHERAL_USB_FS)},
42-
{.pin = BSP_IO_PORT_05_PIN_00, .pin_cfg = ((uint32_t) IOPORT_CFG_PERIPHERAL_PIN | (uint32_t) IOPORT_PERIPHERAL_USB_FS)},
43-
{.pin = BSP_IO_PORT_05_PIN_01, .pin_cfg = ((uint32_t) IOPORT_CFG_PERIPHERAL_PIN | (uint32_t) IOPORT_PERIPHERAL_USB_FS)},
44-
{.pin = LED1, .pin_cfg = ((uint32_t) IOPORT_CFG_PORT_DIRECTION_OUTPUT | (uint32_t) IOPORT_CFG_PORT_OUTPUT_LOW)},
45-
{.pin = SW1, .pin_cfg = ((uint32_t) IOPORT_CFG_PORT_DIRECTION_INPUT)},
41+
{ .pin = BSP_IO_PORT_04_PIN_07, .pin_cfg = IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_USB_FS },
42+
{ .pin = BSP_IO_PORT_05_PIN_00, .pin_cfg = IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_USB_FS },
43+
{ .pin = BSP_IO_PORT_05_PIN_01, .pin_cfg = IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_USB_FS },
44+
{ .pin = LED1, .pin_cfg = IOPORT_CFG_PORT_DIRECTION_OUTPUT | IOPORT_CFG_PORT_OUTPUT_LOW },
45+
{ .pin = SW1, .pin_cfg = IOPORT_CFG_PORT_DIRECTION_INPUT },
46+
47+
#ifdef TRACE_ETM
48+
// ETM Trace
49+
{ .pin = BSP_IO_PORT_02_PIN_08, .pin_cfg = IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_TRACE },
50+
{ .pin = BSP_IO_PORT_02_PIN_09, .pin_cfg = IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_TRACE },
51+
{ .pin = BSP_IO_PORT_02_PIN_10, .pin_cfg = IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_TRACE },
52+
{ .pin = BSP_IO_PORT_02_PIN_11, .pin_cfg = IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_TRACE },
53+
{ .pin = BSP_IO_PORT_02_PIN_14, .pin_cfg = IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_TRACE },
54+
#endif
4655
};
4756

4857
#ifdef __cplusplus
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
/*********************************************************************
3+
*
4+
* OnProjectLoad
5+
*
6+
* Function description
7+
* Project load routine. Required.
8+
*
9+
**********************************************************************
10+
*/
11+
void OnProjectLoad (void) {
12+
Project.AddSvdFile ("Cortex-M33.svd");
13+
Project.AddSvdFile ("./R7FA6M5BH.svd");
14+
15+
Project.SetDevice ("R7FA6M5BH");
16+
Project.SetHostIF ("USB", "");
17+
Project.SetTargetIF ("SWD");
18+
Project.SetTIFSpeed ("50 MHz");
19+
20+
Project.SetTraceSource ("Trace Pins");
21+
Project.SetTracePortWidth (4);
22+
23+
File.Open ("../../../../../../examples/device/cdc_msc/cmake-build-ra6m5/cdc_msc.elf");
24+
}
25+
/*********************************************************************
26+
*
27+
* BeforeTargetConnect
28+
*
29+
**********************************************************************
30+
*/
31+
void BeforeTargetConnect (void) {
32+
//
33+
// Trace pin init is done by J-Link script file as J-Link script files are IDE independent
34+
//
35+
}

hw/bsp/ra/family.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ void board_init(void)
8787
/* Configure pins. */
8888
R_IOPORT_Open(&port_ctrl, &family_pin_cfg);
8989

90+
#ifdef TRACE_ETM
91+
// Enable trace clock with div 1 (100 Mhz)
92+
R_SYSTEM->TRCKCR = R_SYSTEM_TRCKCR_TRCKEN_Msk;
93+
#endif
94+
9095
board_led_write(false);
9196

9297
/* Enable USB_BASE */

0 commit comments

Comments
 (0)