target/adi_v5_swd: move setting of do_reconnect one level up
[openocd.git] / tcl / target / nrf51.cfg
blob3781eccb502b03722aab7e204de9b0fc3d8d3aad
1 # SPDX-License-Identifier: GPL-2.0-or-later
4 # script for Nordic nRF51 series, a Cortex-M0 chip
7 source [find target/swj-dp.tcl]
9 if { [info exists CHIPNAME] } {
10    set _CHIPNAME $CHIPNAME
11 } else {
12    set _CHIPNAME nrf51
15 if { [info exists ENDIAN] } {
16    set _ENDIAN $ENDIAN
17 } else {
18    set _ENDIAN little
21 # Work-area is a space in RAM used for flash programming
22 # By default use 16kB
23 if { [info exists WORKAREASIZE] } {
24    set _WORKAREASIZE $WORKAREASIZE
25 } else {
26    set _WORKAREASIZE 0x4000
29 if { [info exists CPUTAPID] } {
30    set _CPUTAPID $CPUTAPID
31 } else {
32    set _CPUTAPID 0x0bb11477
35 swj_newdap $_CHIPNAME cpu -expected-id $_CPUTAPID
36 dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
38 set _TARGETNAME $_CHIPNAME.cpu
39 target create $_TARGETNAME cortex_m -dap $_CHIPNAME.dap
41 $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
43 if {![using_hla]} {
44    # The chip supports standard ARM/Cortex-M0 SYSRESETREQ signal
45    cortex_m reset_config sysresetreq
48 flash bank $_CHIPNAME.flash nrf5 0x00000000 0 0 0 $_TARGETNAME
49 flash bank $_CHIPNAME.uicr nrf5 0x10001000 0 0 0 $_TARGETNAME
51 #  The chip should start up from internal 16Mhz RC, so setting adapter
52 #  clock to 1Mhz should be OK
53 adapter speed 1000
55 proc enable_all_ram {} {
56         # nRF51822 Product Anomaly Notice (PAN) #16 explains that not all RAM banks
57         # are reliably enabled after reset on some revisions (contrary to spec.) So after
58         # resetting we enable all banks via the RAMON register
59         mww 0x40000524 0xF
61 $_TARGETNAME configure -event reset-init {  enable_all_ram }