comparison gsm-fw/lldbg/README @ 865:f5affe83ba2d

lldbg hack (poor girl's substitute for JTAG) implemented
author Space Falcon <falcon@ivan.Harhan.ORG>
date Fri, 15 May 2015 00:02:03 +0000
parents
children
comparison
equal deleted inserted replaced
864:4fa939eada22 865:f5affe83ba2d
1 The hack implemented in this directory is a poor girl's substitute for JTAG,
2 concocted for the purpose of debugging hard crashes in the firmware. The
3 intended usage is that the developer seeking to troubleshoot perplexing
4 misbehavior in the firmware inserts a call to lldbg_entry() as a form of
5 breakpoint at the earliest place in the main fw where it is seen that something
6 has gone astray, and when the thread of code execution hits this lldbg_entry()
7 function, the regular Nucleus environment gets completely frozen. Lldbg entry
8 code saves all registers and the return address (LR) on whatever stack it is
9 was called on, then disables all interrupts and switches to its own stack which
10 is not used by any other part of the fw.
11
12 This lldbg code is linked together with the main fw when feature lldbg is
13 enabled in build.conf, but it stands as its own separate body. All functions
14 and variables within lldbg are prefixed with lldbg_ to avoid any clashes, and
15 once this lldbg code gains control, it does everything on its own without making
16 use of *any* part of the regular fw. The code that forms lldbg is based on
17 FreeCalypso target-utils (loadagent) and is fully independent of the regular fw.
18
19 Lldbg uses its own UART input and output code as well: the entry code waits for
20 any previous output (presumably RVTMUX) to go out, then sends out an STX-wrapped
21 message to make the lldbg entry visible in rvtdump/rvinterf, preceded by 3 STX
22 characters to terminate any RVTMUX packet in progress. From this point onward
23 all further communication is done in an ASCII terminal fashion: upon seeing the
24 lldbg entry message, the user needs to kill rvtdump/rvinterf and switch to
25 fc-serterm. All lldbg code runs with interrupts disabled, thus UART input and
26 output are polled.
27
28 Once in lldbg mode, the user (developer) can execute various memory dump
29 commands to see the frozen state of the fw upon lldbg entry, and hopefully
30 figure out what went wrong earlier.