Newbie really needs some help

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
gerrykurz
XCore Addict
Posts: 204
Joined: Sun Jun 01, 2014 10:25 pm

Newbie really needs some help

Post by gerrykurz »

Hi,

I need some help. The project that I am working on needs to use and modify the ethernet modules.

I am trying to get the xSOFTip Low Level Ethernet Demo working on the standard slice kit hardware configuration. I can load and build the Demo project and run it on the hardware and it works fine, responds to pings just fine.

The problem I am having is that the console output is not working. In the code the xscope is set up as in the documentation. Whenever I enable the xscope offline selection in either the run or debug modes, the program stops working and there is still no console output.

I really need to get this basic debugging feature working to be able to make the code changes I want to do.

So what I did, was to try another demo program to see if it was a setup problem or something else.

So I loaded and built and ran the Slicekit Simple GPIO Demo from xSOFTip using of course the GPIO slice card. This program ran fine and output console data. When I looked into the code, it seems to me that it is not using xscope at all yet is still outputting debug information to the console.

Can someone explain how this works? It seems to be contrary to all the documentation I have read.

Why does the GPIO demo work and output print debug statements without any changes to the run configurations and why does the ethernet demo not work?

Please help. I am finding this very frustrating.

Thanks

Gerry
User avatar
infiniteimprobability
Verified
XCore Legend
Posts: 1149
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

Let me try to explain...

There are two ways of printing to the console. Via JTAG to the host and via xSCOPE to the host.

JTAG
Pros:
-Always available (because you are using JTAG anyway)
-Works by default for print.h, stdio.h, debug_print.h etc..
-Works by defualt in xtimecomposer run configuration (JTAG for Target I/O). If using command line, you will need the --io switch
Cons:
-Breaks real-time. It's slow and stops all cores whilst printing happens. Traps are used to make the JTAG communications to the host. Suitable for hello world or non real-time stuff only. Most XMOS stuff is real-time because peripherals are soft.. so JTAG printing very limited in use.

xSCOPE
Pros:
-Very fast. Only a handful of cycles consumed per character. Suitable for real-time stuff
-Only pauses the core the print is executed from.
-Also enables use of xSCOPE graphical stuff (brilliant for in system tuning/monitoring etc.)
Cons:
-Need to connect links (xconnect) to debug adapter (additional 4 wires). All recent XMOS kits have it enabled. We strongly recommend user boards have it wired up too..
-Have to enable it in your project and select in the run configuration options. (or add --xscope to xrun)

The last point is not an issue because it's very simple to enable.
To do this, add the attached file to your project, and select xSCOPE in the I/O option of the run configuration..

On some slicekits, you may need to set the "XLINK" or "XCONNECT" switch near the debug adapter to on, otherwise xscope prints won't make it to the XTAG adpater and host.. Since link transactions are acknowledged, it may cause your target to hang if not enabled. So switch it "on"!

The reason why you saw console output was that selecting xSCOPE in the run configuration also enables JTAG print listening at the host end..

Does that explain it?

PS. Very strongly recommend using the "How To" tab in the bottom left of the GUI. Type in "xscope" and see what you find..
You do not have the required permissions to view the files attached to this post.
User avatar
gerrykurz
XCore Addict
Posts: 204
Joined: Sun Jun 01, 2014 10:25 pm

Post by gerrykurz »

Thank you for the explanation. I now understand the options of printing to the console.

In addition, I now know what the switch on the XA-SK-XTAG2 adapter board marked XMOS LINK does. When I switched it to ON, the console output started working.

I really appreciate the help however I have a couple of comments on this.

First of all, you should be writing the user documentation. If anywhere in any of the documentation had been such a concise and clear explanation, I would have saved myself days of frustration and well as saving other peoples time who have tried to help.

Secondly, there is no documentation about this XMOS LINK switch and no documentation about the XA-SK-XTAG2 slice kit adapter board. I had previously looked for this documentation as I had noticed the switch and wondered what it did.

If it is possible, can you get someone to update the documentation (particularly about the LINK switch) so that the next new user doesn't have to go through a similar process.

Thanks again,

Gerry
teachop
Active Member
Posts: 47
Joined: Wed Feb 05, 2014 1:25 am

Post by teachop »

Idea: XMOS docs live on Github, people post issues against them and maybe even pull requests sometimes to help.
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Post by Folknology »

I agree on using github to improve documentation using thier issues feature, it would require Xmos adding there source docs to repos of course.

But also in Xmos's defence xscope is quite comprehensively documented Maybe this needs to be linked too more prominently on Xcore.

Perhaps the "Use xTIMEcomposer and xSCOPE to trace data in real-time" could be split into 2 files one called getting started which covers differences between Xtag1 and 2 as well as the XA-SK-XTAG2 slice adaptor and it's swicth settings.

regards
Al
androider
Member++
Posts: 24
Joined: Sat Sep 18, 2010 4:05 am

Post by androider »

I ran into this problem again today and was reminded of this - so I'm posting it here in case it helps others:

If I use the printf statement and don't have a newline character, the output won't happen:


// this won't print anything.
printf("Hello world!");

// but this will
printf("Hello world!\n");


Cheers.
User avatar
segher
XCore Expert
Posts: 844
Joined: Sun Jul 11, 2010 1:31 am

Post by segher »

Stdout starts out as line buffered. This is _much_ more
efficient than unbuffered (and fully buffered is not allowed
here).

This isn't specific to the xcore environment; most systems
work this way.