Skip to content

Commit

Permalink
Merge pull request #237 from facchinm/debugger_support
Browse files Browse the repository at this point in the history
Debugger support
  • Loading branch information
facchinm authored Jan 19, 2024
2 parents 84a0536 + 43cbb8f commit d0c5148
Show file tree
Hide file tree
Showing 9 changed files with 187,085 additions and 17 deletions.
16 changes: 16 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ portenta_c33.upload.native_usb=true
portenta_c33.upload.maximum_size=2097152
portenta_c33.upload.maximum_data_size=523624

portenta_c33.debug.server.openocd.scripts.0=interface/{programmer.protocol}.cfg
portenta_c33.debug.server.openocd.scripts.1={programmer.transport_script}
portenta_c33.debug.server.openocd.scripts.2={runtime.platform.path}/debugger/R7FA6M5BH.cfg
portenta_c33.debug.svd_file={runtime.platform.path}/svd/R7FA6M5BH.svd


##############################################################

minima.name=Arduino UNO R4 Minima
Expand Down Expand Up @@ -94,6 +100,11 @@ minima.upload.native_usb=true
minima.upload.maximum_size=262144
minima.upload.maximum_data_size=32768

minima.debug.server.openocd.scripts.0=interface/{programmer.protocol}.cfg
minima.debug.server.openocd.scripts.1={programmer.transport_script}
minima.debug.server.openocd.scripts.2={runtime.platform.path}/debugger/R7FA4M1AB.cfg
minima.debug.svd_file={runtime.platform.path}/svd/R7FA4M1AB.svd

##############################################################

unor4wifi.name=Arduino UNO R4 WiFi
Expand Down Expand Up @@ -140,6 +151,11 @@ unor4wifi.upload.native_usb=true
unor4wifi.upload.maximum_size=262144
unor4wifi.upload.maximum_data_size=32768

unor4wifi.debug.server.openocd.scripts.0=interface/{programmer.protocol}.cfg
unor4wifi.debug.server.openocd.scripts.1={programmer.transport_script}
unor4wifi.debug.server.openocd.scripts.2={runtime.platform.path}/debugger/R7FA4M1AB.cfg
unor4wifi.debug.svd_file={runtime.platform.path}/svd/R7FA4M1AB.svd

##############################################################

muxto.name=Science Kit R3 Audio Module
Expand Down
51 changes: 51 additions & 0 deletions debugger/R7FA4M1AB.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# Renesas RA4M1 w/ ARM Cortex-M4 @ 48 MHz
#

if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME ra4m1
}

if { [info exists CPU_JTAG_TAPID] } {
set _CPU_JTAG_TAPID $CPU_JTAG_TAPID
} else {
set _CPU_JTAG_TAPID 0x5ba00477
}

if { [info exists CPU_SWD_TAPID] } {
set _CPU_SWD_TAPID $CPU_SWD_TAPID
} else {
set _CPU_SWD_TAPID 0x5ba02477
}

source [find target/swj-dp.tcl]

if { [using_jtag] } {
set _CPU_TAPID $_CPU_JTAG_TAPID
} else {
set _CPU_TAPID $_CPU_SWD_TAPID
}

swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPU_TAPID
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu

set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME cortex_m -dap $_CHIPNAME.dap

if { [info exists WORKAREASIZE] } {
set _WORKAREASIZE $WORKAREASIZE
} else {
# 32 KB On-Chip SRAM
set _WORKAREASIZE 0x8000
}

$_TARGETNAME configure -work-area-phys 0x20000000 \
-work-area-size $_WORKAREASIZE -work-area-backup 0

if { ![using_hla] } {
cortex_m reset_config sysresetreq
}

adapter speed 1000
51 changes: 51 additions & 0 deletions debugger/R7FA6M5BH.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# Renesas RA6M5 w/ ARM Cortex-M33 @ 200 MHz
#

if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME ra6m5
}

if { [info exists CPU_JTAG_TAPID] } {
set _CPU_JTAG_TAPID $CPU_JTAG_TAPID
} else {
set _CPU_JTAG_TAPID 0x5ba00477
}

if { [info exists CPU_SWD_TAPID] } {
set _CPU_SWD_TAPID $CPU_SWD_TAPID
} else {
set _CPU_SWD_TAPID 0x5ba02477
}

source [find target/swj-dp.tcl]

if { [using_jtag] } {
set _CPU_TAPID $_CPU_JTAG_TAPID
} else {
set _CPU_TAPID $_CPU_SWD_TAPID
}

swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPU_TAPID
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu

set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME cortex_m -dap $_CHIPNAME.dap

if { [info exists WORKAREASIZE] } {
set _WORKAREASIZE $WORKAREASIZE
} else {
# 512 KB On-Chip SRAM
set _WORKAREASIZE 0x80000
}

$_TARGETNAME configure -work-area-phys 0x20000000 \
-work-area-size $_WORKAREASIZE -work-area-backup 0

if { ![using_hla] } {
cortex_m reset_config sysresetreq
}

adapter speed 1000
1 change: 1 addition & 0 deletions debugger/select_hla.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
transport select hla_swd
1 change: 1 addition & 0 deletions debugger/select_swd.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
transport select swd
46 changes: 29 additions & 17 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,28 +108,40 @@ tools.dfu-util.upload.params.quiet=
# -Q introduced with latest dfu-util
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

tools.bossac.path={runtime.tools.bossac-1.9.1-arduino5.path}
tools.bossac.cmd=bossac
tools.bossac.upload.params.verbose=-d
tools.bossac.upload.params.quiet=
tools.bossac.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U -e -w "{build.path}/{build.project_name}.bin" -R

# Required discoveries and monitors
# ---------------------------------
pluggable_discovery.required.0=builtin:serial-discovery
pluggable_discovery.required.1=builtin:mdns-discovery
pluggable_discovery.required.2=builtin:dfu-discovery
pluggable_monitor.required.serial=builtin:serial-monitor

tools.bossac.path={runtime.tools.bossac-1.9.1-arduino5.path}
tools.bossac.cmd=bossac
tools.bossac.upload.params.verbose=-d
tools.bossac.upload.params.quiet=
tools.bossac.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U -e -w "{build.path}/{build.project_name}.bin" -R
#
# Debugger
#

# Debugger configuration (general options)
# ----------------------------------------
# EXPERIMENTAL feature:
# - this is alpha and may be subject to change without notice
#debug.executable={build.path}/{build.project_name}.elf
#debug.toolchain=gcc
#debug.toolchain.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
#debug.toolchain.prefix=arm-none-eabi-
#debug.server=openocd
#debug.server.openocd.path={runtime.tools.openocd-0.11.0-arduino2.path}/bin/openocd
#debug.server.openocd.scripts_dir={runtime.tools.openocd-0.11.0-arduino2.path}/share/openocd/scripts/
#debug.server.openocd.script={runtime.platform.path}/variants/{build.variant}/openocd.cfg
tools.gdb.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
tools.gdb.cmd=arm-none-eabi-gdb
tools.gdb.cmd.windows=arm-none-eabi-gdb.exe

debug.executable={build.path}/{build.project_name}.elf
debug.toolchain=gcc
debug.toolchain.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
debug.toolchain.prefix=arm-none-eabi
debug.server=openocd
debug.server.openocd.path={runtime.tools.openocd-0.11.0-arduino2.path}/bin/openocd
debug.server.openocd.scripts_dir={runtime.tools.openocd-0.11.0-arduino2.path}/share/openocd/scripts/

debug.cortex-debug.custom.postAttachCommands.0=monitor reset halt
debug.cortex-debug.custom.postAttachCommands.1=monitor gdb_breakpoint_override hard
debug.cortex-debug.custom.postAttachCommands.2=monitor gdb_sync
debug.cortex-debug.custom.postAttachCommands.3=c
debug.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt
debug.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync
debug.cortex-debug.custom.overrideRestartCommands.2=c
debug.cortex-debug.custom.request=attach
14 changes: 14 additions & 0 deletions programmers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ cmsis-dap.program.protocol=
cmsis-dap.program.tool=openocd
cmsis-dap.program.tool.default=openocd
cmsis-dap.program.extra_params=
cmsis-dap.programmer.protocol=cmsis-dap
cmsis-dap.programmer.transport_script={runtime.platform.path}/debugger/select_swd.cfg

stlink.name=STMicroelectronics STLINK
stlink.communication=USB
Expand All @@ -13,6 +15,18 @@ stlink.program.protocol=
stlink.program.tool=openocd
stlink.program.tool.default=openocd
stlink.program.extra_params=
stlink.programmer.protocol=stlink
stlink.programmer.transport_script={runtime.platform.path}/debugger/select_hla.cfg

jlink.name=JLink
jlink.communication=USB
jlink.protocol=
jlink.program.protocol=
jlink.program.tool=openocd
jlink.program.tool.default=openocd
jlink.program.extra_params=
jlink.programmer.protocol=jlink
jlink.programmer.transport_script={runtime.platform.path}/debugger/select_swd.cfg

rfp.name=Renesas Flash Programmer
rfp.communication=USB
Expand Down
Loading

0 comments on commit d0c5148

Please sign in to comment.