No output from debug_printf()

If you have a simple question and just want an answer.
ffomich
Experienced Member
Posts: 119
Joined: Mon Sep 15, 2014 1:32 pm

No output from debug_printf()

Post by ffomich »

Hi,
I test lib_logging/examples/debug_printf_example/ on my board.

I change only TARGET in Makefile.

Program runs successfully, but there is no output in Console window in xTIMEcomposer (14.2.1).

What I do wrong? Please help.

--------------
main.xc
--------------

Code: Select all

#include <debug_print.h>

int main(void) {
    debug_printf("Hello World\n");
    debug_printf("An int: %d\n", -5);
    debug_printf("An unsigned int: %u\n", 5);
    debug_printf("A string: %s\n", "foo");
    debug_printf("A hexadecimal int: 0x%x\n", 0xabcd);
    debug_printf("A char: %c\n", 'X');

    return 0;
}
---------
Makefile
---------

Code: Select all

# The TARGET variable determines what target system the application is
# compiled for. It either refers to an XN file in the source directories
# or a valid argument for the --target option when compiling
TARGET = my_board

# The APP_NAME variable determines the name of the final .xe file. It should
# not include the .xe postfix. If left blank the name will default to
# the project name
APP_NAME = 

# The USED_MODULES variable lists other module used by the application.
USED_MODULES = lib_logging

# The flags passed to xcc when building the application
# You can also set the following to override flags for a particular language:
# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS
# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to
# xcc for the final link (mapping) stage.
XCC_FLAGS = -DDEBUG_PRINT_ENABLE=1

# The XCORE_ARM_PROJECT variable, if set to 1, configures this
# project to create both xCORE and ARM binaries.
XCORE_ARM_PROJECT = 0

# The VERBOSE variable, if set to 1, enables verbose output from the make system.
VERBOSE = 0

XMOS_MAKE_PATH ?= ../..
-include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common
User avatar
infiniteimprobability
Verified
XCore Legend
Posts: 1164
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

The library usage looks OK. How are you running it? Have you ensured you have enabled xscope printing (--xscope for xrun /xgdb or select the box target IO = xscope in GUI).

Does normal printf (stdio.h) work?
ffomich
Experienced Member
Posts: 119
Joined: Mon Sep 15, 2014 1:32 pm

Post by ffomich »

How are you running it?
xTIMEcomposer -> Run
Target I/O option = JTAG
Does normal printf (stdio.h) work?
Yes
Have you ensured you have enabled xscope printing (--xscope for xrun /xgdb or select the box target IO = xscope in GUI).
No, I haven't enable xcsope printing.

-----------------------------------------------------------------
I have restarted xTc. Now debug_printf() works fine in JTAG target I/O mode.

In xSCOPE I/O mode I get 2 warnings:

Code: Select all

WARNING: tile[0] - xSCOPE not supported by application, I/O will be via JTAG
WARNING: tile[1] - xSCOPE not supported by application, I/O will be via JTAG
but application output is correct.
User avatar
infiniteimprobability
Verified
XCore Legend
Posts: 1164
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

Hmm - that's odd that it works after a restart but glad to hear it now works.

Sorry - got my wires crossed a bit with xscope, which now that I read your post again you didn't even mention!! Doh!
You're using JTAG which should of course work fine, except that it breaks real-time, so should be used carefully.

Please see this for a quick summary about pros/cons of the two printing methods.

http://www.xcore.com/forum/viewtopic.php?f=47&t=4088
ffomich
Experienced Member
Posts: 119
Joined: Mon Sep 15, 2014 1:32 pm

Post by ffomich »

Thanks a lot!
ffomich
Experienced Member
Posts: 119
Joined: Mon Sep 15, 2014 1:32 pm

Post by ffomich »

Note:
If you have 'config.xscope' file in your project with xSCOPEconfig enabled="true"
output in JTAG target i/o mode will not work.

Set xSCOPEconfig enabled="false" and rebuild project or
delete 'config.xscope' file from project.