Setup -- Preparing the SAMA5D3x-MB Board for eCos Development


In a typical development environment the SAMA5D3x-MB board is programmed via a JTAG/SWD interface. This will either be by loading smaller applications into the on-chip SRAM, or into suitably initialised DDR2-SDRAM memory. Alternatively applications may be loaded into bootable memory-mapped devices, e.g. EBI_CS0 NOR flash, or loaded via the on-chip RomBOOT code via a second-level SRAM boot scheme. The following sections initially deal with JTAG/SWD hardware based debugging approaches.

For debugging applications are loaded and then executed on the board via the debugger arm-eabi-gdb, or via the Eclipse IDE.

For the sama5d31_ek target, the SAMA5D3x-MB motherboard provides a built-in J-Link hardware debug solution, as well as optionally providing the J9 JTAG connector for attaching 3rd-party hardware debuggers (e.g. Ronetix PEEDI).


By default the MotherBoard is wired with DBGU routed to the CDC-ACM provided on the J14 USB connector shared with the J-Link adaptor.

The MotherBoard can be modified (basically adding and removing resistors) to route DBGU to the J8 USART1 connector. However, if diagnostics via USART1 are desired, it would be simpler to re-configure eCos to direct diagnostics via USART1 which is already routed to J8. If the hardware modification route is taken to route DBGU to J8 then support for USART1 configurations should be manually disabled by the user.


Segger provide the JLinkGDBServer application to provide a network GDB server connection via a JLink hardware debugger interface. If required the server software can be downloaded from the Segger website and installed on the development host as directed by the Segger package. The Segger page provides a direct link to the software download.

Note: When downloading the software you may need to click on a link “I do not have a serial number because I own an eval board with J-Link on-board. How can I download J-Link software for it?”. This will allow you to download the J-Link software without prior knowledge of a serial number.

A helper script sama5d3xek-ddram.jlink is provided in the misc directory of the sama5d3x_mb package. This should be specified when executing the JLinkGDBServer application, and implements a set of commands that are executed when a GDB connection is established to the server. For example, under Linux:

$ JLinkGDBServer -device ATSAMA5D31 -xc $ECOS_REPOSITORY/packages/hal/arm/cortexa/sama5d3/sama5d3x_mb/vsn/misc/sama5d3xek-ddram.jlink

or when using Windows:

C:\eCosPro> "C:\Program Files (x86)\SEGGER\JLinkARM_V484f/JLinkGDBServerCL.exe" -device ATSAMA5D31 -xc $ECOS_REPOSITORY/packages/hal/arm/cortexa/sama5d3/sama5d3x_mb/vsn/misc/sama5d3xek-ddram.jlink

Note that the above examples version/directory names will change over time; you will need to use the path relevant to the version of J-Link that you downloaded and installed.

Other JLinkGDBServer options may be used as required, for example the -silent option reduces the output generated by the server.

A normal GDB debug session can then be started by connecting to the relevant JLinkGDBServer port (default 2331), for example:

(gdb) target remote localhost:2331
(gdb) load

A simpler sama5d3xek.jlink script is provided that does NOT initialise the clocks or DDR2-SDRAM, and can be used if explictly debugging ROM or SRAM startup types where execution of the relevant run-time initialization is desired.

From the GDB command-line when connected to JLinkGDBServer the “monitor regs” command can be used to see all of the non-VFP register state.

Note: Currently, as-of JLinkGDBServer version V484, there is no support for accessing the Cortex-A5 VFPv4-D16 (VFP) registers when using JLinkGDBServer. e.g. from the GDB “info all-reg” or “info float” commands.

If low-level debugging of floating point operations is required then an alternative debugger should be used. The PEEDI hardware JTAG debugger provides support for displaying the VFP register state, as does the GDB stubs present in the software based RedBoot monitor.


The support for using OpenOCD as the debug GDB server, via the J-Link (J14) interface, is not yet in place for this release. For the moment it is recommended to use the JLinkGDBServer on the host if hardware debug via the J-Link interface is required.


For the Ronetix PEEDI, the sama5d31ek.peedi.cfg file should be used to setup and configure the hardware to an appropriate state to load programs. This includes setting up the PLLs and SDRAM controller.

Note: Use of a PEEDI hardware debugger requires some hardware modification of the (default) SAMA53x-MB board to populate the J9 JTAG connector. This connector implements a standard 20-pin ARM debug connector.

The sama5d31ek.peedi.cfg file also contains an option to define whether hardware or software breakpoints are used by default, using the CORE0_BREAKMODE directive in the [PLATFORM_CortexA8] section (NOTE: The PEEDI firmware identifies not just A8 CPUs with the CortexA8 tag). Edit this file if you wish to use hardware break points, and remember to restart the PEEDI to make the changes take effect.

On the PEEDI, debugging can be performed either via the telnet interface or using arm-eabi-gdb and the GDB interface. In the case of the latter, arm-eabi-gdb needs to connect to TCP port 9000 on the PEEDI's IP address. For example:

(gdb) target remote 111.222.333.444:9000

By default when the PEEDI is powered up, the target will always run the initialization section of the sama5d31ek.peedi.cfg file, and halts the target. This behaviour is repeated with the PEEDI reset command.

If the board is reset (either with the 'reset', or by pressing the reset button) and the 'go' command is then given, then the board will boot as normal. Depending on how the platform jumper state is configured this could run either a second-level bootstrap, or a ROM RedBoot resident in flash.

By default the arm-eabi-gdb connection to the PEEDI will default to displaying the obsolete FPA registers. To enable access to the VFP registers a suitable target description file should be configured prior to connecting to the target system. This can either be done manually every time a GDB session is started, or more sensibly embedded in the users .gdbinit used to configure GDB.

The sama5d3x-tdesc.xml file can be used to define the target description using the GDB set tdesc filename <file> command. For example the .gdbinit could contain something similar to:

set tdesc filename $ECOS_REPOSITORY/packages/hal/arm/cortexa/sama5d3/sama5d3x_mb/vsn/misc/sama5d3x-tdesc.xml
So that it has the relevent target description available prior to the remote debug connection being established. This will allow access to the VFP registers via the PEEDI, for example via the GDB info all-reg command.

Consult the PEEDI documentation for information on other features.

Documentation license for this page: eCosPro License