RedBoot for the EDB7xxx
=======================

Target
------

This document describes using RedBoot with the Cirrus Logic ARM-based
EDB7xxx evaluation boards.

Installation on the Target Board
--------------------------------

Copy the two '.srec' files to /tftpboot or where-ever they have to be for
your tftp server.

Briefly, we use whatever boot flash image you have in place already (CygMon
or an eCos stub ROM) along with GDB, to execute a RAM based version of
RedBoot.  That is used, in its command-line mode, to fetch a ROM-based boot
image of RedBoot and write it into the flash memory.  "Fetching" the image
means tftp from a server; the image must be in S-Record format.  We then
reset the target, thus running the newly-installed boot image of RedBoot.
That in turn is used, in its command-line mode, to fetch a RAM-based boot
image of RedBoot and write it into a different area of the flash memory, in
order to make it easier to do the first part (running a RAM-based RedBoot
in order to update the boot block) again in future.

1. Program RedBoot image into FLASH:

   Using the 'dl_edb7xxx' tool (or it's Windows equivalent), program the
   file 'edb7212_redboot_ROM.bin' into the flash.

2. Execute RedBoot from ROM, and initialize the flash filing system.
       Notes: the key here is the "-o" option which keeps minicom from
       sending junk.

   % minicom -o ttyS0

   RedBoot(tm) debug environment - built 08:36:10, Aug 15 2000
   Copyright (C) 2000, Red Hat, Inc.

   RAM: 0x00000000-0x00fd7000
   FLASH: 0xe0000000 - 0xe1000000, 128 blocks of 0x00020000 bytes ea.
   IP: 192.168.1.23, Default server: 192.168.1.101
   show tcp = 0x0001ed58
   RedBoot> 

   RedBoot> fi in
   About to initialize [format] FLASH image system - are you sure (y/n)? y
   *** Initialize FLASH Image System
       Warning: device contents not erased, some blocks may not be usable
   ... Erase from 0xe0fe0000-0xe1000000: .
   ... Program from 0x00fa7000-0x00fa7400 at 0xe0fe0000: .

4. Install RAM based RedBoot for backup/update:
       Similar considerations apply: redboot-ram.srec must be an S-record
       version of RedBoot built for RAM startup.

   RedBoot> lo -v edb7212_redboot.srec
   Entry point: 0x00010044, address range: 0x00010000-0x0001ee88
   RedBoot> fi cr RedBoot[backup] -f 0xe0020000 -b 0x10000 -l 0x20000
   An image named 'RedBoot[backup]' exists - are you sure (y/n)? y
   ... Erase from 0xe0020000-0xe0040000: .
   ... Program from 0x00010000-0x00030000 at 0xe0020000: .
   ... Erase from 0xe0fe0000-0xe1000000: .
   ... Program from 0x00fa7000-0x00fc7000 at 0xe0fe0000: .
   RedBoot> fi li
   Name              FLASH addr   Mem addr    Length    Entry point
   RedBoot           0xE0000000   0xE0000000  0x020000  0xE0000044
   RedBoot[backup]   0xE0020000   0xE0020000  0x020000  0x00010044
   RedBoot config    0xE0FC0000   0xE0FC0000  0x020000  0x00000000
   FIS directory     0xE0FE0000   0xE0FE0000  0x020000  0x00000000
   RedBoot> 

        You have now updated your board completely.  Phew!



5. To update RedBoot with a new version of RedBoot, it is necessary to run
   a RAM-based version of RedBoot which itself re-writes the ROM-based one,
   because you can't re-write the code that is executing at the time.

   RedBoot> fi lo RedBoot[backup]
   RedBoot> g
   +
   RedBoot(tm) debug environment - built 07:45:57, Aug  7 2000
   Copyright (C) 2000, Red Hat, Inc.
   
   RAM: 0x00000000-0x00fd7000
   FLASH: 0xe0000000 - 0xe1000000, 128 blocks of 0x00020000 bytes ea.
   IP: 192.168.1.25, Default server: 192.168.1.101
   show tcp = 0x00030d48
   RedBoot> 
   
     .. continue with step 3, using whatever your new boot image is called
        in the tftp-place, in .srec format.


You probably also want to set up then environment with your own IP
addresses and so on.  Recall that this IP address is the one you use for
GDB to talk to the board, not the IP address which the eCos application
will take on (by bootp/dhcp or whatever means according to configury as
usual).

   RedBoot> fconfig
   Network debug at boot time: false 
   Use BOOTP for network configuration: false 
   Local IP address: 192.168.1.25 
   Default server IP address: 192.168.1.101 
   Network hardware address [MAC]: 0x08:0x88:0x12:0x34:0x56:0x79 
   GDB connection port: 1000 
   Run script at boot: false 
   RedBoot> 


Building RedBoot
----------------

To rebuild RedBoot from source, first cut out the attached configuration
export file "redboot.RAM" and save it somewhere, say /tmp/redboot.RAM

  mkdir redboot
  cd redboot
  ecosconfig new edb7212 redboot
  ecosconfig import /tmp/redboot.RAM
  ecosconfig tree
  make

To build the ROM version, in a different build/config directory, just
change the startup mode (at the end of the export file).

Here is the redboot.RAM configuration export:

=========================== redboot.RAM =====================================
cdl_savefile_version 1;
cdl_savefile_command cdl_savefile_version {};
cdl_savefile_command cdl_savefile_command {};
cdl_savefile_command cdl_configuration { description hardware template package };
cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value };
cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value };
cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value };
cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value };

cdl_configuration eCos {
    description "" ;
    hardware    edb7212 ;
    template    redboot ;
    package -hardware CYGPKG_HAL_ARM current ;
    package -hardware CYGPKG_HAL_ARM_EDB7XXX current ;
    package -hardware CYGPKG_DEVS_ETH_ARM_EDB7XXX current ;
    package -hardware CYGPKG_IO_SERIAL_ARM_EDB7XXX current ;
    package -template CYGPKG_HAL current ;
    package -template CYGPKG_INFRA current ;
    package -template CYGPKG_REDBOOT current ;
    package CYGPKG_IO_ETH_DRIVERS current ;
    package CYGPKG_IO_FLASH current ;
    package CYGPKG_DEVS_FLASH_EDB7XXX current ;
};

cdl_option CYGBLD_BUILD_GDB_STUBS {
    user_value 0
};

cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT {
    user_value 0
};

cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS {
    inferred_value 1
};

cdl_option CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT {
    inferred_value 0
};

cdl_option CYGSEM_HAL_USE_ROM_MONITOR {
    inferred_value 0 0
};

cdl_option CYGHWR_HAL_ARM_EDB7XXX_VARIANT {
    user_value EP7212
};

cdl_option CYGHWR_HAL_ARM_EDB7XXX_PROCESSOR_CLOCK {
    user_value 73728
};

cdl_option CYGBLD_BUILD_REDBOOT {
    user_value 1
};

cdl_component CYG_HAL_STARTUP {
    user_value RAM
};
=========================== redboot.RAM =====================================

