eCos Product

eCos Net Distribution


RedBoot Product
 
RedBoot Net Distribution


Supported Hardware

Downloading and Installation

Documentation

FAQ

Keeping in Touch

Problems

Licensing

Anonymous CVS

Contributions and Third Party Projects

Red Hat eCos

RedBoot Commands


It's possible to add platform specific RedBoot commands using the macro RedBoot_cmd defined in <redboot.h>. This is an example from the Assabet platform HAL:

 RedBoot_cmd("exec", 
            "Execute an image - with MMU off", 
            "[-w timeout] []",
            do_exec
    );

 static void 
 do_exec(int argc, char *argv[])
 {
   ...
 }

This adds the command 'exec', the associated help strings and a pointer to the actual command implementation.

RedBoot provides two commands, init_opts() and scan_opts(), which are used to parse the options passed to the command.

init_opts()
This is used to fill in the option structures - these are only required if there are more than one option though.

Each option is defined by the character used to identify it, a type, a flag identifying whether it takes an argument, a pointer to the variable which will hold the parsed value, and a pointer to a boolean flag which gets set if the option was used on a parsed command line.

scan_opts()
This is used to do the actual parsing. It will use information prepared by init_opts() to parse the command line, filling out variables associated with options if these appear on the command line.

This call also allows for handling of a default argument, which is what remains on the command line after all options are parsed.

Look in the source files for usage examples of the two functions.