The g command starts program execution.
g [-ste] [adr [bptadr]] [-c args]
where:
-s |
is a flag indicating that the stack pointer, sp,
should not be set
|
-t | is a flag that causes the execution time of the client program to be displayed in seconds. |
-e | changes behavior of 'adr' (below) so that the actual execution address is extracted from the image. |
adr | is the address of the first instruction to be executed. |
bptadr | is a breakpoint address where program execution is to be stopped. This breakpoint is removed the next time that execution halts. |
-c args | indicates that the argument or arguments args are to be passed to the client program. No more options to the g command itself can be given after this option. |
If the user specifies the -c option, the Monitor passes all arguments after -c to the client program by the following method. If -c is specified, the Monitor places the number of arguments (argc) in Register a0. The Monitor also places the address of an array of pointers to the command argument-strings in Register a1. The first element in the array pointed to by a1 contains a pointer to the string -c (the option on the command line). Note that if the -c is not specified, register a0 will be set to zero. The function declaration of the function called is thus:
FUNC(int argc, char **argv, char **envp);
If adr is specified, a temporary breakpoint (bptadr) may also be specified. The temporary breakpoint remains in effect only until the next time that program execution is halted. The character '.' may be used as a placeholder for the adr if you wish to specifiy a temporary breakpoint without specifying a start address.
If you use the standard start-up file for executing programs under the control of the PROM Monitor, the function main will receive three incoming arguments, argc, argv and envp, having the correct values to permit a program to read options from the command line, where argv[0] is a pointer to the string -c.
The -e option causes 'go' to examine the embedded execution address of an executable located at 'adr' and use that embedded address as the starting point. Such code must have a front-end that relocates the code before allowing the execution to begin at the new address. Running PMON from an alternate Flash ROM area is one of the most frequent instances where this feature is employed. During development of PMON/2000 for the PowerPC processors, we would cycle through the build, copy to tftpboot dir, boot -f (flash) and "g -e ff000100" process while testing. This allowed us to safely burn an image of PMON/2000 into the alternate flash ROM area without overwriting the primary flash ROM space. Of course, once a revision was to a point where happiness reigned....we would then burn it into the primary flash ROM space. Enjoy!
Examples illustrating the use of the g command follow.
PMON> g Start executing at the current value of the EPC register. PMON> g a0020000 Start executing at 0xa0020000. PMON> g a0020000 a0020008 Start executing at 0xa0020000 and break at 0xa0020008. PMON> g -e ff000100 Examine code at 'adr' (ff000100) and relocate it to the embedded execution address.
Navigation: Document Home | Document Contents | Document Index