Configuration

Name

Configuration -- Configure, compile and debug the application

Overview

For compilation of the application, the official eCos ARM toolchain is required (gcc version 4.3.2). For debugging, it is needed to install the FlashPro utility from Actel as well as SoftConsole. SoftConsole is an Eclipse based IDE from Microsemi that installs along with the CodeSourcery ARM toolchain. Both are freely available and require a Windows OS based host workstation. To use some peripherals such as the Ethernet controller, the FPGA fabric must be configured to route the Ethernet PHY clock from the MAC_CLK. It is recommended to restore the factory image provided from Actel as a starting point in case the user has already experimented with the fabric.

Building the application

The steps needed to build the HAL library for the Smartfusion evaluation board are:

         $ mkdir a2f200_eval
         $ cd a2f200_eval
         $ ecosconfig new smartfusion kernel
         $ ecosconfig resolve
         $ ecosconfig tree
         $ make
     

At the end of the build the install/lib subdirectory should contain the library and linker script and the install/include subdirectory the necessary includes to compile the application.

The differents startup type available for this platforme are:

Configuration (HAL_PLF_STARTUP_TYPE)Description
ROMApplication running from the board's internal flash, LMA = 0x60000000 and VMA = 0x60000000
SRAMApplication running from the board's internal RAM, LMA = 0x20000000 and VMA = 0x20000000
ROM_SOFTCONSOLEApplication running from the board's internal flash, LMA = 0x60000000 and VMA = 0x00000000

System Boot

The Smartfusion devices boot process is not entirely controlled by the user. The Embedded Non-volatile Memory contains spare pages that are reserved to store specific data such as the factory boot code, the manufacturing parameters, the system boot code or other data such as the Analog block or MSS configuration.

As described in the device user manual, the device first boots from factory boot code before jumping to the system boot and eventually giving the hand to the user code, in this case, the eCos ROM application.

The Actel MSS configuration tool can be used to alter the system boot and the configuration pages. The ENVM spare pages can then be re-programmed using the Actel FlashPro utility. The FlashPro utility can also be used to program the FPGA fabric if required.

Spare page contentAddress
Manufacturing parameters0x60080000
Factory boot0x60080400
System Boot0x60080800
Analog block configuration0x60081600
MSS configuration0x60081E80

Debugging from console

Loading of the application to internal FLASH or RAM of the target is done either using the SoftConsole IDE supplied from Actel or GDB from command line. The later case is described in this paragraph.

To debug ROM based application, while configuring eCos, select the ROM_SOFTCONSOLE startup type. The ROM_SOFTCONSOLE startup type is equivalent to a ROM startup but while the application is loaded at address 0x60000000 (FLASH), it runs and is debugged from address 0x00000000. This is done by setting the load address (LMA) to 0x60000000 and the virtual address (VMA) to 0x00000000 in the eCos memory layout file. In this example, the timers test application from the eCos Smartfusion HAL is compiled:

         $ mkdir a2f200_eval
         $ cd a2f200_eval
         $ ecosconfig new smartfusion kernel
           -> Select ROM_SOFTCONSOLE statup type
         $ ecosconfig resolve
         $ ecosconfig tree
         $ make
         $ make -s tests IGNORE_LINK_ERRORS=y
     

Once the application is compiled, from a Windows command interpreter, start the actel-keepalive utility:

         c:> start actel-keepalive actel-keepalive
     

The GDB initialisation sequence located in a2fxxx/a2f200_eval/current/host/softconsole_flash_init.txt is an example of initialisation sequence to use for debugging application located in ROM. For RAM based application, the initialisation sequence from a2fxxx/a2f200_eval/current/host/softconsole_sram_init.txt shall be used. Make sure to replace the path to the debugger toolchain and the eCos repository first. The GDB initialisation sequence without in-line comments is:

        set arm fallback-mode thumb
        target remote | "C:/Program Files (x86)/Microsemi/SoftConsole v3.3/Sourcery-G++/b-
        in/arm-none-eabi-sprite" flashpro:?cpu=Cortex-M3 "C:/wrk/ecos/packages/hal/cortex-
        m/a2fxxx/a2f200_eval/current/host"
        set mem inaccessible-by-default off
        set *0x40006010 = 0x4C6E55FA
        set *0xE0042000 = 0
        set *0xE0042008 = 1
        set *0xE0042040 = 0x00207FFD
        set *0xE004203C = 0x00000001
        set *0xE0042030 = *0xE0042030 & 0xFFFFFFF7
        set *0xE000ED08 = 0x00000000
        load
        set $sp = *0x60080000
        set $pc = *0x60080004 - 1
     

Start the GDB session to debug the timers test example:

         C:\root\a2f200_eval>arm-none-eabi-gdb install\tests\hal\cortexm\a2fxxx\var\curren-
         t\tests\timers
         GNU gdb (Sourcery G++ Lite Sourcery G++ Lite 2010q1-188 + Actel 1.2) 7.0.50.20100-
         218-cvs
         Copyright (C) 2010 Free Software Foundation, Inc.
         License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
         This is free software: you are free to change and redistribute it.
         There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
         and "show warranty" for details.
         This GDB was configured as "--host=i686-mingw32 --target=arm-none-eabi".
         For bug reporting instructions, please see:
         <https://support.codesourcery.com/GNUToolchain/>...
         Reading symbols from c:\root\a2f200_eval\install\tests\hal\cortexm\a2fxxx\var\curren-
         t\tests\timers...done.
         (gdb)
     

A typical log from the GDB initialisation sequence is shown here:

        Remote debugging using | "C:/Program Files (x86)/Microsemi/SoftConsole v3.3/Sourc-
        ery-G++/bin/arm-none-eabi-sprite" flashpro:?cpu=Cortex-M3 "C:/wrk/ecos/packages/h-
        al/cortexm/a2fxxx/a2f200_eval/current/host"
        arm-none-eabi-sprite: Using memory map C:/wrk/ecos/packages/hal/cortexm/a2fxxx/a2f-
        200_eval/current/host/memory-map.xml
        arm-none-eabi-sprite: Target reset
        arm-none-eabi-sprite: Transferring memory map (may cause a delay)
        0x6008051c in ?? ()
        Loading section .rom_vectors, size 0x8 lma 0x60000000
        Loading section .ARM.exidx, size 0x10 lma 0x60000008
        Loading section .text, size 0x3340 lma 0x60000018
        Loading section .rodata, size 0x4dc lma 0x60003358
        Loading section .data, size 0x318 lma 0x6000383c
        arm-none-eabi-sprite: Using host routines for flash programming
        arm-none-eabi-sprite: Start of flash programming
        arm-none-eabi-sprite: Comparing flash memory contents of actel-smartfusion-envm @-
        0x60000000
        arm-none-eabi-sprite: Program 0x60000000 sector [0x0,+0x80) unchanged
        arm-none-eabi-sprite: Program 0x60000000 sector [0x80,+0x80) unchanged
        arm-none-eabi-sprite: Program 0x60000000 sector [0x100,+0x80) unchanged
        ....
        arm-none-eabi-sprite: Program 0x60000000 sector [0x3b00,+0x80) unchanged
        arm-none-eabi-sprite: End of programming
        Start address 0x18, load size 15180
        Transfer rate: 8 KB/sec, 62 bytes/write.