Commit 8b62f65
ThreadMRI can now be global
ThreadMRI can now be declared as a global like DebugSerial. It will
take care of calling begin() on the underlying Serial object. So now if
you declare a ThreadMRI object somewhere in your code, that will be
enough to pull the MRI debug monitor into your code so that you can use
GDB for remote debugging.
The implementation of calling HardwareSerial::begin() takes a bit of
extra work:
* At time the ThreadMRI object's constructor runs, the underlying
HardwareSerial object might not yet have been initialized. It is
safest to perform this call from setup().
* ThreadMRI sets a temporary breakpoint on setup() from its global
constructor. When this breakpoint hits, it can then call the begin()
method.
By default the ThreadMRI object will cause execution to be halted on
the first line of setup() so that the user can connect with GDB and
set breakpoints/watchpoints at points of interest before they allow
their program to run. This can be disabled via the 4th parameter
of ThreadMRI's constructor.
I doubled the stack size from 512 to 1024 bytes for mriMain() as the
STM code to initialize the baud rate of the serial port is pretty stack
hungry and it overflowed at 512 bytes.1 parent 9c2fca6 commit 8b62f65
File tree
3 files changed
+98
-37
lines changed- libraries/ThreadMRI
- examples/ThreadMRI
- src
3 files changed
+98
-37
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | 13 | | |
17 | | - | |
| 14 | + | |
18 | 15 | | |
19 | 16 | | |
20 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 32 | | |
38 | 33 | | |
39 | 34 | | |
40 | | - | |
| 35 | + | |
41 | 36 | | |
42 | 37 | | |
43 | 38 | | |
| |||
77 | 72 | | |
78 | 73 | | |
79 | 74 | | |
80 | | - | |
81 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
82 | 80 | | |
83 | 81 | | |
84 | 82 | | |
| |||
143 | 141 | | |
144 | 142 | | |
145 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
146 | 147 | | |
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
153 | | - | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
| 169 | + | |
169 | 170 | | |
170 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
171 | 176 | | |
172 | | - | |
| 177 | + | |
173 | 178 | | |
174 | | - | |
| 179 | + | |
175 | 180 | | |
176 | | - | |
| 181 | + | |
177 | 182 | | |
178 | 183 | | |
179 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
180 | 190 | | |
181 | 191 | | |
| 192 | + | |
182 | 193 | | |
183 | 194 | | |
184 | 195 | | |
| |||
193 | 204 | | |
194 | 205 | | |
195 | 206 | | |
196 | | - | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
197 | 213 | | |
198 | | - | |
199 | | - | |
200 | 214 | | |
201 | 215 | | |
202 | 216 | | |
| |||
335 | 349 | | |
336 | 350 | | |
337 | 351 | | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
338 | 383 | | |
339 | 384 | | |
340 | 385 | | |
| |||
351 | 396 | | |
352 | 397 | | |
353 | 398 | | |
354 | | - | |
355 | 399 | | |
356 | 400 | | |
357 | 401 | | |
| |||
368 | 412 | | |
369 | 413 | | |
370 | 414 | | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | 415 | | |
378 | 416 | | |
379 | 417 | | |
380 | 418 | | |
381 | 419 | | |
382 | | - | |
| 420 | + | |
383 | 421 | | |
384 | 422 | | |
385 | 423 | | |
386 | 424 | | |
387 | | - | |
| 425 | + | |
388 | 426 | | |
389 | 427 | | |
390 | | - | |
| 428 | + | |
391 | 429 | | |
392 | 430 | | |
393 | 431 | | |
394 | 432 | | |
395 | | - | |
| 433 | + | |
396 | 434 | | |
397 | 435 | | |
398 | 436 | | |
| |||
632 | 670 | | |
633 | 671 | | |
634 | 672 | | |
635 | | - | |
| 673 | + | |
636 | 674 | | |
637 | 675 | | |
638 | 676 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
25 | 51 | | |
26 | 52 | | |
27 | 53 | | |
| |||
0 commit comments