Nuvoton Nu-Link Debug Adapter User Manual
Oct 28, 2014 - 11 - Revision V1.01
3.1.4 Semihost
When using the Semihost function, the message of the NuMicro™ Family microcontroller can be
output through UART to the debug window by the Nu-Link Adapter. That is, the message is output
without the GPIO. Figure 3-4 shows the debug messages in the “UART #1” form, which are the
messages output by the Nu-Link Adapter.
Follow the steps below to use the Semihost.
Step 1: Modify the strings in the “retarget.c” as follows.
#define DEBUG_ENABLE_SEMIHOST // Add this line
#if defined(DEBUG_ENABLE_SEMIHOST)
/* The static buffer is used to speed up the semihost */
static char g_buf[16];
static char g_buf_len = 0;
# if defined(__ICCARM__)
Step 2: Invoke Rebuild to rebuild a project and enter Debug mode.
Step 3: In Debug mode, invoke View → Serial Windows → UART #1, as shown in Figure 3-4.
Step 4: Press F5 to program the target chip, and the debug messages are output to the UART #1
form.
Figure 3-4 Semihost Options in Keil Debug Mode