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.
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 provides access to both the SAMA5's DBGU (debug UART) and the J-Link adapter through the J14 USB connector. Output on the DBGU channel is accessible via USB on a connected host as a USB CDC-ACM serial class device. Additionally, debugging support is accessible through the proprietary J-Link adaptor via the Segger J-Link GDB server.
The motherboard can be modified (by adding and removing resistors) to route DBGU to the J8 USART1
connector. However, if diagnostics via that connector are desired, it is simpler to
re-configure eCos to directly send diagnostics to the J8 port.
This can be achieved by setting the HAL diagnostic console
channel (and if using RedBoot, GDB channel) to port 1 (the default setting
of 0 indicates routing to the DBGU). However, if it is
necessary after all to modify the hardware and route DBGU to J8, then
support for the SAMA5's USART1 device must be manually disabled by the user as
it will no longer be physically connected (removing the
implements CYGINT_HAL_ARM_CORTEXA_SAMA5D3_USART1" line
Segger's JLinkGDBServer application provides a network-based GDB server connection to J-Link hardware debuggers, including on-board J-Link hardware as used on the SAMA5D3x-MB. The Segger webpage http://www.segger.com/jlink-software.html provides a J-Link software package download that incorporates the J-link GDB Server.
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.
Experience has also shown that a reboot of the PC may be required after installation of the jlink software.
To ensure compatibility between the on-board J-Link firmware and software, agree to any prompt you may encounter to update the firmware during the first run of the J-Link software.
A helper script
sama5d3xek-ddram.jlink is provided in
misc directory of
sama5d3x_mb package. This should be specified
when executing the
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/current/misc/sama5d3xek-ddram.jlink
"C:\Program Files (x86)\SEGGER\JLink_V612j\JLinkGDBServerCL.exe" -device ATSAMA5D31 -xc $ECOS_REPOSITORY\packages\hal\arm\cortexa\sama5d3\sama5d3x_mb\<vsn>\misc\sama5d3xek-ddram.jlink
Note that in the above examples the -device argument should reference the relevant processor installed on the SAMA5D3x-MB motherboard. The eCos <vsn> and JLink_Vxxxx version names will change over time; you will need to use the path specific to the actual versions 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:
target remote localhost:2331(gdb)
sama5d3xek.jlink script is provided
that does NOT initialise the clocks or
DDR2-SDRAM, and can be used if explictly
types where execution of the relevant run-time initialization is
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.
Currently, as-of JLinkGDBServer
If low-level debugging of floating point operations is required then n 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.
Using the OpenOCD debug server via the J-Link (J14) interface, is not yet possible. 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
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. You can also check the Ronetix website
for updated versions.
Use of a PEEDI debugger requires hardware modification of the standard SAMA5D3x-MB board, which will provide a 20-pin ARM JTAG connector at J9. The required modifications are detailed in the board's user manual.
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
[PLATFORM_CortexA8] section (NOTE: The PEEDI
firmware identifies not just A8 CPUs with
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 2000 on the PEEDI's IP address. For example:
target remote 111.222.333.444:2000
By default when the PEEDI is powered up, the target will always run
the initialization section of
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
By default the arm-eabi-gdb connection to
the PEEDI will default to displaying the
FPA registers. To enable access to
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
.gdbinit used to configure GDB.
sama5d3x-tdesc.xml file can be used to define
the target description using the
GDB set tdesc filename
command. For example the
.gdbinit could contain
something similar to:
set tdesc filename $ECOS_REPOSITORY/packages/hal/arm/cortexa/sama5d3/sama5d3x_mb/current/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.
|2023-04-25||eCosPro Non-Commercial Public License|