You are on page 1of 8

REDBOOT PORTING TO ML403 POWERPC PLATFORM GUIDE

1. INTRODUCTION:

This guide take a brief how to compile and run RedBoot in the xilinx ML403 virtex4
PPC405 platform.

1.1 WHAT IS REDBOOT:

RedBoot is an opensource application that uses the eCos real-time operation system
Hardware Abstraction Layer (HAL) to provide bootrap firmware embedded system.
RedBoot is used in both product development and in deployed product in the field.

RedBoot allows download and execution of embedded applications via serial or


Ethernet, including embedded Linux and eCos applications. It provides debug support
in conjunction with GDB to allow developtmen and debugging of embedded
applications. It also provides interactive Command Line Interface (CLI) to allow
management of the Flash images, image download, RedBoot configuration, etc…
accessible via serial or Ethernet. For unattended or automated startup, boot scripts can
be stored in Flash to allowing for example loading of images from Flash, hard disk, or a
TFTP server.

2. TOOLS SETTING:

eCos tool is provided as a opensource software which can easily download from the
internet. Support in Window (cygwin) or Linux. eCos tool can be installed easily,
simply run a script file. However, after installing eCos tool, in many cases the
configtool and ecosconfig can not work properly in both Window and Linux. It means
that we need to rebuild and reinstall them again. Fortunately, the gnutools are working
fine, so we don’t need rebuild them. This guide show how to install and use ans run
these tool under window system.

Step 1 > Install Cygwin :

+ Download setup.exe from www.cygwin.org


+ Run setup.exe, chose download and install from internet, chose mirror …
+ Check some software packages:
- make, patch, cvs, wget, zip, tar…
- gcc, g++, glibc…

Please read Install Cygwin section for more detail


Step 2 > Install eCos Tools:

+ Open the cygwin shell command promt

$ cd /tmp
$ mkdir ecos
$ cd ecos
$ wget --passive-ftp ftp://ecos.sourceware.org/pub/ecos/ecos-install.tcl
$ sh ecos-install.tcl

* Note:

While running the script, if the “connection failed” error message occurs, we edit the
section “variable metadata_url” in the script file, just simply change the existence
mirrors. The eCos tool should be installed in /opt/ecos directory structure (recommend).

The installation result is following :


/opt
|___ ecos
|____ecos-2.0
|____gnutools
|____ecosenv.csh
|____ecosenv.sh

+ ecos-2.0 :
This is the eCos repository tree, is provided for application developtmen.
The current source can be downloaded from server by using CVS command. For the
purpose of RedBoot porting to ML403 we use another repository resource (discuss
later) instead of using ecos-2.0 from installation path.

+ gnutools:
Cross compiler support for some CPU architecture include : i386, arm, powerpc, sh,
mip… In this case we must use powerpc-eabi- for the Xilinx ML403 PPC405 platform.

+ ecosenv.csh, ecosenv.sh :
The shell scripts which are used for setup the PATH environment variable for ecos tool,
before using eCos tool we should run scripts by the following command:

$ cd /opt/ecos
$ sh ecosenv.sh
Now, let’s try the gnutools, create a simple hello.c program and compile it using the
powerpc-eabi cross tool:

$ nano hello.c
#include <stdio.h>
int main (int argc, char* argv[])
{
printf (“Hello World\n”);
return 0;
}

$ powerpc-eabi-gcc –o hello hello.c

If no error detected, our eCos tools setting steps are completed.

Step 3 > Install configtool:

As mentioned above, the configtool from installation path can not work properly. The
configtools is located under /opt/ecos/ecos-2.0/tools/configtool.exe. Affter invoking $
configtool from the cygwin commad shell, the “Segmentation fault (core dumped)”
error message may be occur. It’s painful job if we decide to rebuild this configtool
again.
Normally we’ll meet some error message when compile configtool source code,
because the cygwin lacks some libraries which are needed to compile confitool source
code.

Fortunately, eCos provides a separated config tool setup file for window. I tried to
download it from:

http://sources-redhat.oc1.mirrors.redwire.net/ecos/ct2/old/configtool-2.11-setup.exe

Run the configtool-2.11-setup.exe to install configtool, just install with all default
setting and start up this program from menu Start => Program => Red Hat eCos
Configuration Tool 2.11 => Configuration Tool ( Or click the configtool shotcut on the
desktop) , and no problem, it worked OK.

3. SET UP BUILD ENVIRONMENT:

This section show how to get repository source, patch file, and set up build
environment…

In the first step, we should create the directory structure for our job. It’s useful to make
a point of view of resource files clearly, avoid some undesired mistakes…
For example, we create the resource tree by the following directory structure:

/usr/src/env
|___ download
|___ ecos-anoncvs
| |___ ecos
| |____ demo
| |____ packages
| |____ ….
|
|___ ml403-redboot
|___ bsp
|___ ml403-redboot_build
|___ ml403-redboot_install
|___ ml403-redboot_mlt
|___ ml403-redboot.ecc

+ download :
The downloaded repository resource, patch files… should be stored in here

+ ecos-anoncvs:
The ecos repository

+ ml403-redboot :
Our RedBoot project is stored in here

+ bsp :
This bsp is generated by the Xilinx EDK tool for ML403 PPC hardware level
description, such as xparameter.h, libxil.a …

+ ml403-redboot_build:
Project build directory, which is automatically generated by configtool

+ ml403-redboot_install
Libararies are generated and stored in here , which is automatically generated by
configtool.

+ ml403-redboot_mlt

+ ml403-redboot.ecc
Our project file.
Step 1 > Create Directory Structure :

$ cd
$ mkdir -p /usr/src/env/download
$ cd /usr/src/env
$ mkdir –p ml403-redboot/bsp

Step 2 > Download ecos repository resource, ml403 patch file:

$ cd /usr/src/env/download
$ wget “ecos-source-url”
$ wget “ml403-patch-url”
$ wget “xparameters-translation.h-url”

+ ecos-source-url:
http://typo3.cs.uni-paderborn.de/fileadmin/Informatik/AG-Platzner/Research/ReconOS/eCos-
ML403/ecos-anoncvs_20060628.tar.bz2

+ ml403-patch-url:
http://typo3.cs.uni-paderborn.de/fileadmin/Informatik/AG-Platzner/Research/ReconOS/eCos-
ML403/ecos-ml403_20060628.patch

+ xparameters-translation.h-url:
http://typo3.cs.uni-paderborn.de/fileadmin/Informatik/AG-Platzner/Research/ReconOS/eCos-
ML403/xparameters_translation.h

Step 3 > Decompress ecos repository resource, pacth file…:

$ cd /usr/src/env
$ tar -jxvf download/ecos-anoncvs_20060628.tar.bz2
$ cat download/ecos-ml403_20060628.patch | patch -d ecos-anoncvs -p1

Step 4 > Copy bsp folder, libraries, header file:

The ML403 bsp is generated by the Xilinx EDK tool (discuss later), and it’s located in
the folder ppc405_0, so we must copy this folder into the bsp folder. Then, copy the
xparameters-translation.h to bsp/ppc405_0/include:

$ cp download/xparameters_translation.h ml403-redboot/bsp/ppc405_0/include

All header file in the bsp/ppc405_0/include should be converted to UNIX file format
before compiling RedBoot source code. To do that, in the cygwin command shell, just
simply type dos2unix command:

$ dos2unix ml403-redboot/bsp/ppc405_0/include/*.*
Step 5 > Set up RedBoot source, lib, Makefile using configtool:

On desktop, click the icon shotcut to start configtool:

+ From menu bar : Build => Repository => Browse


At here, we point to the eCos repository resource by the following path:
c:\cygwin\usr\src\env\ecos-anoncvs\ecos

+ From menu bar : Build => Templates


Hardware : XILINX VIRTEX4 PowerPC 405
Packages : redboot
Click next to pass through the Resolve conflicts dialog.

+ From menu bar : Tools => Paths => Build Tools


Point to the gnu ppc cross compile tool by the following path:
c:\cygwin\opt\ecos\gnutools\powerpc-eabi\bin

+ From menu bar : Tools => Paths => User Tools


Point to the cygwin shell command by the following path:
c:\cygwin\bin

+ From menu bar : File => Import


Point to the redboot_ROMRAM.ecm (eCos minimal Configuration) by the following
path:
c:\cygwin\usr\src\env\ecos-anoncvs\ecos\packages\hal\powerpc\virtex4\current\misc
Click next to pass through the Resolve conflicts dialog.

+ From menu bar : File => Save


Save the project as the name “ml403-redboot.ecc” in the following path:
c:\cygwin\usr\src\env\ml403-redboot

+ From menu bar : Build => Generate Build Tree


The configtool will generate 3 folders under ml403-redboot directory:
- ml403-redboot_build
- ml403-redboot_install
- ml403-redboot_mlt

+ Coppy the libxil.a from bsp to ml403-redboot_build/lib folder

$ cd /usr/src/env
$ cp ml403-redboot/bsp/ppc405_0/lib/libxil.a \
ml403-redboot/ml403-redboot_install/lib
+ Edit the linker script in ml403-redboot_install/lib/target.ld :
Adding libxil.a to the list of libraries in the GROUP section.
(Note: If the target.ld does not exis, we precompile the source by the following step 6,
configtool will generate this file automatically, so we edit the target.ld and recompile
the source again)

+ In the Configuration drop list of the configtool : click the “+” sympol to expand :
eCos HAL => PowerPC architecture => XILINX VIRTEX4 (PowerPC 405) board
check to enable the following fields:
- UART IP core support
- Ethernet MAC IP core support
- Support SysACE drive via RedBoot
- II2 IP core support
- Xilinx VIRTEX4 I2C controller support
- Xilinx VIRTEX4 GPIO support
- SystemACE support

* Note:

Before compiling the source :


- Run ecosenv.sh script
- The HW_DESIGN environment variable must be defined
- Be careful when changing the address map of the Xilinx reference design, some
elements (e.g hal/powerpc/virtex4/src/gpip_basic.c and char_lcd_support.c) used
hard-coded base addresses.

Step 6 > Compile the RedBoot source:

$ cd /usr/src/env/ml403-redboot/ml403-redboot_build
$ export HW_DESIGN=/usr/src/env/ml403-redboot/bsp
$ make

The downloaded
4. IMPLEMENTATION :
5. CONCLUTION:
6. NONE
7. NONE
8. NONE

You might also like