Setup

Name

Setup -- Preparing the M5282LITE board for eCos Development

Overview

In a typical development environment the M5282LITE board boots from flash into the RedBoot ROM monitor. eCos applications are configured for a RAM startup, and then downloaded and run on the board via the debugger m68k-elf-gdb. Preparing the board therefore involves programming a suitable RedBoot image into flash memory, replacing the existing dBUG monitor.

The following RedBoot configurations are supported:

ConfigurationDescriptionUseFile
ROMRedBoot running from the board's flashredboot_ROM.ecmredboot_rom.bin
dBUGUsed for initial setupredboot_DBUG.ecmredboot_dbug.srec
RAMUsed for upgrading ROM versionredboot_RAM.ecmredboot_ram.bin

For serial communications all versions run with 8 bits, no parity, and 1 stop bit. The dBUG version runs at 19200 baud. The ROM and RAM versions run at 38400 baud. These baud rates can be changed via the configuration option CYGNUM_HAL_M68K_M5282LITE_DIAG_BAUD and rebuilding RedBoot. On the standard board only UART0 has a serial connector so by default RedBoot will use that. If the board has been extended to provide connectors for the other on-chip uarts then the configuration option CYGHWR_HAL_M68K_MCFxxxx_DIAGNOSTICS_PORT can be used to make RedBoot use one of thoe. On an M5282LITE platform RedBoot also supports ethernet communication and flash management.

Initial Installation

This process assumes that the board still has its original dBUG ROM monitor and does not require any special debug hardware. Programming the RedBoot rom monitor into flash memory requires an application that can manage flash blocks. RedBoot itself has this capability. Rather than have a separate application that is used only for flash management during the initial installation, a special RAM-resident version of RedBoot is loaded into memory and run. This version can then be used to load the normal flash-resident version of RedBoot and program it into the flash.

The first step is to connect an RS232 cable between the M5282LITE serial port and the host PC. A suitable cable is supplied with the board. Next start a terminal emulation application such as HyperTerminal or minicom on the host PC and set the serial communication parameters to 19200 baud, 8 data bits, no parity, 1 stop bit (8N1) and no flow control (handshaking). Apply power to the board and you should see a dBUG> prompt.

Once dBUG is up and running the RAM-resident version of RedBoot can be downloaded:

dBUG> dl
Escape to local host and send S-records now...
    

The required S-records file is redboot_dbug.srec, which is normally supplied with the eCos release in the loaders directory. If it needs to be rebuilt then instructions for this are supplied below. The file should be sent to the target as raw text using the terminal emulator:

S-record download successful!
dBUG>
    

It is now possible to run the RAM-resident version of RedBoot:

dBUG> go 0x10000
FLASH configuration checksum error or invalid key
... waiting for BOOTP information
Ethernet eth0: MAC address 00:00:00:00:00:03
Can't get BOOTP info for device!

RedBoot(tm) bootstrap and debug environment [DBUG]
Non-certified release, version UNKNOWN - built 11:26:11, Jul 24 2004

Platform: M5282LITE (Motorola MCF5282)
Copyright (C) 2000, 2001, 2002, Free Software Foundation, Inc.
Copyright (C) 2003, 2004, eCosCentric Limited

RAM: 0x00000000-0x01000000, 0x0002d0f0-0x00fed000 available
FLASH: 0xffe00000 - 0x00000000, 32 blocks of 0x00010000 bytes each.
RedBoot>
    

At this stage the RedBoot flash management initialization has not yet happened so the warning about the configuration checksum error is expected. There will also be a delay while RedBoot tries to contact a local BOOTP server. To perform the flash initialization use the fis init -f command:

RedBoot> fis init -f
About to initialize [format] FLASH image system - continue (y/n)? y
*** Initialize FLASH Image System
... Erase from 0xffff0000-0xffffffff: .
`... Program from 0x00ffef00-0x00fff000 at 0xffff0000: .
RedBoot>
    

At this stage the block of flash at location 0xFFFF0000 holds information about the various flash blocks, allowing other flash management operations to be performed. The next step is to set up RedBoot's non-volatile configuration values:

RedBoot> fconfig -i
Initialize non-volatile configuration - continue (y/n)? y
Run script at boot: false
Use BOOTP for network configuration: true
DNS server IP address:
GDB connection port: 9000
Force console for special debug messages: false
Network hardware address [MAC]: 0x00:0xff:0x12:0x34:0x01:0x08
Network debug at boot time: false
Update RedBoot non-volatile configuration - continue (y/n)? y
... Erase from 0xffff0000-0xffffffff: .
... Program from 0x00fef000-0x00fff000 at 0xffff0000: .
RedBoot>
    

For most of these configuration variables the default value is correct. If there is no suitable BOOTP service running on the local network then BOOTP should be disabled, and instead RedBoot will prompt for a fixed IP address, netmask, and addresses for the local gateway and DNS server. The other exception is the network hardware address, also known as MAC address. All boards should be given a unique MAC address, not the one in the above example. If there are two boards on the same network trying to use the same MAC address then the resulting behaviour is undefined.

It is now possible to load the flash-resident version of RedBoot. Because of the way that flash chips work it is better to first load it into RAM and then program it into flash.

RedBoot> load -r -m ymodem -b %{freememlo}
    

The file redboot_rom.bin should now be uploaded using the terminal emulator. The file is a raw binary and should be transferred using the Y-modem protocol.

Raw file loaded 0x0002d400-0x00042c2b, assumed entry at 0x0002d400
xyzModem - CRC mode, 691(SOH)/0(STX)/0(CAN) packets, 5 retries
RedBoot>
    

Once RedBoot has been loaded into RAM it can be programmed into flash:

RedBoot> fis create RedBoot -b %{freememlo}
An image named 'RedBoot' exists - continue (y/n)? y
... Erase from 0xffe00000-0xffe20000: .
... Program from 0x0002d400-0x0004d400 at 0xffe00000: .
... Erase from 0xffff0000-0xffffffff: .
... Program from 0x00fef000-0x00fff000 at 0xffff0000: .
RedBoot>
    

The flash-resident version of RedBoot has now programmed at location 0xFFE00000, and the flash info block at 0xFFFF0000 has been updated. The initial setup is now complete. Power off the board, set the terminal emulator to run at 38400 baud (the usual baud rate for RedBoot), and power up the board again.

+Ethernet eth0: MAC address 00:ff:12:34:01:08
IP: 10.1.1.71/255.255.255.0, Gateway: 10.1.1.241
Default server: 10.1.1.1, DNS server IP: 10.1.1.240


RedBoot(tm) bootstrap and debug environment [ROM]
Non-certified release, version UNKNOWN - built 15:41:51, Jul 24 2004

Platform: M5282LITE (Motorola MCF5282)
Copyright (C) 2000, 2001, 2002, Free Software Foundation, Inc.
Copyright (C) 2003, 2004, eCosCentric Limited

RAM: 0x00000000-0x01000000, 0x0000bef8-0x00fed000 available
FLASH: 0xffe00000 - 0x00000000, 32 blocks of 0x00010000 bytes each.
RedBoot>
    

When RedBoot issues its prompt it is also ready to accept connections from m68k-elf-gdb, allowing eCos applications to be downloaded and debugged.

Occasionally it may prove necessary to update the installed RedBoot image. This can be done by loading a RAM-resident version of RedBoot, redboot_ram.bin, rather than the dBUG version of RedBoot used above. The ROM version can then be loaded into memory using RedBoot's load and the flash version version can be updated using fis create RedBoot.

Rebuilding RedBoot

Should it prove necessary to rebuild a RedBoot binary, this is done most conveniently at the command line. The steps needed to rebuild the dBUG version of RedBoot are:

$ mkdir redboot_dbug
$ cd redboot_dbug
$ ecosconfig new m5282lite redboot
$ ecosconfig import $ECOS_REPOSITORY/hal/m68k/mcf52xx/mcf5282/m5282lite/current/misc/redboot_DBUG.ecm
$ ecosconfig resolve
$ ecosconfig tree
$ make
    

At the end of the build the install/bin subdirectory should contain the required file redboot_dbug.srec.

Rebuilding the RAM and ROM versions involves basically the same process. The RAM version uses the file redboot_RAM.ecm and generates a file redboot_ram.bin. The ROM version uses the file redboot_ROM.ecm and generates a file redboot_rom.bin.

2017-02-09
Documentation license for this page: eCosPro License