Name

RedBoot Extensions — Usage

Overview

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 192.168.1.100/24

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
                 Version = 1.2
                 CPU     = BCM2837 - Cortex-A53
                 RAM     = 1024MiB
                 Flags   = 07 Ethernet WiFi Bluetooth
Board Serial   = 000000009330d07b
MAC Address    = b8:27:eb:30:d0:7b
SDRAM Size     = 3e600000
DMA Channels   = 0 2 4 5 8 9 10 11 12 13 14
Temperatures:
       Current =  49.388 C
       Maximum =  85.000 C
Clocks:
       ARM     =  1200 MHz (min/orig/max: 600/600/1200 MHz)
       Core    =   400 MHz (min/orig/max: 250/250/400 MHz)
       Timer   =     1 MHz
       UART0   =    48 MHz
       EMMC    =   200 MHz
RedBoot>

And for a Pi0:

RedBoot> info
Board Model    = 00000000
Board Revision = 00900092
                 Model   = 0
                 Version = 1.2
                 CPU     = BCM2835 - ARM11
                 RAM     = 512MiB
                 Flags   = 00
Board Serial   = 00000000e868b4c6
MAC Address    = b8:27:eb:68:b4:c6
SDRAM Size     = 1f000000
DMA Channels   = 0 2 4 5 8 9 10 11 12 13 14
Temperatures:
       Current =  29.324 C
       Maximum =  85.000 C
Clocks:
       ARM     =  1000 MHz (min/orig/max: 700/700/1000 MHz)
       Core    =   400 MHz (min/orig/max: 250/250/400 MHz)
       Timer   =     1 MHz
       UART0   =    48 MHz
       EMMC    =   200 MHz
RedBoot>

FREQ Command

The freq command provides information and control over the ARM CPU frequency and the system CORE frequency. The -a option allows the ARM frequency to be changed and the -c option allows the system CORE frequency to be changed. In both cases the frequency is expressed in MHz. The command finishes by reporting the clock frequencies in the same format as the info command. For example on a Pi3:

RedBoot> freq

        Clocks:
       ARM     =  1200 MHz (min/orig/max: 600/600/1200 MHz)
       Core    =   400 MHz (min/orig/max: 250/250/400 MHz)
       Timer   =     1 MHz
       UART0   =    48 MHz
       EMMC    =   200 MHz
RedBoot> freq -a 800
Set ARM frequency to   800 MHz
Clocks:
       ARM     =   800 MHz (min/orig/max: 600/600/1200 MHz)
       Core    =   400 MHz (min/orig/max: 250/250/400 MHz)
       Timer   =     1 MHz
       UART0   =    48 MHz
       EMMC    =   200 MHz
RedBoot> freq -c 300
Set CORE frequency to   300 MHz
Clocks:
       ARM     =   800 MHz (min/orig/max: 600/600/1200 MHz)
       Core    =   300 MHz (min/orig/max: 250/250/400 MHz)
       Timer   =     1 MHz
       UART0   =    48 MHz
       EMMC    =   200 MHz
RedBoot>

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. Pins may be disabled by preceeding them with a hyphen; this puts the pin into GPIO input mode.

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)
TDI263747
TRST2215n/an/a
TDO2418529
TCK25221333
TMS27131232
RTCK2316631

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
PIN FUNC
 22 ARM_TRST
 23 ARM_RTCK
 24 ARM_TDO
 25 ARM_TCK
 26 ARM_TDI
 27 ARM_TMS

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.