RTEMS Logo

RTEMS 4.9.1 On-Line Library


Configuration and Initialization Attached to a Serial Port

PREV UP NEXT Bookshelf RTEMS Shell User's Guide

1.3.1: Attached to a Serial Port

Starting the shell attached to the console or a serial port is very simple. The user invokes rtems_shell_init with parameters to indicate the characteristics of the task that will be executing the shell including name, stack size, and priority. The user also specifies the device that the shell is to be attached to.

This example is taken from the fileio sample test. This shell portion of this test can be run on any target which provides a console with input and output capabilities. It does not include any commands which cannot be supported on all BSPs. The source code for this test is in testsuites/samples/fileio with the shell configuration in the init.c file.

#include <rtems/shell.h>

void start_shell(void)
{
  printf(" =========================\n");
  printf(" starting shell\n");
  printf(" =========================\n");
  rtems_shell_init(
    "SHLL",                        /* task name */
    RTEMS_MINIMUM_STACK_SIZE * 4,  /* task stack size */
    100,                           /* task priority */
    "/dev/console",                /* device name */
    0,                             /* run forever */
    1                              /* wait for shell to terminate */
  );
}

In the above example, the call to rtems_shell_init spawns a task to run the RTEMS Shell attached to /dev/console and executing at priority 100. The caller suspends itself and lets the shell take over the console device. When the shell is exited by the user, then control returns to the caller.


PREV UP NEXT Bookshelf RTEMS Shell User's Guide

Copyright © 1988-2008 OAR Corporation