SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
By jaybee
#148940
I would like to write OpenOCD script to conditionally flash application binary image. I want to overwrite flash only in case there is different image. Something like this pseudo code:
Code: Select all
$IMAGE = "Application.elf";
$already_flashed = verify_image $IMAGE;

if { ! $already_flashed } {
    flash write_image erase $IMAGE;
}
Is it possible to do this only by OpenOCD, not using other scripting engine but build-in JimTCL?

Now I use
Code: Select all
openocd -c "source [find board/myboard.cfg]; init; reset halt; verify_image Application.elf; shutdown;"
If the return code is 0, verification pass, if the return code is 1, verification failed.
User avatar
By ntfreak
#148999
you can do simple scripting, for example
Code: Select all
if {[expr [catch {verify_image lpc1368.bin}] == 0]} {
	echo "good"
} else {
	echo "bad"
}
Spen