Commit c6fa2a66 authored by Michael Zehrer's avatar Michael Zehrer
Browse files

add new option for enabling JTAG

parent 069044c1
#transport select jtag
transport select jtag
adapter_khz 1000
adapter_nsrst_delay 400
#jtag_ntrst_delay 400
reset_config none
#reset_config trst_and_srst
#gdb_memory_map enable
adapter speed 100
adapter_nsrst_delay 500
reset_config trst_and_srst
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME rspi
set _CHIPNAME rpi
}
if { [info exists CPU_TAPID ] } {
set _CPU_TAPID $CPU_TAPID
} else {
set _CPU_TAPID 0x07b7617f
set _CPU_TAPID 0x07B7617F
}
jtag newtap $_CHIPNAME arm -irlen 5 -expected-id $_CPU_TAPID
set _TARGETNAME $_CHIPNAME.arm
target create $_TARGETNAME arm11 -chain-position $_TARGETNAME
rspi.arm configure -event gdb-attach { halt }
rpi.arm configure -event gdb-attach { halt }
# Credits to Petr Tesarik from SUSE who provided this updated configuration,
# source: https://www.suse.com/c/debugging-raspberry-pi-3-with-jtag/
transport select jtag
# we need to enable srst even though we don't connect it
reset_config trst_and_srst
adapter speed 1000
jtag_ntrst_delay 500
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME rpi3
}
#
# Main DAP
#
if { [info exists DAP_TAPID] } {
set _DAP_TAPID $DAP_TAPID
} else {
set _DAP_TAPID 0x4BA00477
}
jtag newtap $_CHIPNAME tap -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_DAP_TAPID -enable
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.tap
set _TARGETNAME $_CHIPNAME.a53
set _CTINAME $_CHIPNAME.cti
set DBGBASE {0x80010000 0x80012000 0x80014000 0x80016000}
set CTIBASE {0x80018000 0x80019000 0x8001A000 0x8001B000}
set _cores 4
for { set _core 0 } { $_core < $_cores } { incr _core } {
cti create $_CTINAME.$_core -dap $_CHIPNAME.dap -ap-num 0 \
-ctibase [lindex $CTIBASE $_core]
target create $_TARGETNAME.$_core aarch64 \
-dap $_CHIPNAME.dap -coreid $_core \
-dbgbase [lindex $DBGBASE $_core] -cti $_CTINAME.$_core
$_TARGETNAME.$_core configure -event reset-assert-post "aarch64 dbginit"
$_TARGETNAME.$_core configure -event gdb-attach { halt }
}
......@@ -66,6 +66,19 @@
</option.description>
<option.value>false</option.value>
</option>
<option definition="RPI_ENABLE_JTAG" readable="Enable JTAG" type="bool">
<option.description>
ON = Configure alternate functions for some pins to enable JTAG with them. In Detail:
GPIO_04 (ALT5) - ARM_TDI
GPIO_22 (ALT4) - ARM_TRST
GPIO_23 (ALT4) - ARM_RTCK
GPIO_24 (ALT4) - ARM_TDO
GPIO_25 (ALT4) - ARM_TCK
GPIO_27 (ALT4) - ARM_TMS
OFF = Don't configure the JTAG pins
</option.description>
<option.value>false</option.value>
</option>
<option definition="RPI_BOARD" readable="Board / Model" type="rpi_board">
<option.description>Target Raspberry Pi board / model</option.description>
</option>
......
......@@ -76,6 +76,18 @@ reset_svc_mode:
ldr r1, =(POWER_MANAGEMENT_PASSWORD | POWER_MANAGEMENT_RSTC_RESET)
str r1, [r0]
#ifdef RPI_ENABLE_JTAG
ldr r0, =GPIO_GPFSEL0
ldr r1, =(GPIO_GPFSEL_ALT5 << (4 * 3)) /* GPIO_04 - ALT5 */
str r1, [r0]
ldr r1, =((GPIO_GPFSEL_ALT4 << (2 * 3)) | /* GPIO_22 - ALT4 */ \
(GPIO_GPFSEL_ALT4 << (3 * 3)) | /* GPIO_23 - ALT4 */ \
(GPIO_GPFSEL_ALT4 << (4 * 3)) | /* GPIO_24 - ALT4 */ \
(GPIO_GPFSEL_ALT4 << (5 * 3)) | /* GPIO_25 - ALT4 */ \
(GPIO_GPFSEL_ALT4 << (7 * 3))) /* GPIO_27 - ALT4 */
str r1, [r0, #0x8]
#endif
// set the stackpointer for the supervisor mode
mov sp, #0x4000
......
/**
* Generated on 2020-01-15 13:34
* Generated on 2020-02-11 15:52
* DO NOT EDIT
*
* @brief automatically generated params header
......@@ -14,6 +14,7 @@
#define ARCTOS_SCHEDULER_TIME_SLOT_SIZE 100000
/* #undef RPI_ENABLE_FPU */
/* #undef RPI_ENABLE_CACHE */
/* #undef RPI_ENABLE_JTAG */
#define RPI_BOARD RASPBERRY_PI_B
#define RPI_LOG_DESTINATION kSerial01
......
/**
* Generated on 2020-01-15 13:34
* Generated on 2020-02-11 15:52
* DO NOT EDIT
*
* @brief automatically generated params header
......
......@@ -2,7 +2,7 @@
# This script is automatically generated
# DO NOT EDIT
#
# Generated on 2020-01-15 13:34
# Generated on 2020-02-11 15:52
#
set(ARCTOS_TARGET "raspberry")
......@@ -23,6 +23,7 @@ set(ARCTOS_LOG_ENABLE_COLOR on)
set(ARCTOS_SCHEDULER_TIME_SLOT_SIZE "100000")
set(RPI_ENABLE_FPU off)
set(RPI_ENABLE_CACHE off)
set(RPI_ENABLE_JTAG off)
set(RPI_BOARD "RASPBERRY_PI_B")
set(RPI_LOG_DESTINATION "kSerial01")
......
/**
* Generated on 2020-01-15 13:34
* Generated on 2020-02-11 15:52
* DO NOT EDIT
*
* @brief automatically generated params header
......@@ -14,6 +14,7 @@
#define ARCTOS_SCHEDULER_TIME_SLOT_SIZE 100000
/* #undef RPI_ENABLE_FPU */
/* #undef RPI_ENABLE_CACHE */
/* #undef RPI_ENABLE_JTAG */
#define RPI_BOARD RASPBERRY_PI_B3
#define RPI_LOG_DESTINATION kSerial01
......
/**
* Generated on 2020-01-15 13:34
* Generated on 2020-02-11 15:52
* DO NOT EDIT
*
* @brief automatically generated params header
......
......@@ -2,7 +2,7 @@
# This script is automatically generated
# DO NOT EDIT
#
# Generated on 2020-01-15 13:34
# Generated on 2020-02-11 15:52
#
set(ARCTOS_TARGET "raspberry")
......@@ -23,6 +23,7 @@ set(ARCTOS_LOG_ENABLE_COLOR on)
set(ARCTOS_SCHEDULER_TIME_SLOT_SIZE "100000")
set(RPI_ENABLE_FPU off)
set(RPI_ENABLE_CACHE off)
set(RPI_ENABLE_JTAG off)
set(RPI_BOARD "RASPBERRY_PI_B3")
set(RPI_LOG_DESTINATION "kSerial01")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment