This repository was archived by the owner on May 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gdbinit-trace
113 lines (90 loc) · 3.05 KB
/
.gdbinit-trace
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
!killall openocd
!orbtrace -p vtpwr,3.3 -e vtpwr,on
!orbtrace --trace-format 1
!openocd -f arduino-portenta-h7.ocd &
####################################################################
file /tmp/arduino/sketches/817DC06D31EFAD33501697C59B5B9880/Blink.ino.elf
target extended-remote localhost:3333
set mem inaccessible-by-default off
set print pretty
break main
####################################################################
source /home/alex/projects/arduino/orbuculum/Support/gdbtrace.init
####################################################################
# STM32H747 / M7 CORE
# TRACEDATACLK = PE2
# TRACEDATA0 = PE3
define enableTraceSTM32H747_M7
set $DBGMCU_BASE = 0x5C001000
set $DBGMCU_CR = $DBGMCU_BASE + 0x04
set $SYSCFG_BASE_ADDR = 0x58000400
set $SYSCFG_CCCSR = $SYSCFG_BASE_ADDR + 0x20
set $RCC_BASE_ADDR = 0x58024400
set $RCC_AHB4ENR = $RCC_BASE_ADDR + 0xE0
set $RCC_APB4ENR = $RCC_BASE_ADDR + 0xF4
set $GPIOE_BASE_ADDR = 0x58021000
set $GPIOE_MODER = $GPIOE_BASE_ADDR + 0x00
set $GPIOE_OSPEEDR = $GPIOE_BASE_ADDR + 0x08
set $GPIOE_PUDR = $GPIOE_BASE_ADDR + 0x0C
set $GPIOE_AFRL = $GPIOE_BASE_ADDR + 0x20
set $SWTF_BASE = 0x5C004000
set $SWTF_CTRL = $SWTF_BASE + 0x000
set $SWTF_LAR = $SWTF_BASE + 0xFB0
set $SWTF_LSR = $SWTF_BASE + 0xFB4
# enable SYSCFG peripheral clock (Bit #1: SYSCFGEN)
set *$RCC_APB4ENR |= 0x00000002
# enable I/O compensation cell (Bit #0: EN)
set *$SYSCFG_CCCSR |= 0x00000001
# Unlock for modifications
set *$SWTF_LAR = 0xC5ACCE55
x/1dw $SWTF_LSR
# Enable SWO (Bit #1: ENS0 = Slave port S0 enable)
set *$SWTF_CTRL |= 0x00000001
# enable peripheral clock for Port E (Bit #4: GPIOEEN)
set *$RCC_AHB4ENR |= 0x000000010
# enable alternate function mode
set *$GPIOE_MODER &= ~0x000000F0
set *$GPIOE_MODER |= 0x000000A0
# set speed to high speed
set *$GPIOE_OSPEEDR |= 0x000000A0
# no pull-up, no pull-down
set *$GPIOE_PUDR &= ~0x000000F0
# set to alternate function #0 (TRACECLK, TRACED0)
set *$GPIOE_AFRL &= ~0x0000FF00
# DBGMCU_CR: enable clock domains for debugging
# D3DBGCKEN | D1DBGCKEN | TRACECLKEN
set *$DBGMCU_CR |= (1<<22) | (1<<21) | (1<<20)
set $CDBBASE = 0xE000EDF0
set $DWTBASE = 0xE0001000
set $ITMBASE = 0xE0000000
set $TPIUBASE = 0xE0040000
set $ETMBASE = 0xE0041000
# Enable Trace TRCENA (DCB DEMCR)
set *($CDBBASE+0xC)=(1<<24)
# Start the trace output
set *($ITMBASE + 0xfb0) = 0xc5acce55
set *($ETMBASE + 0xfb0) = 0xc5acce55
set *($TPIUBASE + 0xfb0) = 0xc5acce55
set $TPIU_CSPSR = $TPIUBASE + 0x04
set $TPIU_SPPR = $TPIUBASE + 0xF0
# configure width of the current parallel trace port to 1.
set *$TPIU_CSPSR = (1<<0)
# configure TPIU for parallel trace port mode.
set *$TPIU_SPPR &= ~0x00000003
dwtSamplePC 1
dwtSyncTap 3
dwtPostTap 1
dwtPostInit 1
dwtPostReset 10
dwtCycEna 1
ITMId 1
ITMGTSFreq 3
ITMTSPrescale 3
ITMTXEna 1
ITMSYNCEna 1
ITMEna 1
ITMTER 0 0xFFFFFFFF
ITMTPR 0xFFFFFFFF
end
####################################################################
run