Skip to content

Commit

Permalink
Open ocd script update (#16)
Browse files Browse the repository at this point in the history
* Update max78000.cfg

Adding reset handling scripts to support features of production parts.

* Update max78000.cfg

Changed formatting
  • Loading branch information
lorne-maxim authored Jul 27, 2020
1 parent 840d0e8 commit 74ffbe5
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion Tools/OpenOCD/scripts/target/max78000.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

# Set the reset pin configuration
reset_config srst_only
adapter srst delay 200
adapter srst delay 2
adapter srst pulse_width 2

# Set flash parameters
set FLASH_BASE 0x10000000
Expand All @@ -17,3 +18,50 @@ set FLASH_OPTIONS 0x01
transport select swd

source [find target/max32xxx.cfg]

global rom_bp_enabled
set rom_bp_enabled "no"

# Override default init_reset{mode} to catch parameter "mode"
proc init_reset {mode} {
global sp_reset_mode
set sp_reset_mode $mode
}

$_CHIPNAME.cpu configure -event reset-deassert-post {
global sp_reset_mode

if { ([string compare $sp_reset_mode "init"] == 0) } {
set state "reset"
while { [string compare $state "reset"] == 0 } {
set state [$_CHIPNAME.cpu curstate]
$_CHIPNAME.cpu arp_poll
}
$_CHIPNAME.cpu arp_halt
}
}

$_CHIPNAME.cpu configure -event reset-assert-pre {
global sp_reset_mode
global rom_bp_enabled

if { (([string compare $sp_reset_mode "halt"] == 0) || ([string compare $sp_reset_mode "init"] == 0)) } {
halt
if { ([string compare $rom_bp_enabled "yes"] == 0) } {
rbp 0x00002120
}
bp 0x00002120 2 hw
set rom_bp_enabled "yes"
}
}

$_CHIPNAME.cpu configure -event halted {
global sp_reset_mode
global rom_bp_enabled

if { ([string compare $rom_bp_enabled "yes"] == 0) } {
rbp 0x00002120
set rom_bp_enabled "no"
}
set sp_reset_mode none
}

0 comments on commit 74ffbe5

Please sign in to comment.