| ||
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.
#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)); }
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.
| ||