set headings unknown
set inblk 3
+proc debug {s} { puts "$s" }
+
proc manyset {list args} {
foreach val $list var $args { upvar 1 $var my; set my $val }
}
}
}
+lappend symbols {0x00000060 {=udata,!acs=}}
+#lappend symbols {0x00000f00 {=SFRs,!acs=}}
+lappend symbols {0x00000f60 {=SFRs,acs= {}}}
+lappend sections {0x00000f00 {=SFRs=} 0}
+#lappend sections {0x00000060 {==========UDATA,!ACS===========} 0}
+#lappend sections {0x00000f60 {==========SFRs,ACS===========} 0}
+
lappend sections [list 0x1000 =END= 0]
set sections [lsort $sections]
set symbols [lsort $symbols]
+#debug >$symbols<
+
+proc addendlast {v ev evn} {
+ upvar #0 $v syms
+ lappend syms [list [lindex [lindex $syms end] 0] [list {} (lastsymbol)]]
+ lappend syms [list [format 0x%08lx $ev] [list {} $evn]]
+}
+
+addendlast symbolsbylockind(program) 0x8000 (end)
set p [open $port {RDWR NONBLOCK} 0]
exec stty -F $port min 1 time 0 -istrip -ocrnl -onlcr -onocr -opost \
proc xmit {b} {
global p
-#puts stderr >xmit|$b<
+ #debug >xmit|$b<
set b [expr $b]
set c [binary format c* $b]
puts -nonewline $p [format %c $b]
set insection 0
set addr 0
set now_max 4
-set inline -1
set displine 0
+set inline 0
+set shownsection {}
proc p {s} { puts -nonewline $s }
setup_$ms
+proc queue_show {kind value} {
+ upvar #0 q_$kind queued
+ lappend queued $value
+}
+
+proc p_addr_symbol {a s} {
+ global inline
+ endline
+ p [format "%08x %-15s %-20s" $a [lindex $s 0] [lindex $s 1]]
+ set inline 1
+}
+
proc endline {} {
- global inline displine
- if {$inline} { p "\n"; incr displine }
+ global inline
+ if {!$inline} return
+ p "\n"
set inline 0
}
+proc do_show {} {
+ global addr inline insection q_symbol q_section shownss
+ global shownsection
+ #debug "do_show [format %x $addr] $insection $q_symbol $q_section"
+ if {$inline} { error "do_show inline $addr" }
+ foreach s $q_section {
+ if {![string compare $s $shownsection]} continue
+ p "---------- $s ----------\n"
+ set shownsection $s
+ }
+ set shownss {}
+ foreach s $q_symbol {
+ p_addr_symbol $addr $s
+ set shownss [concat $s]
+ }
+ #debug "shownss>$shownss<"
+ if {!$insection && ![string compare =SFRs= $shownsection]} {
+ endline
+ p "\n"
+ reset_show
+ return
+ }
+ if {![llength $q_symbol]} { p_addr_symbol $addr {} }
+ if {!$insection} {
+ endline
+# p "------------------------------\n"
+ set shownsection {}
+ }
+ reset_show
+}
+
+proc reset_show {} {
+ foreach v {q_section q_symbol} {
+ global $v
+ set $v {}
+ }
+}
+
proc show {sym} {
global insection section displine addr shownsection inline shownss
set showsectionend 0
if {$insection && [string compare $section $shownsection]} {
endline
- p "---------- $section ----------\n"
set shownsection $section
set displine 0
} elseif {!$insection && [string length $shownsection]} {
endline
- p "------------------------------\n"
set shownsection {}
set displine 0
}
endline
}
if {!$inline} {
- p [format "%08x %-15s %-20s" $addr \
- [lindex $sym 0] [lindex $sym 1]]
set inline 1
set shownss $shownsection-$sym
}
}
-set stkptr {panic_vars_section-panic: psave_stkptr}
-set stack {panic_vars_section-panic: panic_stack}
+set stkptr {panic: psave_stkptr}
+set stack {panic: panic_stack}
+reset_show
foreach ss [list $stkptr $stack] { set ccontents($ss) {} }
while {$sectionnum < [llength $sections]} {
+ # So what happens at this address ?
+
set now_section [expr {$sectionchange - $addr}]
- set now_symbol [expr {$symboladdr - $addr}]
if {!$now_section && !$insection} {
+ queue_show section $section
set insection 1
set sectionchange $sectionend
continue
}
- if {!$now_symbol} {
- show $symbol
- thingnext symbol
- continue
- }
if {!$now_section && $insection} {
- if {[string compare $section =SFRs=]} {
- show { }
- }
thingnext section
set insection 0
set sectionchange $sectionaddr
+ continue
}
+
+ set now_symbol [expr {$symboladdr - $addr}]
+ if {!$now_symbol} {
+ queue_show symbol $symbol
+ thingnext symbol
+ continue
+ }
+
+ # OK, that's all the things that we need to say
+ # about this addr.
+
+ # Decide how much to do:
set now $now_symbol
if {$now > $now_section} { set now $now_section }
+
+ #debug "now $now"
+ do_show
+
if {!$insection} {
incr addr $now
continue
}
- if {$now > $now_max} { set now $now_max }
- show {}
- set bytes [readbytes $addr $now]
- foreach b $bytes {
- set h [format "%02x" [expr {$b & 0xff}]]
- p " $h"
- if {[info exists ccontents($shownss)]} {
- append ccontents($shownss) $h
+
+ while {$now > 0} {
+ set nownow $now
+ if {$nownow > $now_max} { set nownow $now_max }
+ set bytes [readbytes $addr $nownow]
+ foreach b $bytes {
+ set h [format "%02x" [expr {$b & 0xff}]]
+ p " $h"
+ if {[info exists ccontents($shownss)]} {
+ append ccontents($shownss) $h
+ }
+ incr addr
}
- incr addr
+ incr now -$nownow
}
- set inline 1
+ endline
}
-endline
set stackdepth 31
if {$si == $stkptr+1} { p " - - - - -\n" }
}
-foreach v {stkptr stack} { set $v $ccontents([set $v]) }
+foreach v {stkptr stack} {
+ #debug ">$v|[set $v]|$ccontents([set $v])<"
+ set $v $ccontents([set $v])
+}
-p "\n---------- =Execution Stack= ----------\n"
+endline
+p "---------- =Execution Stack= ----------\n"
set stkptr [expr "0x$stkptr & $stackdepth"]
for {set si 1} {$si <= $stackdepth} {incr si} {