The Application start() Functionstart() Function

The Application start() Function

The entry point of a simple application is typically called start . When booting an application through MicroMonitor, start can immediately be a C function. The address of start is the entry point that the monitor calls after the application is loaded. A typical start() function is shown in Listing 11.5.

Listing 11.5: A Typical start() Function.
image from book
 #include "monlib.h" int start(void) {     char    **argv;     int     argc;     /* Connect the application to the monitor.  This must be done      * prior to the application making any other attempts to use the      * "mon_" functions provided by the monitor.      */     monConnect((int(*)())(*(unsigned long *)0xfffc0000),(void *)0,(void *)0);     /* Extract argc/argv from structure and call main(): */     mon_getargv(&argc,&argv);     /* Call main, then return to monitor. */     return(main(argc,argv)); } 
image from book
 

Notice in Listing 11.5 that the application doesnt even need to initialize its own .bss space. When MicroMonitor loads the application from flash to RAM, it has access to the memory map of the application and can automatically clear all .bss sections of the application prior to transferring control to the entry point.



Embedded Systems Firmware Demystified
Embedded Systems Firmware Demystified (With CD-ROM)
ISBN: 1578200997
EAN: 2147483647
Year: 2002
Pages: 118
Authors: Ed Sutter

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net