Problem setting up XScope on XC-2 board, XN file issue?

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
ozel
Active Member
Posts: 34
Joined: Wed Sep 08, 2010 10:16 am

Problem setting up XScope on XC-2 board, XN file issue?

Postby ozel » Tue Mar 29, 2011 2:22 pm

Hi folks,

I'm strugling far too long now, with setting up the new Xscope functionality on a XC-2.
I have a XTAG-2 connected to it (just desoldered the small smd fuse) which works fine (and fast! :) for running, debugging and flashing.
Now I want to make use of the X0LA link, which appears to be wired on the XC-2 to its XSYS connector as it sould, when one wants to use it with the new XScope feature. Right?

I followed chapter 7 in the current xmos tools user guide closely. But I need to use makefile-based building, since I don't know how I would include all the makefile-based modules like "module_ethernet" etc. if I'd be using the XDE's internal build method.

So I added -lxscope to my makefile for linking in the xscope library:

Code: Select all

TARGET =  XC-2
BASE_DIR = .
APP_NAME =
LOCAL_DIRS = folder1 folder2
SOURCE_DIRS += $(LOCAL_DIRS)
INCLUDE_DIRS += $(LOCAL_DIRS)

USED_MODULES = module_ethernet.1v3 module_xfifo.1v0
#XCC_FLAGS += -save-temps -g -report
#XCC_FLAGS += -save-temps -report
XCC_MAP_FLAGS += -lxscope
 
include $(lastword $(sort $(wildcard ../module_xmos_common.1v3)))/build/Makefile.common

all: $(BIN_DIR)/$(APP_NAME).xe
   @echo Build Complete

clean: clean_common


I imported the XC-2.xn file in the top project directory and added this bewteen <Packages/> and <ExternalDevices/> definitions:

Code: Select all

<Links>
  <Link Encoding="2wire" Delays="4,4" Flags="SOD">
    <LinkEndpoint NodeId="0" Link="X0LA" />
    <LinkEndpoint RoutingId="0x8000" Chanend="1" /> 
  </Link>
</Links>


after compiling, I still get this error, as if the neccessary XN file config is still missing:

Code: Select all

ccXQnm40.s: Error: Undefined reference to '__sodEnd' (using xscope but XN does not specify a suitable link?)
ccXQnm40.s: Error: Undefined reference to '__sodFlag' (using xscope but XN does not specify a suitable link?)


now, if I want to point the Xmapper specificly to my slightly modded .XN file via this in the Makefile:
(Note: I need the "../" here, alltough the Makefile and the XC-2.xn file are both in the same, topmost project directory. Strange...)

Code: Select all

XCC_MAP_FLAGS += -lxscope --target-file ../XC-2.xn


I get

Code: Select all

xcc: error: both target and xn source file supplied


and finally, if I undefine the $(TARGET) variable, my code doesn't compile anymore right from the start, because all the XC-2 default port labels are gone (alltough they are still set in my modded XC-2.xn file)
I also messed around with XCC_DEVICE_PATH and the XCC_FLAGS "-target=" option, which didn't help either...

Any suggestions?
I slowly get the feeling, that there's maybe a little bit too much black magic involved with handling the .XN files behind the scenes...
User avatar
XMatt
XCore Addict
Posts: 147
Joined: Tue Feb 23, 2010 6:55 pm

Postby XMatt » Tue Mar 29, 2011 2:57 pm

Hi ozel,

The XLink version of xscope is not supported with a G -> L series link as they are incompatible. The high performance version can only be used between L series devices on boards where a link has been wired to the XSYS connector. There is a version which uses UART which you can use with your G4 board but obviously the performance of this is going to be slower, this is documented in the user guide.
ozel
Active Member
Posts: 34
Joined: Wed Sep 08, 2010 10:16 am

Postby ozel » Tue Mar 29, 2011 5:05 pm

Hi Matt,

thanks for the quick reply!
I figured out, I need to put my modified XC-2.xn file into a subfolder _or_ simply not define SOURCE_DIRS and INCLUDE_DIRS variables by myself. Adding "." to them only made the dependency checker mad.
Could it be, that there is a problem with folder scope levels and makefiles?

It's really sad news, that the XJTAG-2 doesn't deliver fast xscoping on G4s.
(just thought we have now good counter part to xilinx's ChipScope with this)
I'm allways wondering why the xlink design between L's and G's is different...

About your suggestion:
When I tried the xscope_uart lib, I couldn't get it to work either. Since there is no full xscope/uart demo code, should this work?

Code: Select all

on stdcore[0]: port txuart = PORT_UART_TX;
(...)
on stdcore[0] :
      {
         int integer = 1234;
         xscope_register(0, XSCOPE_DISCRETE , " Sample buffer ", XSCOPE_INT , "4byte");
         xscope_config_uart(txuart);
         xscope_probe_data_pred(0, integer);
      }
(...)


I get this error, when it runs

Code: Select all

xrun: Program received signal ET_ILLEGAL_RESOURCE, Resource not valid.
      0x00010a7e in xscope_uart_put_char_xc.coersed..f.7b0.7d.28o.3ap.2cuc.29 ()


I have nothing else started on core 0 and removed all calls to printf()/print.h from everywhere.

What's the recomended run configuration for that? Enable the I/O server and/or UART server?
Will the performance be also non-blocking, as with the xlink trace interface?
Sould it be at least a little bit faster than printfs?
I want to monitor audio buffer levels at a 16 to 48 kHz sample rate.

I hope there's some G-core xscope trace solution in the works...
Let's say a custom XC-2 firmeware (we have plenty of them lying around ;) which acts as a G2/4 Xscope probe that connects via ethernet to the XDE... :-)

Regards,
Oliver
User avatar
jonathan
Respected Member
Posts: 377
Joined: Thu Dec 10, 2009 6:07 pm
Contact:

Postby jonathan » Tue Mar 29, 2011 5:10 pm

An L4 package would be nice, then you can obsolete the broken G4 link implementation.
Image
User avatar
XMatt
XCore Addict
Posts: 147
Joined: Tue Feb 23, 2010 6:55 pm

Postby XMatt » Tue Mar 29, 2011 5:39 pm

Yes the G -> L series link incompatibility is unfortunate.

Your example was almost correct, the call to xscope_config_uart() needs to be done first. I have attached some example code from our test suite and tested that it works on an XC-2 with XTAG-2.

To use it you enable the same xscope option from the XDE run configuration or with the --xscope option on the xrun command line. It will block until the UART data is transmitted. No modified XN file is required to use the UART support so you should just use the standard XC-2 target that comes with the tools.

As an aside the UART version of xscope only currently runs on the core which is attached to the UART, if you want to get data to it from other cores you will have to create a mechanism yourself, this will be addressed at some point but is currently a limitation.

Code: Select all

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

on stdcore[0]: port mp = PORT_UART_TX;

int test(void) {
  // initialise
  xscope_config_uart(mp);
  xscope_register(
    1,
    XSCOPE_CONTINUOUS, "A probe", XSCOPE_UINT, "value"
  );

  // probe
  for (int i = 0; i < 100; i++) {
    xscope_probe_data(0, i*i);
  }

  return 0;
}

int main (void) {
  par {
    on stdcore[0]: test();
  }
}


It will generate the attached Scope view in the XDE.

The UART for the XTAG-2 and FTDI devices is currently only 115kbps so it will not be that fast, it will be fine for the printf redirection but putting it in inner loops will slow things down considerably. It really depends how fast you want to sample the data.

xscope_uart_xc2.PNG
(37.47 KiB) Not downloaded yet
xscope_uart_xc2.PNG
(37.47 KiB) Not downloaded yet
ozel
Active Member
Posts: 34
Joined: Wed Sep 08, 2010 10:16 am

Postby ozel » Thu Mar 31, 2011 6:10 pm

thanks a lot, now it works!

But the performance seems to be as low as with using the xlog module @ 115200kb/s.
Should it theoretically be better with Xscope over uart?
I guess they both use a similar implementation, because I couldn't use xscope_uart togther with module_xlog.

But since you can drive up the speed to 921600baud with xlog, this seems to be the better way for fast logging of data on a G4 so far. Also the xscope loading data display/loading mechanism doesn't always work.
In one instance, I had to re-open the XDE...
Would be nice if xscope could display data in realtime. Hope this is allready on the wish list.
cjf1699
Active Member
Posts: 48
Joined: Fri Mar 16, 2018 2:30 pm

Postby cjf1699 » Mon Apr 02, 2018 2:05 pm

XMatt wrote:Hi ozel,

The XLink version of xscope is not supported with a G -> L series link as they are incompatible. The high performance version can only be used between L series devices on boards where a link has been wired to the XSYS connector. There is a version which uses UART which you can use with your G4 board but obviously the performance of this is going to be slower, this is documented in the user guide.

Hi ,I tried to use xscope to debug the example project AN00162,referring to the xTIMEcomposer Studio User Guide.But when I built the project, I also got these error:
Description Resource Path Location Type
Undefined reference to '__sodEnd' (using xScope without specifying -fxscope?) AN00162_i2s_loopback_demo C/C++ Problem
Description Resource Path Location Type
Undefined reference to '__sodFlag' (using xScope without specifying -fxscope?) AN00162_i2s_loopback_demo C/C++ Problem

I have already added -fxscope to the XCC_FLAG on the makefile. How did it come and what should I do?
I work on a XMOS board:xCORE-200 Multichannel Audio Platform with xTIME Composer Studio (Community_14.3.2), Windows 10.
Thanks a lot!The problem has confused me for a long time.

Who is online

Users browsing this forum: Bogdanljc, CanadafinU and 26 guests