Arpith Chacko Jacob - since 1982...

  Adding user applications into the uClinux distribution

Saturday 24th 2004f July 2004, 08:45:16 am. Posted in: Embedded. 543 words.  

This article details the steps that need to be followed to add a user application to the uClinux build process. Upon building the uClinux distribution, the executable is created and copied to the romfs directory which is included with the final image. After the target board boots up, the binary may be executed from the rom filesystem.

  1. In order to select the application during the uClinux configuration, (example: make xconfig) the file uClinux-dist/config/config.in must be modified.

    A new configuration option for the application may be added in an existing program group:

    ########################################

    mainmenu_option next_comment
    comment 'ACME Network Program Group'

    bool 'ACME Ping Program' CONFIG_USER_ACME_PING

    endmenu

    ####################################

    After doing a 'make xconfig' the selected options are saved in uClinux-dist/config/.config. The variable CONFIG_USER_ACME_PING is set to 'y' if the ping application is to be built during the build process. This variable must be unique to the application.

  2. The file uClinux-dist/config/Configure.help is modified to add a few lines describing the program. This information is displayed to the user upon clicking the help button in the configuration window.

    ACME Ping Program
    CONFIG_USER_ACME_PING
      ACM Ping program to ping and do various useful things. Select
      this option if you want to build ping.

    The first line is a general description of the program, followed by the variable used in config.in. The description must be indented by two spaces on each line and limited to 70 characters per line. Blank lines are not allowed in the description.

  3. A new directory, for example 'acme-ping', is created in uClinux-dist/user/ to store the application. The following lines are added to the file uClinux-dist/user/Makefile:

    dir_$(CONFIG_USER_ACME_PING) += acme-ping

    During the build process, the application is built if CONFIG_USER_ACME_PING is set to y in uClinux-dist/config/.config

  4. Finally a Makefile in the user application directory is created. It will likely need the targets: all, romfs and clean.

    EXEC = acme-ping
    OBJS = ping.o interface.o

    all: $(EXEC)

    $(EXEC): $(OBJS)
            $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)

    romfs:
            $(ROMFSINST) /bin/$(EXEC)

    clean:
            rm -f $(EXEC) .elf .gdb *.o

    'all' builds the application executable (acme-ping) in the application directory from the source files ping.c and interface.c. 'romfs' installs the application in the romfs directory and hence includes it in the final image. 'clean' removes all object and executable files from the application directory, and is used before a recompile.

    More complex Makefiles may also be written. For example if the user directory contains multiple applications in seperate subdirectories, the following lines of code may be added in the user directory, with each subdirectory having its own Makefile as detailed above:

    SUBDIRS = acme-ping acme-ftp

    all: subdirs

    subdirs:
            for i in $(SUBDIRS) ; do \
            ( cd $$i ; make ) ; \
            done

    romfs:
            for i in $(SUBDIRS) ; do \
            ( cd $$i ; make romfs ) ; \
            done

    clean:
            for i in $(SUBDIRS) ; do \
            ( cd $$i ; make clean ) ; \
            done

    For each application, two executables are created during the make process: a smaller sized executable file which runs on the target board, and a larger executable with debug information used for application debugging using GDB.

Run 'make xconfig; make dep; make' to create the final image to load on the target board.

Comments:

1

Very well Done !!! phentermine cheap ultram addiction buy xanax online

Posted by dianne [Visitor] · http://20six.nl/magnum at 08:28:02 am on April 04, 2006


Post a comment:

Name:

Email:

Your email address will not be displayed on this site.
Site/Url:

Comment text:

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, a, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
URLs, email, AIM and ICQs will be converted automatically.

Options:

Auto-BR
Remember me (Set cookies for name, email & url)