Skip to main content.

1.11. Standalone Programs

U-Boot can dynamically load independent software modules, called "standalone programs". Standalone programs have a standard C calling environment, and can use standard services like printf(), malloc(), install_hdlr().

Used for:

Example:

#include <common.h>
#include <exports.h>

int hello_world (int argc, char *argv[])
{
        int i;
        app_startup(argv);
        printf ("Example expects ABI version %d\n", XF_VERSION);
        printf ("Actual U-Boot ABI version %d\n", (int)get_version());
        printf ("Hello World\n");
        printf ("argc = %d\n", argc);
        for (i=0; i<=argc; ++i) {
                printf ("argv[%d] = \"%s\"\n",
                        i,
                        argv[i] ? argv[i] : "<NULL>");
        }
        return (0);
}

Run:

=> tftp 40000 /tftpboot/hello_world.bin
...
=> go 40004 Hello World! This is a test.
## Starting application at 0x00040004 ...
Hello World
argc = 7
argv[0] = "40004"
argv[1] = "Hello"
argv[2] = "World!"
argv[3] = "This"
argv[4] = "is"
argv[5] = "a"
argv[6] = "test."
argv[7] = ""
## Application terminated, rc = 0x0
1.10. Command Interpreters 1. Abstract 1.12. Special Features
Prev Home Next