eCos Reference Manual
Prev | Chapter 2. RedBoot Commands and Examples | Next

# Persistent State Flash-based Configuration and Control

RedBoot provides flash management support for storage in the flash memory of multiple executable images and of non-volatile information such as IP addresses and other network information.

RedBoot on platforms that support flash based configuration information will report the following message the first time that RedBoot is booted on the target:

    flash configuration checksum error or invalid key

This error can be ignored if no flash based configuration is desired, or can be silenced by running the fconfig command as described below. At this point you may also wish to run the fis init command. See other fis commands in the Section called Flash Image System (FIS).

Certain control and configuration information used by RedBoot can be stored in flash.

The details of what information is maintained in flash differ, based on the platform and the configuration. However, the basic operation used to maintain this information is the same. Using the fconfig -l command, the information may be displayed and/or changed.

If the optional flag `-i` is specified, then the configuration database will be reset to its default state. This is also needed the first time RedBoot is installed on the target, or when updating to a newer RedBoot with different configuration keys.

If the optional flag `-l` is specified, the configuration data is simply listed. Otherwise, each configuration parameter will be displayed and you are given a chance to change it. The entire value must be typed - typing just carriage return will leave a value unchanged. Boolean values may be entered using the first letter (`t` for true, `f` for false). At any time the editing process may be stopped simply by entering a period (.) on the line. Entering the caret (^) moves the editing back to the previous item. See “RedBoot Editing Commands”, the Section called RedBoot Editing Commands in Chapter 1.

If any changes are made in the configuration, then the updated data will be written back to flash after getting acknowledgment from the user.

If the optional flag `-n` is specified (with or without `-l`) then “nicknames” of the entries are used. These are shorter and less descriptive than “full” names. The full name may also be displayed by adding the `-f` flag.

The reason for telling you nicknames is that a quick way to set a single entry is provided, using the format

      RedBoot> fconfig nickname value

If no value is supplied, the command will list and prompt for only that entry. If a value is supplied, then the entry will be set to that value. You will be prompted whether to write the new information into flash if any change was made. For example

      RedBoot> fconfig -l -n
      boot_script: false
      bootp: false
      bootp_my_ip: 10.16.19.176
      bootp_server_ip: 10.16.19.66
      dns_ip: 10.16.19.1
      gdb_port: 9000
      net_debug: false
      RedBoot> fconfig bootp_my_ip 10.16.19.177
      bootp_my_ip: 10.16.19.176 Setting to 10.16.19.177
      Update RedBoot non-volatile configuration - continue (y/n)? y
      ... Unlock from 0x507c0000-0x507e0000: .
      ... Erase from 0x507c0000-0x507e0000: .
      ... Program from 0x0000a8d0-0x0000acd0 at 0x507c0000: .
      ... Lock from 0x507c0000-0x507e0000: .
      RedBoot>

Additionally, nicknames can be used like aliases via the format %{nickname}. This allows the values stored by `fconfig` to be used directly by scripts and commands.

Depending on how your terminal program is connected and its capabilities, you might find that you are unable to use line-editing to delete the ‘old’ value when using the default behaviour of fconfig `nickname` or just plain fconfig, as shown in this example:

    RedBoot> fco bootp
    bootp: false_

The user deletes the word “false;” and enters “true” so the display looks like this:

    RedBoot> fco bootp
    bootp: true
    Update RedBoot non-volatile configuration - continue (y/n)? y
    ... Unlock from ...
    RedBoot> _

To edit when you cannot backspace, use the optional flag `-d` (for “dumb terminal”) to provide a simpler interface thus:

    RedBoot> fco -d bootp
    bootp: false ? _

and you enter the value in the obvious manner thus:

    RedBoot> fco -d bootp
    bootp: false ? true
    Update RedBoot non-volatile configuration - continue (y/n)? y
    ... Unlock from ...
    RedBoot> _

One item which is always present in the configuration data is the ability to execute a script at boot time. A sequence of RedBoot commands can be entered which will be executed when the system starts up. Optionally, a time-out period can be provided which allows the user to abort the startup script and proceed with normal command processing from the console.

    RedBoot> fconfig -l
    Run script at boot: false
    Use BOOTP for network configuration: false
    Local IP address: 192.168.1.29
    Default server IP address: 192.168.1.101
    DNS server IP address: 192.168.1.1
    GDB connection port: 9000
    Network debug at boot time: false

The following example sets a boot script and then shows it running.

    RedBoot> fconfig
    Run script at boot: false t
          Boot script:
    Enter script, terminate with empty line
    >> fi li
        Boot script timeout: 0 10
    Use BOOTP for network configuration: false .
    Update RedBoot non-volatile configuration - continue (y/n)? y
    ... Erase from 0xa0fc0000-0xa0fe0000: .
    ... Program from 0x8c021f60-0x8c022360 at 0xa0fc0000: .
    RedBoot>
    RedBoot(tm) debug environment - built 08:22:24, Aug 23 2000
    Copyright (C) 2000, Red Hat, Inc.

    RAM: 0x8c000000-0x8c800000
    flash: 0xa0000000 - 0xa1000000, 128 blocks of 0x00020000 bytes ea.
    Socket Communications, Inc: Low Power Ethernet CF Revision C \
    5V/3.3V 08/27/98 IP: 192.168.1.29, Default server: 192.168.1.101 \
    == Executing boot script in 10 seconds - enter ^C to abort
    RedBoot> fi li
    Name              flash addr   Mem addr    Length    Entry point
    RedBoot          0xA0000000   0xA0000000  0x020000  0x80000000
    RedBoot config   0xA0FC0000   0xA0FC0000  0x020000  0x00000000
    FIS directory    0xA0FE0000   0xA0FE0000  0x020000  0x00000000
    RedBoot>

> NOTE: The bold characters above indicate where something was entered on the console. As you can see, the fi li command at the end came from the script, not the console. Once the script is executed, command processing reverts to the console.

> NOTE: RedBoot supports the notion of a boot script timeout, i.e. a period of time that RedBoot waits before executing the boot time script. This period is primarily to allow the possibility of canceling the script. Since a timeout value of zero (0) seconds would never allow the script to be aborted or canceled, this value is not allowed. If the timeout value is zero, then RedBoot will abort the script execution immediately.

On many targets, RedBoot may be configured to run from ROM or it may be configured to run from RAM. Other configurations are also possible. All RedBoot configurations will execute the boot script, but in certain cases it may be desirable to limit the execution of certain script commands to one RedBoot configuration or the other. This can be accomplished by prepending `{<startup type>}` to the commands which should be executed only by the RedBoot configured for the specified startup type. The following boot script illustrates this concept by having the ROM based RedBoot load and run the RAM based RedBoot. The RAM based RedBoot will then list flash images.

    RedBoot> fco
    Run script at boot: false t
    Boot script:
    Enter script, terminate with empty line
    >> {ROM}fis load RedBoot[RAM]
    >> {ROM}go
    >> {RAM}fis li
    >>
    Boot script timeout (1000ms resolution): 2
    Use BOOTP for network configuration: false
     ...
    Update RedBoot non-volatile configuration - continue (y/n)? y
    ... Unlock from 0x007c0000-0x007e0000: .
    ... Erase from 0x007c0000-0x007e0000: .
    ... Program from 0xa0015030-0xa0016030 at 0x007df000: .
    ... Lock from 0x007c0000-0x007e0000: .
    RedBoot> reset
    ... Resetting.
    +Ethernet eth0: MAC address 00:80:4d:46:01:05
    IP: 192.168.1.153, Default server: 192.168.1.10

    RedBoot(tm) bootstrap and debug environment [ROM]
    Red Hat certified release, version R1.xx - built 17:37:36, Aug 14 2001

    Platform: IQ80310 (XScale)
    Copyright (C) 2000, 2001, Red Hat, Inc.

    RAM: 0xa0000000-0xa2000000, 0xa001b088-0xa1fdf000 available
    FLASH: 0x00000000 - 0x00800000, 64 blocks of 0x00020000 bytes each.
    == Executing boot script in 2.000 seconds - enter ^C to abort
    RedBoot> fis load RedBoot[RAM]
    RedBoot> go
    +Ethernet eth0: MAC address 00:80:4d:46:01:05
    IP: 192.168.1.153, Default server: 192.168.1.10

    RedBoot(tm) bootstrap and debug environment [RAM]
    Red Hat certified release, version R1.xx - built 13:03:47, Aug 14 2001

    Platform: IQ80310 (XScale)
    Copyright (C) 2000, 2001, Red Hat, Inc.

    RAM: 0xa0000000-0xa2000000, 0xa0057fe8-0xa1fdf000 available
    FLASH: 0x00000000 - 0x00800000, 64 blocks of 0x00020000 bytes each.
    == Executing boot script in 2.000 seconds - enter ^C to abort
    RedBoot> fis li
    Name              FLASH addr  Mem addr    Length      Entry point
    RedBoot           0x00000000  0x00000000  0x00040000  0x00002000
    RedBoot config    0x007DF000  0x007DF000  0x00001000  0x00000000
    FIS directory     0x007E0000  0x007E0000  0x00020000  0x00000000
    RedBoot>

Prev | Home | Next
fis write | Up | Executing Programs from RedBoot