Name

Setup — Preparing the Dream Chip A10 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 U-Boot. 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

For eCos development we want to install RedBoot in the SPI NOR flash. The booting mechanism is that the on-chip firmware loads U-Boot from the start of NOR flash which then loads RedBoot from later in the flash.

To write RedBoot to the SPI NOR flash, you must use the command line tools from the Intel Quartus FPGA Development Tools and the SoC FPGA Embedded Development Suite. Any of the Prime, Standard or Lite versions of these tools may be used.

Programming RedBoot into NOR flash using Altera Tools

The following gives the steps needed to program RedBoot into the SPI NOR Flash using the Altera tools. This uses the quartus_hps flash programmer command line utility to do the work.

[Note]Note

The examples below are for a Linux host where 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.

  1. Install Quartus and the SoC EDS as described by Intel onto your host system. Quartus and EDS should be installed into the same directory if the following script is to work. Start an Embedded Command Shell by running either <SoC EDS Installation Folder>\embedded\Embedded_Command_Shell.bat in Windows or <SoC EDS Installation Folder>/embedded/embedded_command_shell.sh in Linux.
  2. Ensure that there is no SD card installed.
  3. Connect USB cables between the mini USB socket at J14 (used by the USB-Blaster), and the mini USB socket at J13 (used to provide serial device access) and your host. Power up the board and run a terminal emulator on your host, attaching it to the serial USB channel which should appear on your host, setting the baud rate to 115200. Attach an Ethernet cable to the RJ45 connector.
  4. Run the following command on the host to detect the USB-Blaster:

    # jtagconfig
    1) DCT10ABASE [1-5]
      02E020DD   10AS022C(3|4)/10AS022E(3|4)
      4BA00477   SOCVHPS
    
    #

    It may be necessary to run this a couple of times before the above result is obtained. If the program failure persists then you should check that your EDS installation is correct.

  5. If installing the prebuilt RedBoot image provided with the eCosPro release:
    change directory to loaders/dreamchip_a10/etc/qspi_boot within the ecos-x.y.z installation sub-directory.

    If installing the RedBoot image you built:
    change directory to etc/qspi_boot in the install directory.

  6. Run the script qspi_prog. If you are running on a Windows host, you will need to run the script using the bash command. This will use the quartus_hps to program U-Boot, the FPGA bit streams and RedBoot into the QSPU flash. This script will produce a lot of output, which is not reproduced here. Monitor the output to ensure each component is written to the flash correctly.
  7. Power cycle the board. Output similar to the following should be seen on the serial line:

    U-Boot 2014.10-dirty (Feb 20 2023 - 12:40:11)
    
    CPU   : Altera SOCFPGA Arria 10 Platform
    BOARD : Dream Chip Arria 10 SoM base
    I2C:   ready
    DRAM:  WARNING: Caches not enabled
    SF: Read data capture delay calibrated to 3 (0 - 6)
    SF: Detected N25Q512A with page size 256 Bytes, erase size 4 KiB, total 64 MiB
    FPGA: Early Release Succeeded.
    SF: Detected N25Q512A with page size 256 Bytes, erase size 4 KiB, total 64 MiBDDRCAL: Success
    INFO  : Skip relocation as SDRAM is non secure memory
    Reserving 2048 Bytes for IRQ stack at: ffe386e8
    DRAM  : 2 GiB
    WARNING: Caches not enabled
    MMC:   SOCFPGA DWMMC: 0
    SF: Read data capture delay calibrated to 8 (0 - 15)
    SF: Detected N25Q512A with page size 256 Bytes, erase size 4 KiB, total 64 MiB
    In:    serial
    Out:   serial
    Err:   serial
    Model: Dreamchip Arria10 SoM
    Net:   dwmac.ff802000
    Hit any key to stop autoboot:  0
    SF: Read data capture delay calibrated to 3 (0 - 6)
    SF: Detected N25Q512A with page size 256 Bytes, erase size 4 KiB, total 64 MiB
    Full Configuration Succeeded.
    SF: Detected N25Q512A with page size 256 Bytes, erase size 4 KiB, total 64 MiB
    SF: 655360 bytes @ 0x1000000 Read: OK
    ## Starting application at 0x00100000 ...
    +**Warning** FLASH configuration checksum error or invalid key
    Use 'fconfig -i' to [re]initialize database
    Ethernet eth0: MAC address 12:34:aa:bb:cc:ee
    IP: 10.0.2.2/255.0.0.0, Gateway: 10.0.0.3
    Default server: 10.0.1.1
    DNS server IP: 10.0.0.5, DNS domain name: <null>
    
    RedBoot(tm) bootstrap and debug environment [ROM]
    eCosCentric certified release, version 4.7.7 - built 14:58:38, Apr 12 2023
    
    Copyright (C) 2000-2009 Free Software Foundation, Inc.
    Copyright (C) 2003-2023 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: Dreamchip Arria 10 SoM Development Kit (Cortex-A9)
    RAM: 0x00000000-0x40000000 [0x0017be78-0x3fd2d000 available]
      Arena: base 0x3fe00000, size 0x200000, 99% free, maxfree 0x1fffec
    FLASH: 0x80000000-0x83ffffff, 1024 x 0x10000 blocks
    RedBoot>
  8. Run the following commands 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 0x83ff0000-0x83ffffff: .
    ... Program from 0x3fdf0000-0x3fe00000 to 0x83ff0000: .
    RedBoot>
    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: calivar.com
    DNS server IP address: 10.0.0.5
    Network hardware address [MAC] for eth0: 0x12:0x34:0xAA:0xBB:0xCC:0xEE
    GDB connection port: 9000
    Force console for special debug messages: false
    Network debug at boot time: false
    Default network device: dwc_gmac
    Update RedBoot non-volatile configuration - continue (y/n)? y
    ... Erase from 0x83ff0000-0x83ffffff: .
    ... Program from 0x3fdf0000-0x3fe00000 to 0x83ff0000: .
    RedBoot>

    You should substitute your own server IP address for the one shown above. You may also want to change the MAC address if more than one board is present on the network. If you want to use a static IP address, then choose false for the "Use BOOTP" option and enter the gateway, IP address and netmask that you have assigned.

The RedBoot installation is now complete. Power cycling the board should show

U-Boot 2014.10-dirty (Feb 20 2023 - 12:40:11)

CPU   : Altera SOCFPGA Arria 10 Platform
BOARD : Dream Chip Arria 10 SoM base
I2C:   ready
DRAM:  WARNING: Caches not enabled
SF: Read data capture delay calibrated to 3 (0 - 6)
SF: Detected N25Q512A with page size 256 Bytes, erase size 4 KiB, total 64 MiB
FPGA: Early Release Succeeded.
SF: Detected N25Q512A with page size 256 Bytes, erase size 4 KiB, total 64 MiBDDRCAL: Success
INFO  : Skip relocation as SDRAM is non secure memory
Reserving 2048 Bytes for IRQ stack at: ffe386e8
DRAM  : 2 GiB
WARNING: Caches not enabled
MMC:   SOCFPGA DWMMC: 0
SF: Read data capture delay calibrated to 8 (0 - 15)
SF: Detected N25Q512A with page size 256 Bytes, erase size 4 KiB, total 64 MiB
In:    serial
Out:   serial
Err:   serial
Model: Dreamchip Arria10 SoM
Net:   dwmac.ff802000
Hit any key to stop autoboot:  0
SF: Read data capture delay calibrated to 3 (0 - 6)
SF: Detected N25Q512A with page size 256 Bytes, erase size 4 KiB, total 64 MiB
Full Configuration Succeeded.
SF: Detected N25Q512A with page size 256 Bytes, erase size 4 KiB, total 64 MiB
SF: 655360 bytes @ 0x1000000 Read: OK
## Starting application at 0x00100000 ...
+Ethernet eth0: MAC address 12:34:aa:bb:cc:ee
IP: 10.0.2.2/255.0.0.0, Gateway: 10.0.0.3
Default server: 10.0.1.1
DNS server IP: 10.0.0.5, DNS domain name: <null>

RedBoot(tm) bootstrap and debug environment [ROM]
eCosCentric certified release, version 4.7.7 - built 14:58:38, Apr 12 2023

Copyright (C) 2000-2009 Free Software Foundation, Inc.
Copyright (C) 2003-2023 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: Dreamchip Arria 10 SoM Development Kit (Cortex-A9)
RAM: 0x00000000-0x40000000 [0x0017be78-0x3fd2d000 available]
  Arena: base 0x3fe00000, size 0x200000, 99% free, maxfree 0x1fffec
FLASH: 0x80000000-0x83ffffff, 1024 x 0x10000 blocks
RedBoot>
RedBoot> fis list
Name              FLASH addr  Mem addr    Length      Entry point
(reserved)        0x80000000  0x80000000  0x01000000  0x00000000
RedBoot           0x81000000  0x81000000  0x000A0000  0x00000000
FIS directory     0x83FF0000  0x83FF0000  0x0000F000  0x00000000
RedBoot config    0x83FFF000  0x83FFF000  0x00001000  0x00000000
RedBoot>

If it proves necessary to install a new version of RedBoot, this may be done from RedBoot itself. Place the new image on a TFTP server on the configured server. From RedBoot run the following commands:

RedBoot> load -r -b %{freememlo} redboot.bin
Using default protocol (TFTP)
Raw file loaded 0x001a6800-0x0020e953, assumed entry at 0x001a6800
RedBoot> fis cre RedBoot
An image named 'RedBoot' exists - continue (y/n)? y
... Erase from 0x81000000-0x8109ffff: ..........
... Program from 0x001a6800-0x0020e954 to 0x81000000: .......
... Erase from 0x83ff0000-0x83ffffff: .
... Program from 0x3fdf0000-0x3fe00000 to 0x83ff0000: .
RedBoot>

Booting RedBoot from an SD card

The following gives the steps needed to run RedBoot from an SD card. This does not need any tools from Quartus.

[Note]Notes:
  1. These instructions are only applicable to developers running on a Linux host.
  2. eCosPro is typically installed in the /opt/ecospro/ecospro-<version> sub-directory.
  1. Insert a blank SD card into an SD card drive on your host machine and identify the device name by either monitoring the system messages or using lsblk.
  2. Connect USB cables between the mini USB socket at J14 (used by the USB-Blaster), and the mini USB socket at J13 (used to provide serial device access) and your host. Run a terminal emulator on your host, attaching it to the serial USB channel which should appear on your host, setting the baud rate to 115200. Attach an Ethernet cable to the RJ45 connector.
  3. If installing the prebuilt RedBoot image provided with the eCosPro release:
    change directory to loaders/dreamchip_a10/etc/sd_boot within the ecos-x.y.z installation sub-directory.

    If installing the RedBoot image you built:
    change directory to etc/sd_boot in the install directory.

  4. Run the script sd_prog as root giving it the name of the SD device as an argument. For example sudo ./sdcard_build /dev/sdx. This will format the SD card and copy U-Boot, the FPGA bit streams and RedBoot on to it. flash. The script should produce output similar to the following:

    $ sudo ./sdcard_build /dev/sdh
    1024+0 records in
    1024+0 records out
    1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.261784 s, 4.0 MB/s
    Checking that no-one is using this disk right now ... OK
    
    Disk /dev/sdh: 14.84 GiB, 15931539456 bytes, 31116288 sectors
    Disk model: MassStorageClass
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    >>> Script header accepted.
    >>> Script header accepted.
    >>> Script header accepted.
    >>> Script header accepted.
    >>> Script header accepted.
    >>> Created a new DOS disklabel with disk identifier 0x6d0fd677.
    /dev/sdh1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 100 MiB.
    Partition #1 contains a vfat signature.
    /dev/sdh2: Created a new partition 2 of type 'W95 FAT32 (LBA)' and of size 100 MiB.
    Partition #2 contains a vfat signature.
    /dev/sdh3: Created a new partition 3 of type 'Unknown' and of size 10 MiB.
    /dev/sdh4: Done.
    
    New situation:
    Disklabel type: dos
    Disk identifier: 0x6d0fd677
    
    Device     Boot  Start    End Sectors  Size Id Type
    /dev/sdh1        24576 229375  204800  100M  c W95 FAT32 (LBA)
    /dev/sdh2       229376 434175  204800  100M  c W95 FAT32 (LBA)
    /dev/sdh3         2048  22528   20481   10M a2 unknown
    
    Partition table entries are not in disk order.
    
    The partition table has been altered.
    Calling ioctl() to re-read partition table.
    Syncing disks.
    2048+0 records in
    2048+0 records out
    1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0472776 s, 22.2 MB/s
    8+0 records in
    8+0 records out
    4096 bytes (4.1 kB, 4.0 KiB) copied, 0.0525689 s, 77.9 kB/s
    mkfs.fat 4.1 (2017-01-24)
    $
  5. Remove the SD card from the host and insert into the SD socket on the board.
  6. Power up the board. Output similar to the following should appear on the serial line:

    U-Boot 2014.10-dirty (Feb 20 2023 - 12:40:11)
    
    CPU   : Altera SOCFPGA Arria 10 Platform
    BOARD : Dream Chip Arria 10 SoM base
    I2C:   ready
    DRAM:  WARNING: Caches not enabled
    SF: Read data capture delay calibrated to 3 (0 - 6)
    SF: Detected N25Q512A with page size 256 Bytes, erase size 4 KiB, total 64 MiB
    
    
    U-Boot 2014.10-dirty (Feb 15 2023 - 11:20:29)
    
    CPU   : Altera SOCFPGA Arria 10 Platform
    BOARD : Dream Chip Arria 10 SoM base
    I2C:   ready
    DRAM:  WARNING: Caches not enabled
    SOCFPGA DWMMC: 0
    FPGA: writing ghrd_10AS048E4.periph.rbf ...
    FPGA: Early Release Succeeded.
    DDRCAL: Success
    INFO  : Skip relocation as SDRAM is non secure memory
    Reserving 2048 Bytes for IRQ stack at: ffe386e8
    DRAM  : 2 GiB
    WARNING: Caches not enabled
    MMC:   In:    serial
    Out:   serial
    Err:   serial
    Model: Dreamchip Arria10 SoM
    Net:   dwmac.ff802000
    Hit any key to stop autoboot:  0
    FPGA: writing ghrd_10AS048E4.core.rbf ...
    Full Configuration Succeeded.
    293108 bytes read in 16 ms (17.5 MiB/s)
    ## Starting application at 0x00100000 ...
    +Ethernet eth0: MAC address 12:34:aa:bb:cc:ee
    IP: 10.0.2.2/255.0.0.0, Gateway: 10.0.0.3
    Default server: 10.0.1.1
    DNS server IP: 10.0.0.5, DNS domain name: <null>
    
    RedBoot(tm) bootstrap and debug environment [ROM]
    eCosCentric certified release, version 4.7.7 - built 14:58:38, Apr 12 2023
    
    Copyright (C) 2000-2009 Free Software Foundation, Inc.
    Copyright (C) 2003-2023 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: Dreamchip Arria 10 SoM Development Kit (Cortex-A9)
    RAM: 0x00000000-0x40000000 [0x001865e0-0x3fe00000 available]
      Arena: base 0x3fe00000, size 0x200000, 99% free, maxfree 0x1fffec
    RedBoot>
  7. Due to the different FPGA bitstreams, The SD card version of RedBoot cannot access the QSPI flash. Consequently any configuration such as Ethernet MAC address or IP address must be configured in to the RedBoot executable.

If it proves necessary te reinstall RedBoot then rerunning the above script is the simplest approach. Alterntively the first partition on the SD card can be mounted on the host and the new RedBoot executable copied over.

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 Dream Chip A10 are:

$ mkdir redboot_dreamchip_a10_rom
$ cd redboot_dreamchip_a10_rom
$ ecosconfig new dreamchip_a10 redboot
$ ecosconfig import $ECOS_REPOSITORY/hal/arm/cortexa/dreamchip_a10/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 is a binary file that includes a header needed by the preloader to load and run RedBoot successfully.

These instructions build a RedBoot that can be booted from the QSPI flash. To build a RedBoot to boot from SD, use redboot_ROM_SD.ecm in the above import command.