OAR

RTEMS 4.5.1-pre3 On-Line Library


Writing an Application

PREV UP NEXT Bookshelf Getting Started with RTEMS for C/C++ Users

7.2: Writing an Application

From an application author's perspective, RTEMS applications do not start at main(). They begin execution at one or more application initialization task or thread and main() is owned by the Board Support Package. Each API supported by RTEMS (Classic, POSIX, and ITRON) allows the user to configure a set of tasks that are created and started automatically during RTEMS initialization. The RTEMS Automatic Configuration Generation (confdefs.h) scheme can be used to easily generate the configuration information for an application that starts with a single initialization task. By convention, unless overridden, the default name of the initialization task varies based up API.

See the Configuring a System chapter in the C User's Guide for more details.

Regardless of the API used, when the initialization task executes, all non-networking device drivers are normally initialized and processor interrupts are enabled. The initialization task then goes about its business of performing application specific initialization. This often involves creating tasks and other system resources such as semaphores or message queues and allocating memory. In the RTEMS examples and tests, the file init.c usually contains the initialization task. Although not required, in most of the examples, the initialization task completes by deleting itself.

As you begin to write RTEMS application code, you may be confused by the range of alternatives. Supporting multiple tasking APIs can make the choices confusing. Many application groups writing new code choose one of the APIs as their primary API and only use services from the others if nothing comparable is in their preferred one. However, the support for multiple APIs is a powerful feature when integrating code from multiple sources. You can write new code using POSIX services and still use services written in terms of the other APIs. Moreover, by adding support for yet another API, one could provide the infrastructure required to migrate from a legacy RTOS with a non-standard API to an API like POSIX.


PREV UP NEXT Bookshelf Getting Started with RTEMS for C/C++ Users

Copyright © 1988-2000 OAR Corporation