Index: docs/rawbin.html ================================================================== --- docs/rawbin.html +++ docs/rawbin.html @@ -110,20 +110,29 @@
Scan the list for the end address.
+Scan the list for the end address. Use that to create a list of byte +values covering all segments, filled with a value (nominally 0xFF). +The list starts at the input startAddr, and segments are expected to +be placed within it.
set maxAddr 0
foreach {addr dataL} $segmentList {
+ if {$addr < $startAddr} {
+ set errMsg "Invalid start address: segment starts at $addr,\
+ output file defined to start at $startAddr"
+ log::error $errMsg
+ error $errMsg
+ }
if {$maxAddr < ($addr + [llength $dataL])} {
set maxAddr [expr {$addr + [llength $dataL]}]
}
}
- set outL [lrepeat $fillValue]
We have our filled output list. For each segment, replace the data in the appropriate range with the segment data.
foreach {addr dataL} $segmentList {
- set outL [lreplace $outL $addr [expr {$addr + [llength $dataL]}] {*}$dataL]]
+ set offset [expr {$addr - $startAddr}]
+ set outL [lreplace $outL $offset [expr {$offset + [llength $dataL] - 1}] {*}$dataL]]
}