1# SPDX-License-Identifier: GPL-2.0-or-later 2 3source [find interface/jlink.cfg] 4 5transport select swd 6 7source [find target/swj-dp.tcl] 8 9 10# Set Chipname 11if { [info exists CHIPNAME] } { 12 set _CHIPNAME $CHIPNAME 13} else { 14 set _CHIPNAME kb1200 15} 16 17# SWD DAP ID of ENE KB1200 Cortex-M4. 18if { [info exists CPUDAPID ] } { 19 set _CPUDAPID $CPUDAPID 20} else { 21 set _CPUDAPID 0x2ba01477 22} 23 24# Work-area is a space in RAM used for flash programming 25# By default use 32kB 26if { [info exists WORKAREASIZE] } { 27 set _WORKAREASIZE $WORKAREASIZE 28} else { 29 set _WORKAREASIZE 0x8000 30} 31 32# Debug Adapter Target Settings 33swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUDAPID 34dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu 35set _TARGETNAME $_CHIPNAME.cpu 36target create $_TARGETNAME cortex_m -endian little -dap $_CHIPNAME.dap 37 38$_TARGETNAME configure -work-area-phys 0x200c0000 -work-area-size $_WORKAREASIZE -work-area-backup 0 39 40# Initial JTAG/SWD speed 41# For safety purposes, set for the lowest cpu clock configuration 42# 4MHz / 6 = 666KHz, so use 600KHz for it 43adapter speed 600 44 45# For safety purposes, set for the lowest cpu clock configuration 46$_TARGETNAME configure -event reset-start {adapter speed 600} 47 48# use sysresetreq to perform a system reset 49cortex_m reset_config sysresetreq 50 51# ENE internal spi flash 52flash bank ispif eneispif 0x60000000 0 0 0 $_TARGETNAME 0x50101000 53