RedBoot Extensions — Usage


The Raspberry Pi version of RedBoot provides a number of extensions to the standard RedBoot behaviour. These include the execution of a startup script and some extra commands.

Startup Script

Unlike most RedBoot instances, the Raspberry Pi always has access to a storage device containing a file system. It is also useful for JTAG debugging to be able to have some dynamic hardware initialization. So, on startup RedBoot attempts to mount the boot partition on the SD card and execute the contents of a script file.

The script file is named redboot.txt and consists of a sequence of RedBoot commands separated by newlines. Blank lines are ignored. Comments are introduced by the a hash character (#) and extend to the end of the current line.

RedBoot waits 1 second before executing the script, during which time the user may type a Ctrl-C character to abort execution of the script. This time may be changed by rebuilding RedBoot with a different CYGNUM_REDBOOT_BOOT_SCRIPT_DEFAULT_TIMEOUT value.

Other ports of RedBoot are typically flash memory resident and use the flash as a persistant store for RedBoot configuration information and files. You will find these areas referred to as the fconfig area and flash image system (FIS) within the RedBoot documentation. As the redboot.txt script file can contain any standard RedBoot command, as well as the additional Raspberry Pi commands described below, you can use it to configure any settings that would normally be stored in the fconfig area. For example, you could set a static IP address for the board with the ip_address command:

ip_address -l

To modify the redboot.txt file simply mount the SD card on a PC. You will find redboot.txt in the root directory of the boot partition.

INFO Command

The info command provides information about the current Raspberry Pi board. RedBoot, and eCos, discover the type of board and its properties at runtime. This command reports what has been found out. As an example, the output for a Pi3 would appear as follows:

RedBoot> info
Board Model    = 00000000
Board Revision = 00a02082
                 Model   = B3
                 CPU     = BCM2837 - Cortex-A53
                 RAM     = 1024MiB
                 Flags   = 07 Ethernet WiFi Bluetooth
Board Serial   = 000000009330d07b
MAC Address    = b8:27:eb:30:d0:7b
SDRAM Size     = 3d000000
       ARM     =     600000000 Hz
       Core    =     250000000 Hz
       Timer   =       1000000 Hz
       UART0   =      48000000 Hz
       EMMC    =     250000000 Hz

And for a CM1:

RedBoot> info
Board Model    = 00000000
Board Revision = 00000011
                 Model   = CM1
                 CPU     = BCM2835 - ARM11
                 RAM     = 512MiB
                 Flags   = 08 eMMC
Board Serial   = 00000000604ab22b
MAC Address    = b8:27:eb:4a:b2:2b
SDRAM Size     = 1e000000
       ARM     =     700000000 Hz
       Core    =     250000000 Hz
       Timer   =       1000000 Hz
       UART0   =      48000000 Hz
       EMMC    =     250000000 Hz

GPIO Command

The gpio command provides information and control of the GPIO pins available in the BCM283X. The command supports a number of sub-commands:

gpio get [pin]
Print the state of a given GPIO pin, or if no pin is given, it prints the state of all pins. The information printed for each pin includes the alternate function value and the name of the function selected, mode setting bits, and the current input level.
gpio in <pin>
Reports the current input level of the pin, 0 or 1.
gpio monitor [-m <msec>] <pin>
Monitor a given pin for changes and print the value every second. The -m option allows the monitoring interval to be changed to the given number of milliseconds.
gpio out -0|-1 <pin>
Set the output of the given pin to 0 (-0) or 1 (-1). The pin may need to be set to output mode with gpio set before any effect can be seen.
gpio set [-i|-o|-a <alt>] <pin>
Set the function of a given pin. It can be set to INPUT with the -i option, OUTPUT with the -o option or to one of six alternate function with the -a option.
gpio table
Print a table of all GPIO pins and the names of the alternate functions they can take. The current setting of the pin is indicated by an asterisk against the relevant alternate setting. If no asterisk is present then the pin is in GPIO mode.
gpio toggle [-m <msec>] <pin>
Toggle a pin at a 1 second period with a 50% duty cycle. The -m option allows the toggling to occur with the given period in milliseconds. The pin may need to be set to output mode with gpio set before any effect can be seen.

JTAG Command

The jtag command provides direct support for setting up the JTAG debug pins and querying their state. The arguments to this command are a list of pin numbers. Each of these GPIO pins is put into its JTAG function. Only those pins that can be used for JTAG operation may be entered; at present these are GPIO4 to GPIO6, GPIO12, GPIO13 and GPIO22 to GPIO27. On completion the command lists the pins that are in JTAG mode. If no pins are given, then the current JTAG pin assignments are listed. There is no mechanism for disabling a JTAG pin, if it is to be used for some other purpose then it will be reinitialized as part of that functionality.

The selection of JTAG pins to use may depend on the functionality of any HATs or other hardware attached to the GPIO header. It may be necessary to mix and match pins to get a complete set. In some situations it may not be possible to find a set of pins that will work, in which case you may need to use serial debugging only.

The following table defines the possible GPIO pin alternatives for the JTAG signals, as well as their mapping on to the 40-way expansion bus used on standard RPi boards. Each JTAG signal has two alternative mappings, apart from TRST which can only be set to GPIO pin 22. Note that RTCK is not required or supported by all JTAG debuggers and may not need to be set.

JTAG SignalAlt 4 GPIO pin(Alt 4 40-way pin)Alt 5 GPIO pin(Alt 5 40-way pin)

For example, the jtag command used in the default redboot.txt file, sets and reports the BCM pins as follows:

RedBoot> jtag 4 22 24 25 27

LED Command

The led command controls the behaviour of the board's ACT LED. By default RedBoot blinks the LED at 1 Hz with a 50% duty cycle; this serves as an indicator that RedBoot is up and running when the serial line is not connected. It takes one of three argument values. on disables blinking and switches the LED on. off also disables blinking and switches the LED off. blink re-enables the 1Hz blinking. Note that these setting only apply when RedBoot is running. Once and application has been loaded and is running, control of the LED passes to it.

USB Command

The usb command prints out some information from the USB stack. This includes some gathered statistics and information on each of the USB devices currently attached to the USB bus.