XDE 11.11.1 - XC-1A and printf for debugging [REOPENED]

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
franksanderdo
Experienced Member
Posts: 69
Joined: Sat Apr 30, 2011 6:19 pm

XDE 11.11.1 - XC-1A and printf for debugging [REOPENED]

Post by franksanderdo »

Dears,

I have searched a lot during the last 2 days but some how can't get it.

As far as I understand the XC1-A does not support debugging via xConnect Link.
There for I would like to use printf to uart. As per Tutorial I have added:

Code: Select all

#include <xscope.h>

port uart_tx = PORT_UART_TX;

void xscope_user_init(void) {
  xscope_register(0);
  xscope_config_uart(uart_tx);
  xscope_config_io(XSCOPE_IO_BASIC);
}
Unfortunately this only produces:

Code: Select all

**** Build of configuration Debug for project MyTest ****

xmake CONFIG=Debug all 
Creating dependencies for main.xc
Updating eclipse config
No modules used.
Compiling main.xc
cd ./.build_Debug && xcc -c  -I"../." -I".././src"   -g -O0 -target="XC-1A"  -DCONFIG=Debug "../src/main.xc"  -o ../.build_Debug/src/main.xc.o
cd ./.build_Debug && xcc -target="XC-1A" -g -O0   .././.build_Debug/src/main.xc.o   -o "../bin/Debug/MyTest_Debug.xe"
../src/main.xc: Error: Undefined reference to 'xscope_config_io'
../src/main.xc: Error: Undefined reference to 'xscope_config_uart'
../src/main.xc: Error: Undefined reference to 'xscope_register'
xmake[1]: *** [bin/Debug/MyTest_Debug.xe] Error 1
xmake: *** [bin/Debug/MyTest_Debug.xe] Error 2
I read from this that the related Library does not get linked to the program.
Some how i am to stupid. I can't find the the definition of the library path or the linker directive.

Any body who has a good Idea (and some patience with a newbe ;-) )

See you around
Frank
Last edited by franksanderdo on Sat Nov 10, 2012 6:23 am, edited 2 times in total.


User avatar
franksanderdo
Experienced Member
Posts: 69
Joined: Sat Apr 30, 2011 6:19 pm

Post by franksanderdo »

Dears,

I found the way:

Adding for the CC flags in the makefile -lxscope_uart did the trick.

Thanks for patience!! There might come some more questions soon ;-)

See you around
Frank
User avatar
franksanderdo
Experienced Member
Posts: 69
Joined: Sat Apr 30, 2011 6:19 pm

Post by franksanderdo »

Dears,

after I managed last night to get the program compiled I started this morning testing it.
If I run the program the program with the settings according to Tutorial I get this:

Code: Select all

xrun: Invalid option, --uart and --xscope cannot be used together
xrun: Program received signal ET_ILLEGAL_RESOURCE, Resource exception.
      [Switching to stdcore[3] hwthread 0]
if I run it without --xscope I get:

Code: Select all

xrun: Program received signal ET_ILLEGAL_RESOURCE, Resource exception.
      [Switching to stdcore[3] hwthread 0]
All this happens as soon as I have this function in the code:

Code: Select all

void xscope_user_init(void) {
  xscope_register(0);
  xscope_config_uart(uart_tx);
  xscope_config_io(XSCOPE_IO_BASIC);
}
What do I do wrong?

See you around
Frank
User avatar
franksanderdo
Experienced Member
Posts: 69
Joined: Sat Apr 30, 2011 6:19 pm

Post by franksanderdo »

Dears

I just learned again that thinking simple is much easier:

I don't need any xscope redirection thing to printf.
Just did a short test and it is working fine just to say printf to print to XDE Console.
Only have to make sure that in Run Configuration the UART_Server is on.

This is good enough for the moment.
It does NOT sort the issue that I can not use any xscope functionality ;-(

See you around
Frank
User avatar
XMatt
XCore Addict
Posts: 147
Joined: Tue Feb 23, 2010 6:55 pm

Post by XMatt »

Here is a code example for doing printing via xscope on an XC-1A.

Code: Select all

#include <xscope.h>
#include <stdio.h>
#include <platform.h>

port xscope_uart = PORT_UART_TX;

int main (void) {
   int i = 0;

   xscope_config_uart(xscope_uart);
   xscope_register(0);
   xscope_config_io(XSCOPE_IO_BASIC);

   for (i = 0; i < 100; i++) {
     printf("Value of i = %d\n", i);
   }

   return 0;
}
Compile from the command line with,

xcc -o main.xe main.xc -lxscope_uart -target=XC-1A

Or in the GUI add the xscope_uart library to your Makefile.
ale500
Respected Member
Posts: 259
Joined: Thu Sep 16, 2010 9:15 am

Post by ale500 »

I tried XMatt's example in the version 12 of the tools... I do not seem to find where I have to add the library. At least in the latest version of Eclipse, there is under Project-<Properties->C/C++ General->Paths and Symbols a tab for the Libraries, this seems to be missing from xTimeComposer... is there another place for the libraries ?
User avatar
franksanderdo
Experienced Member
Posts: 69
Joined: Sat Apr 30, 2011 6:19 pm

Post by franksanderdo »

Hi Ho

@ale500
Easiest way is to add it in the makefile.
Double click the makefile and it will open a tab in the editor.
You can choose between formular view or source view.
I have added the library in the formular view, in the debug tab, in the CC flags line.

@xMatt
If I follow your example I get the following:

Code: Select all

xrun: Program received signal ET_ILLEGAL_RESOURCE, Resource exception.
      [Switching to stdcore[3] hwthread 0]
but this is in XDE 11.11.2 as I can't get the XC-1A recognized in 12.0 on OSX, will test it there as soo as I got the announced fix.

See you around
Frank