summaryrefslogtreecommitdiff
path: root/util/openocd
diff options
context:
space:
mode:
Diffstat (limited to 'util/openocd')
-rw-r--r--util/openocd/npcx.cfg6
-rw-r--r--util/openocd/npcx_cmds.tcl18
2 files changed, 11 insertions, 13 deletions
diff --git a/util/openocd/npcx.cfg b/util/openocd/npcx.cfg
index d42580a907..73b1957f3c 100644
--- a/util/openocd/npcx.cfg
+++ b/util/openocd/npcx.cfg
@@ -46,9 +46,7 @@ target create $_TARGETNAME cortex_m -endian $_ENDIAN -chain-position \
adapter_khz 100
adapter_nsrst_delay 100
-if {[using_jtag]} {
- jtag_ntrst_delay 100
-}
+jtag_ntrst_delay 100
# use srst to perform a system reset
cortex_m reset_config srst
@@ -58,6 +56,6 @@ reset_config trst_and_srst
$_TARGETNAME configure -event reset-start {
echo "NPCX5M5G Reset..."
- adapter_khz 1000
halt
+ adapter_khz 1000
}
diff --git a/util/openocd/npcx_cmds.tcl b/util/openocd/npcx_cmds.tcl
index a32afccf03..51db7f635a 100644
--- a/util/openocd/npcx_cmds.tcl
+++ b/util/openocd/npcx_cmds.tcl
@@ -10,6 +10,9 @@ source [find mem_helper.tcl]
proc flash_npcx {image_path image_offset image_size spifw_image} {
set UPLOAD_FLAG 0x200C4000;
+ echo "*** NPCX Reset and halt CPU first ***"
+ reset halt
+
# Clear whole 96KB Code RAM
mwb 0x100A8000 0xFF 0x18000
# Upload binary image to Code RAM
@@ -34,7 +37,7 @@ proc flash_npcx {image_path image_offset image_size spifw_image} {
resume
# Wait for any pending flash operations to complete
- while {[expr [mrw $UPLOAD_FLAG] & 0x01] == 0} { sleep 1 }
+ while {[expr [mrw $UPLOAD_FLAG] & 0x01] == 0} { sleep 1000 }
if {[expr [mrw $UPLOAD_FLAG] & 0x02] == 0} {
echo "*** Program Fail ***"
@@ -58,7 +61,6 @@ proc flash_npcx_ro {image_dir image_offset} {
# Halt CPU first
halt
- adapter_khz 1000
# diable MPU for Data RAM
mww $MPU_RNR 0x1
@@ -81,8 +83,8 @@ proc flash_npcx_all {image_dir image_offset} {
set flash_size 0x800000
# images path
- set ro_image_path $image_dir/ec.RO.flat
- set rw_image_path $image_dir/ec.RW.bin
+ set ro_image_path $image_dir/RO/ec.RO.flat
+ set rw_image_path $image_dir/RW/ec.RW.bin
set spifw_image $image_dir/chip/npcx/spiflashfw/ec_npcxflash.bin
# images offset
@@ -91,8 +93,6 @@ proc flash_npcx_all {image_dir image_offset} {
# Halt CPU first
halt
- adapter_khz 1000
-
# diable MPU for Data RAM
mww $MPU_RNR 0x1
mww $MPU_RASR 0x0
@@ -109,7 +109,7 @@ proc flash_npcx_all {image_dir image_offset} {
}
-proc halt_npcx_cpu { } {
- echo "*** Halt CPU first ***"
- halt
+proc reset_halt_cpu { } {
+ echo "*** NPCX Reset and halt CPU first ***"
+ reset halt
}