Add openocd macros to write image A or B

These are faster than writing the entire EC, and safer if you're
mucking with things like the clock config.  Of course, if you're
changing verified boot or something else that happens before
vboot_init(), these new commands won't help, and you should keep using
the existing flash_link command.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=none
TEST=manual from openocd
- Compile a new image
- From openocd, flash_link_b
- From ec console, note build compile date in image A: shouldn't have changed
- From ec consle, sysjump b; compile date should be for your new image

Change-Id: Ifd6aabe963948d3c5da5bdeb78c5f962a0f9f857
This commit is contained in:
Randall Spangler
2012-04-20 10:04:48 -07:00
parent 13ad1c007b
commit b2f34fcfd1

View File

@@ -6,24 +6,33 @@
# Program internal flash
proc flash_lm4 {path size} {
set lastsect [expr {$size / 1024 - 1}];
proc flash_lm4 {path offset size} {
set firstsect [expr {$offset / 1024}];
set lastsect [expr {($offset + $size) / 1024 - 1}];
reset halt;
flash erase_sector 0 0 $lastsect;
flash erase_sector 0 $firstsect $lastsect;
# Note erase_sector silently fails sometimes; see crosbug.com/p/8632
# Dump a few words as a diagnostic for whether erase succeeded
mdw 0 16
flash write_image $path 0;
flash write_image $path $offset;
reset
}
# Link proto0 has 128KB flash; proto1+ have 256KB
proc flash_link { } {
flash_lm4 ../../../build/link/ec.bin 262144
flash_lm4 ../../../build/link/ec.bin 0 262144
}
proc flash_link_a { } {
flash_lm4 ../../../build/link/ec.A.flat 81920 81920
}
proc flash_link_b { } {
flash_lm4 ../../../build/link/ec.B.flat 163840 81920
}
proc flash_bds { } {
flash_lm4 ../../../build/bds/ec.bin 262144
flash_lm4 ../../../build/bds/ec.bin 0 262144
}
# Boot a software using internal RAM only