Name

Setup — Preparing for eCos Development

Overview

In a typical development environment, the VM boots into the RedBoot ROM monitor. eCos applications are configured for RAM startup and then downloaded and run on the board via the debugger arm-eabi-gdb. Preparing the VM therefore usually involves arranging for a suitable RedBoot image to be executed on startup.

Xvisor VM Installation

This section describes how to install RedBoot into an Xvisor guest VM and start it running. The reader should be familiar with Xvisor, how to install it onto a target platform and how, in general, a guest VM is created.

To create an eCos VM under Xvisor, it is necessary to instantiate a virtual machine, populate it with the executable of RedBoot, and then set it running. To do this a number of files are copied to the etc directory of a RedBoot installation which are used set up a VM to run eCos. These files are as follows:

evm.dts
This is a Linux device tree source file. It needs to be compiled into a device tree binary file using the dtc device tree compiler. This file is specific to use on Rockchip-based boards such as the Pine Rockpro64 or M2000.
boot.xscript
This is a sample Xvisor boot script that instantiates a Linux guest together with a eCos VM running RedBoot. It may be used as it is, or used as a template for your own script.
nor_flash.list
A list of addresses and file names used to populate the virtual flash in a VM. This defines the software that will run from reset in the VM. In this case the sole entry installs a binary of RedBoot at the start of flash.
install
A shell script that automates the installation of a RedBoot executable into a Xvisor disk image. It creates the necessary sub-directory in the disk image, compiles and installs the device tree, RedBoot binary and flash list. It does not copy the boot.xscript file, which may be copied separately if required. Following this, a make should be run in the Xvisor build directory to rebuild the disk image. The image may then be transferred to the target system bootstrap medium.

See the next section, Rebuilding RedBoot, for an example of using the install script to install RedBoot into an Xvisor VM.

Once the files are installed, Xvisor may be started and the eCos VM will be executed. Depending on the default setting for the initial serial connection, and whether the boot.xscript file has been copied, you may see a startup banner from RedBoot similar to the following:

XVisor# vserial bind evm1/uart0
[evm1/uart0] +No network interfaces found

RedBoot(tm) bootstrap and debug environment [ROM]
Non-certified release, version UNKNOWN - built 14:58:47, Jan 30 2020

Copyright (C) 2000-2009 Free Software Foundation, Inc.
Copyright (C) 2003-2019 eCosCentric Limited
The RedBoot bootloader is a component of the eCos real-time operating system.
Want to know more? Visit www.ecoscentric.com for everything eCos & RedBoot related.
This is free software, covered by the eCosPro Non-Commercial Public License
and eCos Public License. You are welcome to change it and/or distribute copies
of it under certain conditions. Under the license terms, RedBoot's source code
and full license terms must have been made available to you.
Redboot comes with ABSOLUTELY NO WARRANTY.

Platform: Virtual ARM (CORTEX-A)
RAM: 0x40000000-0x42000000 [0x40030000-0x42000000 available]
RedBoot>
      

Rebuilding RedBoot

Typical users should never need to rebuild RedBoot. If you do intend to modify RedBoot then please note that rebuilding it is currently only supported from the Linux command line.

The steps needed to rebuild the ROM version of RedBoot are:

$ mkdir redboot_virtual_rom
$ cd redboot_virtual_rom
$ ecosconfig new virtual_xvisor redboot
$ ecosconfig import $ECOS_REPOSITORY/hal/arm/cortexa/virtual/VERSION/misc/redboot_ROM.ecm
$ ecosconfig resolve
$ ecosconfig tree
$ make
        

At the end of the build the install/bin subdirectory should contain the file redboot.bin. This image can now be installed into an Xvisor boot disk image using the install script. Assuming the root directory for Xvisor is in $XVISOR the following commands will do this.

$ cd install
$ ./etc/install $XVISOR/disk

Install RedBoot in disk image

Done
$
        

If required, boot.xscript may also be copied into $XVISOR/disk.

For convenience, eCosPro releases include a prebuilt RedBoot image as well as the install subdirectory resulting from the creation of RedBoot. These are located within the loaders sub-directory of the eCosPro installation, and the install script may be run from within these subdirectories. For example:

$ cd ecos-4.4.0/loaders/virtual_xvisor/redboot_ROM.install
$ ./etc/install $XVISOR/disk

Install RedBoot in disk image

Done
$
        

It is now necessary to rebuild the Xvisor RAM disk. Exactly how this is done can depend on the target host, how it boots and how that RAM disk is loaded. Usually this involves using genext2fs to make a disk image; usually an Xvisor executable and a device tree are also created. Refer to the directions for installing Xvisor on the host for details.