| # SPDX-License-Identifier: GPL-2.0-or-later |
| |
| source [find interface/jlink.cfg] |
| |
| transport select swd |
| |
| source [find target/swj-dp.tcl] |
| |
| |
| # Set Chipname |
| if { [info exists CHIPNAME] } { |
| set _CHIPNAME $CHIPNAME |
| } else { |
| set _CHIPNAME kb1200 |
| } |
| |
| # SWD DAP ID of ENE KB1200 Cortex-M4. |
| if { [info exists CPUDAPID ] } { |
| set _CPUDAPID $CPUDAPID |
| } else { |
| set _CPUDAPID 0x2ba01477 |
| } |
| |
| # Work-area is a space in RAM used for flash programming |
| # By default use 32kB |
| if { [info exists WORKAREASIZE] } { |
| set _WORKAREASIZE $WORKAREASIZE |
| } else { |
| set _WORKAREASIZE 0x8000 |
| } |
| |
| # Debug Adapter Target Settings |
| swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUDAPID |
| dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu |
| set _TARGETNAME $_CHIPNAME.cpu |
| target create $_TARGETNAME cortex_m -endian little -dap $_CHIPNAME.dap |
| |
| $_TARGETNAME configure -work-area-phys 0x200c0000 -work-area-size $_WORKAREASIZE -work-area-backup 0 |
| |
| # Initial JTAG/SWD speed |
| # For safety purposes, set for the lowest cpu clock configuration |
| # 4MHz / 6 = 666KHz, so use 600KHz for it |
| adapter speed 600 |
| |
| # For safety purposes, set for the lowest cpu clock configuration |
| $_TARGETNAME configure -event reset-start {adapter speed 600} |
| |
| # use sysresetreq to perform a system reset |
| cortex_m reset_config sysresetreq |
| |
| # ENE internal spi flash |
| flash bank ispif eneispif 0x60000000 0 0 0 $_TARGETNAME 0x50101000 |