Page 84 - The Art of Designing Embedded Systems
P. 84

Real Time Means Right Now!  71










         -00432  03f80333    d88e  MOV DS,BX
        '-00431 03f80335       55  PUSH EBF
        'CDEMON:   269    mme-led{  1,
        ,-00430 03f80336 ffff62eB  CALL NEAR PTR CS:-158
        CDEMON'   355 void mme-led{ 1
        1-00417  03f8029d      56  PUSH ESI
        1-00415  03f8029e      57   PUSH ED1
        &DEMON'   364                                 ; I  c  e:  maskbi
        :-00415 03f8029f       be   MOV ES1,SOO
        E-00408 03f802a4       31   XOR  DI,DI
                               eb   JMP  SHORT  41
                               83   CMP  EDI.SO8
        1-00402  03f802d4    d27c   JL  SHORT  -46
        CDEMON    366         led port[i++]  =  '1';
        I 1-0039'3  03f 802a8   f9S9-  MOV CX,DI










       FIGURE 4-6  ISR trace collection on an emulator.


            Are the triggers a pain to set up? Most emulators offer special menus
       with dozens of trigger configuration options. Although this is essential for
       finding the most obscure bugs, it is just too much work for the usual de-
       bugging scenario, where you simply want to start collection when source
       module  line  124 executes.  Simple triggers  should  be  as convenient  as
       breakpoints, set perhaps via a right mouse click.
            The moral is: trace is the right debugging tool, but keep ISRs simple.
       Minimize their complexity to maximize their debuggability.


            Easy ISR Debugging
            What's the fastest way to debug an ISR?
            Don't.
            If your ISR is only 10 or 20 lines of code, debug by inspection. Don't
       fire up all kinds of complex and unpredictable tools.
            Keep the handler simple and short. If it fails to operate correctly, a
       few minutes reading the code will usually uncover the problem.
   79   80   81   82   83   84   85   86   87   88   89