@@ -40,6 +40,7 @@ def __init__(self, cpu, adr):
40
40
self .rd_ofs_adr = self .adr + 16
41
41
42
42
def get_name (self , adr ):
43
+ """read and return the buffer name"""
43
44
if adr == 0 :
44
45
return ''
45
46
s = []
@@ -105,13 +106,15 @@ def text_dump(self, ui):
105
106
if buf is None :
106
107
return
107
108
ui .put (buf .to_str ())
109
+ ui .flush ()
108
110
109
111
def __str__ (self ):
110
112
return '%s %d bytes @ 0x%08x' % (self .name , self .buf_size , self .buf_adr )
111
113
112
114
#-----------------------------------------------------------------------------
113
115
114
116
class rtt (object ):
117
+ """rtt buffer operations"""
115
118
116
119
def __init__ (self , cpu , mem ):
117
120
self .cpu = cpu
@@ -120,6 +123,7 @@ def __init__(self, cpu, mem):
120
123
assert (mem .adr & 3 == 0 ) and (mem .size & 3 == 0 ), 'rtt ram must be 32 bit aligned'
121
124
self .mem = mem
122
125
self .adr = None
126
+ self .t2h = self .h2t = None
123
127
self .menu = (
124
128
('init' , self .cmd_init ),
125
129
('info' , self .cmd_info ),
@@ -166,10 +170,11 @@ def monitor(self, ui):
166
170
def cmd_mon (self , ui , args ):
167
171
"""monitor and display the rtt buffers"""
168
172
if self .adr is None :
169
- ui .put ('%s\n ' % _not_initialised )
170
- return
173
+ self .cmd_init (ui , None )
174
+ if self .adr is None :
175
+ return
171
176
ui .put ('Monitoring target to host RTT buffers\n Ctrl-D to exit\n ' )
172
- ui .cli .ln .loop (lambda : self .monitor (ui ))
177
+ ui .cli .ln .loop (lambda : self .monitor (ui ))
173
178
174
179
def cmd_init (self , ui , args ):
175
180
"""initialise the rtt client"""
@@ -204,8 +209,9 @@ def cmd_init(self, ui, args):
204
209
def cmd_info (self , ui , args ):
205
210
"""show rtt information"""
206
211
if self .adr is None :
207
- ui .put ('%s\n ' % _not_initialised )
208
- return
212
+ self .cmd_init (ui , None )
213
+ if self .adr is None :
214
+ return
209
215
# print the rtt info
210
216
cols = []
211
217
cols .append (['rtt address' , ': 0x%08x' % self .adr ])
0 commit comments