debug_printf() alternative

If you have a simple question and just want an answer.
Post Reply
tonetechnician
Member
Posts: 14
Joined: Mon Jan 30, 2017 11:09 am

debug_printf() alternative

Post by tonetechnician »

Hello everyone,

This is my first post on the forum, I hope someone can help :)

I've been working on a project using an XMOS processor coupled with a SHARC processor on one board. These have specifically been made by miniDSP and are called the nanoSHARC boards (https://www.minidsp.com/products/minids ... osharc-kit - but the Ethernet version). I have been using them to handle AVB AVDECC packets that communicate mix values that will then mix audio from the FIFOs and send out to speakers. Unfortunately I've been running into some frustrating issues when trying to debug variables within the board.

I have the board connected via the X-TAG3 and am unable to print to the console via the board. The board application is able to run with the X-TAG3 connected, but I get no printing to console when using either printstrln() (from print.h) or debug_printf() (from debug_print.h), aswell as this, the debug feature in xTIMEComposer is not working as I'm unable to watch variables within my application.

Things to note:
- I have not built this code from scratch, rather been given a running application that I can modify.
- I have tried with a very basic "hello world" example and am able to print to console, so it's not the board, definitely something within the code.
- I have tried deconstructing the code to see where it breaks, but this has been unsuccessful.

Essentially, I'd like to know if there are any options that would allow me to log to console, or view what the variables are within my application while it runs on the board. Or if anyone has any ideas why the debug_printf() functionality is not working, I would love to hear them!

Many thanks!


plex
Member++
Posts: 22
Joined: Fri Aug 12, 2016 6:13 pm

Post by plex »

Hi,
I think these 5 things are required to use printf to debug through the xscope
1) An Xscope Link must be defined in the device XN file.
2) Your project directory must include a config.xscope file with the correct settings
3) Your build command(make file) must include the -fxscope option
4) In the run configuration the Target IO option must be set to xscope.
5) Include print.h in your source files.

Debug printing with the xscope is very fast and almost non blocking so most of the times realtime code can run with it. Of course this will depend on your code, how often and how much you print.
tonetechnician
Member
Posts: 14
Joined: Mon Jan 30, 2017 11:09 am

Post by tonetechnician »

Thanks so much for the reply plex!

So according to your suggestions, I have:

1) Xscope link defined in the .xn file.
Image

2) I have the config.xscope file in my project.
Image

3) I have used -fxscope in my build procedure's XCC_FLAGS.

4) I have xscope set as my I/O option.

5) I have print.h included, as well as debug_print.h, in my main file.

What is interesting is when I choose xscope as target I/O option, my application halts on the board and I can't use it, however when I use J-TAG, it seems to run but still does not print :/

I found this other post on the forum - http://www.xcore.com/viewtopic.php?f=47&t=5569&p=28302.
It seems shailesh was having similar issues particularly when debugging and getting error: Can't find a source file at "xscope_api.c". Following his procedure, I also deleted my config.xscope file, but this did not help the problem. I also tried using the basic config.xscope file that was mentioned by peter in that same topic:
Image

I have a suspicion that the problem lies with xscope, but I'm not entirely sure where.

Here is a picture of my makefile for reference:
Image
User avatar
johned
XCore Addict
Posts: 185
Joined: Tue Mar 26, 2013 12:10 pm
Contact:

Post by johned »

I would start with one of the app notes : https://www.xmos.com/support/examples
Particularly AN10089: How to redirect printing functions via xSCOPE.
Best regards,
John
Post Reply