Setup

Name

Setup -- Preparing the board for eCos Development

Overview

In a typical development environment, the board boots from the SPI NOR and runs the RedBoot ROM monitor from SDRAM. eCos applications are configured for RAM startup and then downloaded and run on the board via the debugger arm-eabi-gdb. Preparing the board therefore usually involves programming a suitable RedBoot image into flash memory.

The following RedBoot configurations are supported:

ConfigurationDescriptionUseFile
ROMRedBoot loaded from SPI NOR flash to SDRAMredboot_ROM.ecmredboot_ROM.bin

For serial communications, all versions run with 8 bits, no parity, and 1 stop bit at 115200 baud. RedBoot also supports Ethernet communication and flash management.

Note that the use of the term ROM for the initial RedBoot configuration is a historical accident. RedBoot actually runs from SDRAM after being loaded there from NOR flash by the on-chip boot loader. The use of ROM for this configuration is intended to indicate that it initializes the microprocessor and board peripherals, as opposed to the RAM configuration which assumes that this has already been done.

Initial Installation

The board comes with Windows CE installed by default. The booting mechanism is that the on-chip boot loader examines a set of switches and based on their settings, reads a header, initialization data and an application from the selected external device. It then executes the application at a given address. Possible boot devices include NAND flash, SPI NOR flash and an MMC/SD card. For eCos we use the SPI NOR flash.

To write RedBoot to the SPI NOR flash we need to run RedBoot and then use that to download and program an image to SPI flash. There are two ways to do this: use a JTAG debugger to load and run RedBoot under GDB, or use an MMC/SD card to load it.

Note: The RedBoot image files referred to in the setup instructions below can be found in the loaders/mcimx25wpdk directory, and the PEEDI JTAG debugger configuration file and ECM files for rebuilding RedBoot can be found in the packages/hal/arm/arm9/mcimx25x/<version>/misc directory of the eCosPro installation. On a Linux host eCosPro is typically installed in the /opt/ecospro/ecospro-<version> sub-directory. On a Windows host eCosPro will typically be installed in the C:\eCosPro\ecos-<version> sub-directory.

The following section describes this process using the Ronetix PEEDI; other JTAG emulators will have similar steps. The next section describes how to do this using an MMC/SD card. A third common section then describes how to use that RedBoot to initialize the SPI NOR flash and program RedBoot into it.

Programming RedBoot into NOR flash using the PEEDI

The following gives the steps needed load RedBoot using the PEEDI.

  1. Set up the PEEDI as described in the Ronetix documentation. The peedi.mcimx25x.cfg file should be used to setup and configure the hardware.

  2. Connect a null-modem serial cable between the serial port of the Debug board and a serial port on a convenient host. Run a terminal emulator (TeraTerm or minicom) at 115200 baud.

  3. Attach an Ethernet cable to the Personality board FEC socket, not the Debug board Ethernet socket. Make sure this is on the same network as the PEEDI and host.

  4. Copy redboot_ROM.img to to a TFTP server on the same network as the PEEDI and MCIMX25WPDK board.

  5. Apply power to the PEEDI.

  6. Connect a telnet session to the PEEDI and power up the MCIMX25WPDK board. You should see something similar to the following output:

    ++ info: RESET and TRST asserted
    ++ info: TRST released
    ++ info: BYPASS check passed, 4 TAP controller(s) detected
    ++ info: TAP 0 : invalid IDCODE = 0x0
    ++ info: TAP 1 : invalid IDCODE = 0x0
    ++ info: TAP 2 : IDCODE = 0x07926041, ARM926E -> CORE0
    ++ info: TAP 3 : IDCODE = 0x1B900F0F, ARM ETB
    ++ info: RESET released
    ++ info: core 0: initialized
    
    mx25>
            
  7. Issue the following command, substituting your own TFTP server address:

    mx25>> mem load tftp://10.0.1.1/redboot_ROM.img bin 0x80000000
    ++ info: Loading image file: tftp://10.0.1.1/redboot_ROM.img
    ++ info: At absolute address: 0x80000000
    loading at 0x80000000
    loading at 0x80008000
    loading at 0x80010000
    loading at 0x80018000
    loading at 0x80020000
    
    ++ info: successfully loaded 149.00 KB in 0.59 sec
    mx25>
          
  8. Now set the CPSR to disable thumb mode (which the on-chip boot loader uses) and issue the go command:

           mx25> set cpsr 0xd3
           mx25> go 0x80008000
          

    You should see output similar to the following on the board serial line:

    +**Warning** FLASH configuration checksum error or invalid key
    Use 'fconfig -i' to [re]initialize database
    Ethernet eth0: MAC address 0e:00:00:ea:18:f0
    IP: 10.0.2.4/255.0.0.0, Gateway: 10.0.0.3
    Default server: 10.0.1.1
    
    RedBoot(tm) bootstrap and debug environment [ROM]
    Non-certified release, version UNKNOWN - built 16:55:09, Apr 14 2014
    
    Copyright (C) 2000-2009 Free Software Foundation, Inc.
    Copyright (C) 2003-2014 eCosCentric Limited
    RedBoot is free software, covered by the eCos license, derived from the
    GNU General 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: Freescale MCIMX25WPDK (ARM9)
    RAM: 0x80000000-0x84000000 [0x800318f8-0x83fed000 available]
    FLASH: 0x70000000-0x701fffff, 32 x 0x10000 blocks
    RedBoot>
          

Now go to this section to complete the installation.

Programming RedBoot into NOR flash using an MMC/SD card

The following gives the steps needed to load RedBoot using an MMC/SD card.

  1. Connect a null-modem serial cable between the serial port of the Debug board and a serial port on a convenient host. Run a terminal emulator (for example, TeraTerm or minicom) at 115200 baud.

  2. Attach an Ethernet cable to the Personality board FEC socket, not the Debug board Ethernet socket. Make sure this is on the same network as your TFTP server.

  3. Copy redboot_ROM.img to the TFTP server.

  4. Locate an SD card whose existing content can be lost.

  5. Using a suitable tool such as dd on Linux or an equivalent on Windows (e.g. dd for windows or win32 diskimager), write redboot_ROM.img into the first sectors of the SD card. For example, on Linux:

           $ sudo dd if=/path/to/redboot_ROM.img of=/dev/sdX
          
  6. Set the Personality board switches as follows: SW21 all off except switches 1 and 2; SW22 all off. On the Debug board SW5..SW10 should all be off and SW4 all off except 1 and 8 (these are the default settings).

  7. Insert the SD card into the SD card socket on the Personality board and apply power to the board. You should see output similar to the following on the board serial line:

    +**Warning** FLASH configuration checksum error or invalid key
    Use 'fconfig -i' to [re]initialize database
    Ethernet eth0: MAC address 0e:00:00:ea:18:f0
    IP: 10.0.2.4/255.0.0.0, Gateway: 10.0.0.3
    Default server: 10.0.1.1
    
    RedBoot(tm) bootstrap and debug environment [ROM]
    Non-certified release, version UNKNOWN - built 16:55:09, Apr 14 2014
    
    Copyright (C) 2000-2009 Free Software Foundation, Inc.
    Copyright (C) 2003-2014 eCosCentric Limited
    RedBoot is free software, covered by the eCos license, derived from the
    GNU General 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: Freescale MCIMX25WPDK (ARM9)
    RAM: 0x80000000-0x84000000 [0x800318f8-0x83fed000 available]
    FLASH: 0x70000000-0x701fffff, 32 x 0x10000 blocks
    RedBoot>
          

Now follow the instructions in the following section to complete the RedBoot installation.

Initialize and Install RedBoot

With a RedBoot now running on the board, the following steps are common between the two methods.

  1. Run the following command to initialize RedBoot's flash file system and flash configuration:

    RedBoot> fis init
    About to initialize [format] FLASH image system - continue (y/n)? y
    *** Initialize FLASH Image System
    ... Erase from 0x701f0000-0x701fffff: .
    ... Program from 0x83ff0000-0x84000000 to 0x701f0000: .
    RedBoot> fconfig -i
    Initialize non-volatile configuration - continue (y/n)? y
    Run script at boot: false
    Use BOOTP for network configuration: true
    Default server IP address: 10.0.1.1
    Console baud rate: 115200
    DNS domain name: example.com
    DNS server IP address: 10.0.0.5
    Network hardware address [MAC] for eth0: 0xec:0x05:0x00:0x00:0x02:0x24
    GDB connection port: 9000
    Force console for special debug messages: false
    Network debug at boot time: false
    Default network device: enet0_eth
    Update RedBoot non-volatile configuration - continue (y/n)? y
    ... Erase from 0x701f0000-0x701fffff: .
    ... Program from 0x83ff0000-0x84000000 to 0x701f0000: .
    RedBoot>
          

    Substitute your own IP addresses and domain name in place of those above. If multiple boards are to be run on the same network, also ensure that they have unique MAC addresses.

  2. We now need to download a copy of RedBoot and program it into the flash. Give the following command to RedBoot, substituting in your tftp server's IP address:

    RedBoot> load -h 10.0.1.1 -r -b %{freememlo} redboot_ROM.img
    Using default protocol (TFTP)
    Raw file loaded 0x80031c00-0x80056fff, assumed entry at 0x80031c00
    RedBoot>
          
  3. Now program the RedBoot image to flash:

    RedBoot> fis create RedBoot
    An image named 'RedBoot' exists - continue (y/n)? y
    ... Erase from 0x70000000-0x7003ffff: ....
    ... Program from 0x80031c00-0x80057000 to 0x70000000: ...
    ... Erase from 0x701f0000-0x701fffff: .
    ... Program from 0x83ff0000-0x84000000 to 0x701f0000: .
    RedBoot>
          
  4. RedBoot installation is now complete. It is now necessary to set the board switches to select SPI NOR flash boot. Set the Personality board switches as follows: SW21 all off except switches 1, 2, 3, 4 and 7; SW22 all off. On the Debug board SW5..SW10 should all be off and SW4 all off except 1 and 8 (these are the default settings). If you have already booted via the MMC/SD card, you just need to move SW21 switches 3, 4 and 7 to on.

  5. Disconnect the PEEDI or pop the SD card from the socket and power cycle the board. You should see output similar to the following on the serial line:

    +Ethernet eth0: MAC address ec:05:00:00:02:24
    IP: 10.0.2.9/255.0.0.0, Gateway: 10.0.0.3
    Default server: 10.0.1.1
    
    RedBoot(tm) bootstrap and debug environment [ROM]
    Non-certified release, version UNKNOWN - built 16:55:09, Apr 14 2014
    
    Copyright (C) 2000-2009 Free Software Foundation, Inc.
    Copyright (C) 2003-2014 eCosCentric Limited
    RedBoot is free software, covered by the eCos license, derived from the
    GNU General 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: Freescale MCIMX25WPDK (ARM9)
    RAM: 0x80000000-0x84000000 [0x800318f8-0x83fed000 available]
    FLASH: 0x70000000-0x701fffff, 32 x 0x10000 blocks
    RedBoot>
          

If it proves necessary to re-install RedBoot, this may be achieved by repeating the load and fis create parts of the above process. It is not necessary to use a PEEDI, or an SD card, or to reinitialize the FIS and fconfig.

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 ROM version of RedBoot for the MCIMX25WPDK are:

$ mkdir redboot_mcimx25x_rom
$ cd redboot_mcimx25x_rom
$ ecosconfig new mcimx25x redboot
$ ecosconfig import $ECOS_REPOSITORY/hal/arm/arm9/mcimx25x/VERSION/misc/redboot_ROM.ecm
$ ecosconfig resolve
$ ecosconfig tree
$ make
    

At the end of the build the install/bin subdirectory should contain the files redboot.img. redboot.img is a binary file that includes the headers needed by the on-chip boot loader to load RedBoot successfully.

Note: The flashimg_imx host executable provided within your eCosPro installation is required on the build host to wrap the RedBoot binary image into an image that can be loaded by the on-chip boot loader. This executable must be on your path when you build RedBoot and will normally be copied into the ecospro/ecoshosttools/bin sub-directory by the eCosPro installer from the ecospro/ecos-<version>/host/bin-<hostos> sub-directory of your eCosPro installation. The ecospro/ecoshosttools/bin sub-directory will be on your path if you use the eCos GUI configuration tool or the eCos CLI Shell environment provided by ecosprofileenv.

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