Skip to content

Commit d0c5148

Browse files
authored
Merge pull request arduino#237 from facchinm/debugger_support
Debugger support
2 parents 84a0536 + 43cbb8f commit d0c5148

9 files changed

+187085
-17
lines changed

boards.txt

+16
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ portenta_c33.upload.native_usb=true
4646
portenta_c33.upload.maximum_size=2097152
4747
portenta_c33.upload.maximum_data_size=523624
4848

49+
portenta_c33.debug.server.openocd.scripts.0=interface/{programmer.protocol}.cfg
50+
portenta_c33.debug.server.openocd.scripts.1={programmer.transport_script}
51+
portenta_c33.debug.server.openocd.scripts.2={runtime.platform.path}/debugger/R7FA6M5BH.cfg
52+
portenta_c33.debug.svd_file={runtime.platform.path}/svd/R7FA6M5BH.svd
53+
54+
4955
##############################################################
5056

5157
minima.name=Arduino UNO R4 Minima
@@ -94,6 +100,11 @@ minima.upload.native_usb=true
94100
minima.upload.maximum_size=262144
95101
minima.upload.maximum_data_size=32768
96102

103+
minima.debug.server.openocd.scripts.0=interface/{programmer.protocol}.cfg
104+
minima.debug.server.openocd.scripts.1={programmer.transport_script}
105+
minima.debug.server.openocd.scripts.2={runtime.platform.path}/debugger/R7FA4M1AB.cfg
106+
minima.debug.svd_file={runtime.platform.path}/svd/R7FA4M1AB.svd
107+
97108
##############################################################
98109

99110
unor4wifi.name=Arduino UNO R4 WiFi
@@ -140,6 +151,11 @@ unor4wifi.upload.native_usb=true
140151
unor4wifi.upload.maximum_size=262144
141152
unor4wifi.upload.maximum_data_size=32768
142153

154+
unor4wifi.debug.server.openocd.scripts.0=interface/{programmer.protocol}.cfg
155+
unor4wifi.debug.server.openocd.scripts.1={programmer.transport_script}
156+
unor4wifi.debug.server.openocd.scripts.2={runtime.platform.path}/debugger/R7FA4M1AB.cfg
157+
unor4wifi.debug.svd_file={runtime.platform.path}/svd/R7FA4M1AB.svd
158+
143159
##############################################################
144160

145161
muxto.name=Science Kit R3 Audio Module

debugger/R7FA4M1AB.cfg

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#
2+
# Renesas RA4M1 w/ ARM Cortex-M4 @ 48 MHz
3+
#
4+
5+
if { [info exists CHIPNAME] } {
6+
set _CHIPNAME $CHIPNAME
7+
} else {
8+
set _CHIPNAME ra4m1
9+
}
10+
11+
if { [info exists CPU_JTAG_TAPID] } {
12+
set _CPU_JTAG_TAPID $CPU_JTAG_TAPID
13+
} else {
14+
set _CPU_JTAG_TAPID 0x5ba00477
15+
}
16+
17+
if { [info exists CPU_SWD_TAPID] } {
18+
set _CPU_SWD_TAPID $CPU_SWD_TAPID
19+
} else {
20+
set _CPU_SWD_TAPID 0x5ba02477
21+
}
22+
23+
source [find target/swj-dp.tcl]
24+
25+
if { [using_jtag] } {
26+
set _CPU_TAPID $_CPU_JTAG_TAPID
27+
} else {
28+
set _CPU_TAPID $_CPU_SWD_TAPID
29+
}
30+
31+
swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPU_TAPID
32+
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
33+
34+
set _TARGETNAME $_CHIPNAME.cpu
35+
target create $_TARGETNAME cortex_m -dap $_CHIPNAME.dap
36+
37+
if { [info exists WORKAREASIZE] } {
38+
set _WORKAREASIZE $WORKAREASIZE
39+
} else {
40+
# 32 KB On-Chip SRAM
41+
set _WORKAREASIZE 0x8000
42+
}
43+
44+
$_TARGETNAME configure -work-area-phys 0x20000000 \
45+
-work-area-size $_WORKAREASIZE -work-area-backup 0
46+
47+
if { ![using_hla] } {
48+
cortex_m reset_config sysresetreq
49+
}
50+
51+
adapter speed 1000

debugger/R7FA6M5BH.cfg

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#
2+
# Renesas RA6M5 w/ ARM Cortex-M33 @ 200 MHz
3+
#
4+
5+
if { [info exists CHIPNAME] } {
6+
set _CHIPNAME $CHIPNAME
7+
} else {
8+
set _CHIPNAME ra6m5
9+
}
10+
11+
if { [info exists CPU_JTAG_TAPID] } {
12+
set _CPU_JTAG_TAPID $CPU_JTAG_TAPID
13+
} else {
14+
set _CPU_JTAG_TAPID 0x5ba00477
15+
}
16+
17+
if { [info exists CPU_SWD_TAPID] } {
18+
set _CPU_SWD_TAPID $CPU_SWD_TAPID
19+
} else {
20+
set _CPU_SWD_TAPID 0x5ba02477
21+
}
22+
23+
source [find target/swj-dp.tcl]
24+
25+
if { [using_jtag] } {
26+
set _CPU_TAPID $_CPU_JTAG_TAPID
27+
} else {
28+
set _CPU_TAPID $_CPU_SWD_TAPID
29+
}
30+
31+
swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPU_TAPID
32+
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
33+
34+
set _TARGETNAME $_CHIPNAME.cpu
35+
target create $_TARGETNAME cortex_m -dap $_CHIPNAME.dap
36+
37+
if { [info exists WORKAREASIZE] } {
38+
set _WORKAREASIZE $WORKAREASIZE
39+
} else {
40+
# 512 KB On-Chip SRAM
41+
set _WORKAREASIZE 0x80000
42+
}
43+
44+
$_TARGETNAME configure -work-area-phys 0x20000000 \
45+
-work-area-size $_WORKAREASIZE -work-area-backup 0
46+
47+
if { ![using_hla] } {
48+
cortex_m reset_config sysresetreq
49+
}
50+
51+
adapter speed 1000

debugger/select_hla.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
transport select hla_swd

debugger/select_swd.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
transport select swd

platform.txt

+29-17
Original file line numberDiff line numberDiff line change
@@ -108,28 +108,40 @@ tools.dfu-util.upload.params.quiet=
108108
# -Q introduced with latest dfu-util
109109
tools.dfu-util.upload.pattern="{path}/{cmd}" --device {upload.vid}:{pid.0},:{upload.pid} -D "{build.path}/{build.project_name}.bin" -a{upload.interface} -Q
110110

111+
tools.bossac.path={runtime.tools.bossac-1.9.1-arduino5.path}
112+
tools.bossac.cmd=bossac
113+
tools.bossac.upload.params.verbose=-d
114+
tools.bossac.upload.params.quiet=
115+
tools.bossac.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U -e -w "{build.path}/{build.project_name}.bin" -R
116+
111117
# Required discoveries and monitors
112118
# ---------------------------------
113119
pluggable_discovery.required.0=builtin:serial-discovery
114120
pluggable_discovery.required.1=builtin:mdns-discovery
115121
pluggable_discovery.required.2=builtin:dfu-discovery
116122
pluggable_monitor.required.serial=builtin:serial-monitor
117123

118-
tools.bossac.path={runtime.tools.bossac-1.9.1-arduino5.path}
119-
tools.bossac.cmd=bossac
120-
tools.bossac.upload.params.verbose=-d
121-
tools.bossac.upload.params.quiet=
122-
tools.bossac.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U -e -w "{build.path}/{build.project_name}.bin" -R
124+
#
125+
# Debugger
126+
#
123127

124-
# Debugger configuration (general options)
125-
# ----------------------------------------
126-
# EXPERIMENTAL feature:
127-
# - this is alpha and may be subject to change without notice
128-
#debug.executable={build.path}/{build.project_name}.elf
129-
#debug.toolchain=gcc
130-
#debug.toolchain.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
131-
#debug.toolchain.prefix=arm-none-eabi-
132-
#debug.server=openocd
133-
#debug.server.openocd.path={runtime.tools.openocd-0.11.0-arduino2.path}/bin/openocd
134-
#debug.server.openocd.scripts_dir={runtime.tools.openocd-0.11.0-arduino2.path}/share/openocd/scripts/
135-
#debug.server.openocd.script={runtime.platform.path}/variants/{build.variant}/openocd.cfg
128+
tools.gdb.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
129+
tools.gdb.cmd=arm-none-eabi-gdb
130+
tools.gdb.cmd.windows=arm-none-eabi-gdb.exe
131+
132+
debug.executable={build.path}/{build.project_name}.elf
133+
debug.toolchain=gcc
134+
debug.toolchain.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
135+
debug.toolchain.prefix=arm-none-eabi
136+
debug.server=openocd
137+
debug.server.openocd.path={runtime.tools.openocd-0.11.0-arduino2.path}/bin/openocd
138+
debug.server.openocd.scripts_dir={runtime.tools.openocd-0.11.0-arduino2.path}/share/openocd/scripts/
139+
140+
debug.cortex-debug.custom.postAttachCommands.0=monitor reset halt
141+
debug.cortex-debug.custom.postAttachCommands.1=monitor gdb_breakpoint_override hard
142+
debug.cortex-debug.custom.postAttachCommands.2=monitor gdb_sync
143+
debug.cortex-debug.custom.postAttachCommands.3=c
144+
debug.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt
145+
debug.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync
146+
debug.cortex-debug.custom.overrideRestartCommands.2=c
147+
debug.cortex-debug.custom.request=attach

programmers.txt

+14
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ cmsis-dap.program.protocol=
55
cmsis-dap.program.tool=openocd
66
cmsis-dap.program.tool.default=openocd
77
cmsis-dap.program.extra_params=
8+
cmsis-dap.programmer.protocol=cmsis-dap
9+
cmsis-dap.programmer.transport_script={runtime.platform.path}/debugger/select_swd.cfg
810

911
stlink.name=STMicroelectronics STLINK
1012
stlink.communication=USB
@@ -13,6 +15,18 @@ stlink.program.protocol=
1315
stlink.program.tool=openocd
1416
stlink.program.tool.default=openocd
1517
stlink.program.extra_params=
18+
stlink.programmer.protocol=stlink
19+
stlink.programmer.transport_script={runtime.platform.path}/debugger/select_hla.cfg
20+
21+
jlink.name=JLink
22+
jlink.communication=USB
23+
jlink.protocol=
24+
jlink.program.protocol=
25+
jlink.program.tool=openocd
26+
jlink.program.tool.default=openocd
27+
jlink.program.extra_params=
28+
jlink.programmer.protocol=jlink
29+
jlink.programmer.transport_script={runtime.platform.path}/debugger/select_swd.cfg
1630

1731
rfp.name=Renesas Flash Programmer
1832
rfp.communication=USB

0 commit comments

Comments
 (0)