www.onsemi.com
32
CHAPTER 6
6.
Advanced Debugging
6.1 P
RINTF
D
EBUG
C
APABILITIES
The
PRINTF()
macro is used to provide
printf()
debug capability in RSL10 applications. The implementation
of the
PRINTF()
macro is user selectable to allow for different types of debug interfaces. The functionality is accessed
via the tracing API.
The tracing API supports two debug interfaces: UART and RTT. The implementation of the tracing functions can
be found in the
app_trace.c
file. The developer can select the debug interface during the compilation process by setting
the
RSL10_DEBUG
macro in the
app_trace.h
file. If the macro is set to
DBG_NO
, tracing is disabled. This is the default
behavior in all sample applications.
NOTE: The files
app_trace.c
and
app_trace.h
need to be present in your sample application, and
initialized using
TRACE_INIT()
, in order to for you use the
PRINTF()
feature. You can find
these two required files in most Bluetooth Low Energy sample applications, such as
ble_peripheral_server_bond
.
To debug time critical applications, we recommend setting the tracing option to
DBG_RTT
option. With SEGGER
RTT (Real Time Transfer), you can output information from the target MCU to the RTT Viewer application at a very
high speed without compromising the target’s real time behavior. More information about SEGGER RTT can be found
in JLINK user manual, at www.segger.com.
6.1.1 Adding Printf Debug Capabilities
To add printf debug capabilities over UART, change the define in the
app_trace.h
file to
#define RSL10_DEBUG
DBG_UART
, and set the
RSL10_DEBUG
macro to
DBG_UART
. A standard terminal program on a PC can be used to view
the debug output.
To add RTT printf debug capabilities, change the define in the
app_trace.h
file to
#define RSL10_DEBUG
DBG_RTT
and add the SEGGER RTT files to the application. The Segger RTT Viewer application on a PC can be used
to view the debug output.
Samples for RTT are under
C:\Program Files (x86)\SEGGER\JLink_V640b\Samples\RTT
.
More information about the RTT API can be found in the JLINK manual, under
C:\Program Files
(x86)\SEGGER\JLink_V640b\Doc\Manuals
.
NOTE: Note that these RTT sample and information files are for SEGGER JLink version 640b.
6.2 D
EBUGGING
A
PPLICATIONS
THAT
D
O
N
OT
S
TART
AT
THE
B
ASE
A
DDRESS
OF
F
LASH
If you want to debug an application that does not start at the first address of the flash memory (0x00100000), read
on. For example, you might be debugging an application in RAM, or a flash memory application that has been placed in
a different address.
This procedure assumes you have performed the steps in Section 3.3.1, “Debugging with the .elf File” on page 13,
and you are using the ON Semiconductor IDE:
1. In your Debug configuration, change to the
Startup
tab
2. Enter the following in the
Run/Restart Commands
field as illustrated in Figure 39: