Page 403 - Programming Microcontrollers in C
P. 403

388    Chapter 7  Advanced Topics

                       0,        /* Timer channel 6 */
                       0,        /* Timer channel 5 */
                       0,        /* Timer channel 4 */
                       0,        /* Timer channel 3 */
                       0,        /* Timer channel 2 */
                       0,        /* Timer channel 1 */
                       0,        /* Timer channel 0 */
                       0,        /* Real time                */
                       0,        /* IRQ                      */
                       0,        /* XIRQ                     */
                       0,        /* SWI                      */
                       0,        /* illegal                  */
                       0,        /* cop fail                 */
                       0,        /* cop clock fail  */
                       _stext  /* RESET                      */
                       };
                              Listing 7-18: M68HC912B32 Vector Table

                              Listing 7-19 shows the next function that must be included for
                          operation on the M68HC12. This start-up program is named crts.s.
                          The .s extension indicates that the function is an assembly language
                          function. This is the sum total of all assembly code needed for the
                          program discussed in this chapter. Rather than give a line-by-line
                          description of the code, we will see that the initial portion of the
                          program initializes the section named bss to all zeros. This section
                          is where all static and external memory are stored. Then the stack
                          pointer is initialized to the value designated as __stack and then
                          control is passed to the function main(). If main() should return,
                          which it should not, the instruction following main() forms an
                          infinite loop that branches to itself and does nothing.

                   ;  C STARTUP FOR MC68HC12
                   ;  Copyright (c) 1996 by COSMIC Software
                   ;
                       xdef      _exit, __stext
                       xref      _main, __sbss, __memory, __stack
                   ;
                   __stext:
   398   399   400   401   402   403   404   405   406   407   408