1# Renesas R-Car Gen3 H3 Salvator-X Cortex-R7 Board Config 2 3source [find interface/ftdi/olimex-arm-usb-ocd-h.cfg] 4source [find target/renesas_rcar_reset_common.cfg] 5set _CHIPNAME r8a77951 6set DAP_TAPID 0x5ba00477 7set CA57_0_DBGBASE 0x80410000 8set CA57_0_CTIBASE 0x80420000 9set CR7_DBGBASE 0x80910000 10set CR7_CTIBASE 0x80918000 11 12adapter srst delay 1000 13adapter speed 20000 14global $_CHIPNAME 15transport select jtag 16 17jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x01 -irmask 0x0f -expected-id $DAP_TAPID 18dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu 19 20cti create $_CHIPNAME.r7.cti -dap $_CHIPNAME.dap -ap-num 1 -baseaddr $CR7_CTIBASE 21target create $_CHIPNAME.r7 cortex_r4 -dap $_CHIPNAME.dap -ap-num 1 -dbgbase $CR7_DBGBASE -defer-examine 22 23$_CHIPNAME.r7 configure -rtos auto 24 25cti create $_CHIPNAME.a57.0.cti -dap $_CHIPNAME.dap -ap-num 1 -baseaddr $CA57_0_CTIBASE 26target create $_CHIPNAME.a57.0 aarch64 -dap $_CHIPNAME.dap -ap-num 1 -dbgbase $CA57_0_DBGBASE -cti $_CHIPNAME.a57.0.cti 27 28proc reset_cr7 { assert } { 29 global _CHIPNAME 30 if { $assert == 1 } { 31 # Software Reset Register 2 Bit(22) Arm Realtime core 32 $_CHIPNAME.a57.0 mww 0xe61500b0 0x00400000 33 } else { 34 # Software Reset Clearing Register 2 Bit(22) Arm Realtime core 35 $_CHIPNAME.a57.0 mww 0xe6150948 0x00400000 36 } 37} 38 39# This function make use of A5x processor to: 40# - Power on the CR7 (PWRONCR7) 41# - Set the boot address (CR7BAR) 42# - Halt the processor 43# - Deassert the CR7 reset 44proc start_cr7 { args } { 45 global _CHIPNAME 46 47 targets $_CHIPNAME.a57.0 48 $_CHIPNAME.a57.0 arp_halt 49 50 # CR7BAR RBAR [31:18] BAREN bit(4) 51 $_CHIPNAME.a57.0 mww 0xe6160070 0x40040010 52 53 # PWRONCR7 54 $_CHIPNAME.a57.0 mww 0xe618024c 1 55 # Wait until power is on. Also possible to 56 # poll PWRSR7 and CR7PSTR register. 57 sleep 100 58 59 $_CHIPNAME.r7 arp_examine 60 catch { $_CHIPNAME.r7 arp_halt } 61 reset_cr7 0 62 63 # resume a5x processor or cmt timer will not run 64 resume 65 # set CR7 processor as default target for future commands 66 targets $_CHIPNAME.r7 67} 68 69$_CHIPNAME.r7 configure -event reset-end { 70 global _CHIPNAME 71 targets $_CHIPNAME.a57.0 72 # Resume the A57 processor and gives 73 # enough time to A57 bootloaders to set-up dram 74 # clocks, power management, security groups 75 resume 76 sleep 500 77 $_CHIPNAME.a57.0 arp_halt 78 $_CHIPNAME.a57.0 arp_poll 79 start_cr7 80} 81 82$_CHIPNAME.a57.0 configure -event examine-end { 83 start_cr7 84} 85 86$_CHIPNAME.r7 configure -event gdb-attach { 87 reset halt 88} 89