summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2011-06-07 06:17:37 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2011-06-07 06:17:37 (GMT)
commit68ce15c1c156c6e6ec9ecdd756a8472bc235ce52 (patch)
treee0e16cd8c3ef329153816d0a65a4585e451079a2
parentd84c0291b800421756cb885e08bdddc73cdb066e (diff)
downloadde1flash-68ce15c1c156c6e6ec9ecdd756a8472bc235ce52.zip
de1flash-68ce15c1c156c6e6ec9ecdd756a8472bc235ce52.tar.gz
de1flash-68ce15c1c156c6e6ec9ecdd756a8472bc235ce52.tar.bz2
de1flash-68ce15c1c156c6e6ec9ecdd756a8472bc235ce52.tar.xz
de1flash.tcl: fix erase block list; unbreak default length for read
Fix the computation of the list of erase blocks (used $len instead of $end, which is wrong when the base is not zero.) Unbreak the default length for read by moving a global statement.
-rw-r--r--de1flash.tcl6
1 files changed, 3 insertions, 3 deletions
diff --git a/de1flash.tcl b/de1flash.tcl
index 0936d00..0a4fa76 100644
--- a/de1flash.tcl
+++ b/de1flash.tcl
@@ -173,8 +173,6 @@ proc fl_erase addr {
# Read file
proc fl_read_file { file addr size } {
- global fl_device_size
-
set f [open $file {WRONLY CREAT TRUNC BINARY}]
puts -nonewline [format "Reading file %s@0x%x,0x%x... " $file $addr $size]
@@ -229,6 +227,8 @@ proc fl_write_file { file addr size } {
# Parse a list of filespecs
proc fl_parse_files { mode files } {
+ global fl_device_size
+
set last_address 0
set file_list {}
@@ -270,7 +270,7 @@ proc fl_get_eraseblocks flist {
set end [expr $addr + $len]
- while { $addr < $len } {
+ while { $addr < $end } {
set secsize [fl_sector_size $addr]
set secaddr [expr $addr & ~($secsize - 1)]