how to use DEBUGOUT and DEBUGSTR in lpcopen platform v1.03 examples

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to use DEBUGOUT and DEBUGSTR in lpcopen platform v1.03 examples

24,316 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tmune on Wed Jul 24 23:18:59 MST 2013
Hi all,
I have some questions on the lpcopen platform v1.03 document, called "NXP Xpresso LPC1347 board" at http://docs.lpcware.com/lpcopen/v1.03/_l_p_c_o_p_e_n_13_x_x__b_o_a_r_d__x_p_r_e_s_s_o_1347.html
It describes how to set up the hardware, NXP Xpresso LPC1347 board, and optionally set the uart for getting debug messages via a uart. The below is my original posting without this intro.
I understand that ARM has a general function called semihosting which uses a uart for debug output.

--Old posting
The documentation for lpcopen platform describes "Optional UART setup for NXP Xpresso LPC1347 board". It says "Once the dongle is connected to the board, UART support can be enabled in the platform by enabling the DEBUG_ENABLE define in the sys_config.h file for the board. This allows the DEBUGOUT and DEBUGSTR macros to route data to the UART."
My questions are:
[list=1]
  [*]Is the uart function automatically compiled in the example project such as nxp_xpresso_1347_periph_blinky?
[*] If so, how to specify the port number for debug?
[*] What is the format for DEBUGOUT? Is it DEBUGOUT("my message"); ?
[*] What is for DEBUGSTR?
[/list]
Thanks
Takashi
Labels (1)
0 Kudos
3 Replies

1,056 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xie.w.q on Tue Jul 30 19:15:17 MST 2013
and must define DEBUG_SEMIHOSTING in ... \sys_config.h to output message to Debug-Host console.
0 Kudos

1,056 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wellsk on Mon Jul 29 11:00:00 MST 2013
Hi,

There are 3 DEBUG* macros for simple (blocked) I/O. These macros can be optimized out of the code, routed to UART I/O, or routed to semihosted I/O.
DEBUGSTR - send a string to the debug output
DEBUGOUT - send a formatted string to the debug output
DEBUGIN - get a byte of data from the debug input

The macros are enabled when DEBUG_ENABLE is defined (usually in sys_config.h). When DEBUG_ENABLE is not defined, the functionality for these macros is removed from the code to make a smaller image. These functions are blocking in that they will slow down your application considerably!

See http://docs.lpcware.com/lpcopen/v1.03/_retarget_8c_source.html for more information on how this is used.

DEBUGOUT
This macro defines to "printf" and is used for formatted output when used with UART output and semihosting.

DEBUGSTR
This macro is used to print an unformatted string. If you don't need to print formatted strings, you can use this instead of get a smaller build image (as the formmatted print functions won't be needed).

DEBUGIN
This macro is used to read a byte from the input. This (currently) only works with the UART. If a byte isn't available or it is used in a semihosted build, this will return "EOF".

These 3 macros work the same for LPCXpresso, IAR, and Keil tool chains. With LPCXpresso, you'll also need to build with a library that supported semihosting to use the semihosting options.
0 Kudos

1,056 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tmune on Mon Jul 29 09:00:07 MST 2013
I found the solutions to these questions.
I used nxp_xpresso_1347_periph_adc which include DEBUGSTR. I used the uart in 1347 and PIO0_11 for adc input. One of the uart output is "ADC value is 1092", which is in decimal formt of ADC0 value.
Also, I found "semihosting" is enabled in Xpresso IDE( Redlib library) so that you can use output function calls such as printf to the IDE console.
I have not tried or found how to use DEBUGOUT yet.
Thanks,
Takashi
0 Kudos