XScope Problems

Technical questions regarding the XTC tools and programming with XMOS.
Redeye
XCore Addict
Posts: 131
Joined: Wed Aug 03, 2011 9:13 am

XScope Problems

Post by Redeye »

I'm trying to get XScope going on an AVB demo kit and it's just not working. So, I've gone back to basics with this code :

Code: Select all

#include "xscope.h"

int main()
{
	xscope_register(2,
	XSCOPE_CONTINUOUS , "Microphone Left", XSCOPE_UINT , "mV",
	XSCOPE_CONTINUOUS , "Microphone Right", XSCOPE_UINT , "mV" );
	
  while (1)
  {
    int sample;
    sample++;
    xscope_probe_data_pred(0, sample);
    sample++;
    xscope_probe_data_pred(1, sample);
  }
}
With the intention of trying to just prove it will create something. I've run it with :

xrun --xscope-file "test.xmt" --xscope-limit 1000 --verbose XscopeTest_Debug.xe

0x00010000 in main ()
Loading setup image to XCore 0
Loading section .text, size 0x24c lma 0x10000
Loading section .globcode, size 0x22 lma 0x1024c
Loading section .cp.const4, size 0x4 lma 0x10270
Loading section .ctors, size 0x4 lma 0x10274
Loading section .dp.data, size 0x28 lma 0x10278
Start address 0x10000, load size 670
Transfer rate: 93 KB/sec, 134 bytes/write.
Enable xscope on core 0 at address 0x10298
Outputting xscope file test.xmt
First stage multi-node boot failed, please check XN file and Xmos link connectivity

but all it does is create an empty xmt file with this in it :

<XtEvents>
<XtEventTypes/>
<XtEventColors/>
<TotalXtEvents Number="0"/>
<XtEventRecords/>
</XtEvents>

Can anybody point me in the direction of whatever stupid mistake I'm making? The error suggests a problem with the .XN file, but I've done exactly what's specified in the tools manual so I'm confused.


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

Post by XMatt »

Redeye wrote:I'm trying to get XScope going on an AVB demo kit and it's just not working. So, I've gone back to basics with this code :

Code: Select all

#include "xscope.h"

int main()
{
	xscope_register(2,
	XSCOPE_CONTINUOUS , "Microphone Left", XSCOPE_UINT , "mV",
	XSCOPE_CONTINUOUS , "Microphone Right", XSCOPE_UINT , "mV" );
	
  while (1)
  {
    int sample;
    sample++;
    xscope_probe_data_pred(0, sample);
    sample++;
    xscope_probe_data_pred(1, sample);
  }
}
With the intention of trying to just prove it will create something. I've run it with :

xrun --xscope-file "test.xmt" --xscope-limit 1000 --verbose XscopeTest_Debug.xe

0x00010000 in main ()
Loading setup image to XCore 0
Loading section .text, size 0x24c lma 0x10000
Loading section .globcode, size 0x22 lma 0x1024c
Loading section .cp.const4, size 0x4 lma 0x10270
Loading section .ctors, size 0x4 lma 0x10274
Loading section .dp.data, size 0x28 lma 0x10278
Start address 0x10000, load size 670
Transfer rate: 93 KB/sec, 134 bytes/write.
Enable xscope on core 0 at address 0x10298
Outputting xscope file test.xmt
First stage multi-node boot failed, please check XN file and Xmos link connectivity

but all it does is create an empty xmt file with this in it :

<XtEvents>
<XtEventTypes/>
<XtEventColors/>
<TotalXtEvents Number="0"/>
<XtEventRecords/>
</XtEvents>

Can anybody point me in the direction of whatever stupid mistake I'm making? The error suggests a problem with the .XN file, but I've done exactly what's specified in the tools manual so I'm confused.
Would you be able to attach the XN file you are using,

The message "First stage multi-node boot failed, please check XN file and Xmos link connectivity" is suggesting there is something not right with link configuration.

Matt
Redeye
XCore Addict
Posts: 131
Joined: Wed Aug 03, 2011 9:13 am

Post by Redeye »

Matt,

Attached is the XN file (renamed as a TXT because it won't let me post with an XN extension!!). I thought I'd followed the instructions right, but I could be wrong.
You do not have the required permissions to view the files attached to this post.
User avatar
XMatt
XCore Addict
Posts: 147
Joined: Tue Feb 23, 2010 6:55 pm

Post by XMatt »

Could you change the XScope link from "XOLA" to "2" in the XN file and retry.

Matt
Redeye
XCore Addict
Posts: 131
Joined: Wed Aug 03, 2011 9:13 am

Post by Redeye »

Exactly the same result :

bash-3.2$ xrun --xscope-file "test.xmt" --xscope-limit 1000 --verbose XscopeTest_Debug.xe
0x00010000 in main ()
Loading setup image to XCore 0
Loading section .text, size 0x24c lma 0x10000
Loading section .globcode, size 0x22 lma 0x1024c
Loading section .cp.const4, size 0x4 lma 0x10270
Loading section .ctors, size 0x4 lma 0x10274
Loading section .dp.data, size 0x28 lma 0x10278
Start address 0x10000, load size 670
Transfer rate: 81 KB/sec, 134 bytes/write.
Enable xscope on core 0 at address 0x10298
Outputting xscope file test.xmt
First stage multi-node boot failed, please check XN file and Xmos link connectivity
User avatar
XMatt
XCore Addict
Posts: 147
Joined: Tue Feb 23, 2010 6:55 pm

Post by XMatt »

Can you try this example which was used as part of the testing for the tools 11.11.0 release, it will verify that everything is connected correctly. Compile it with the XN you have and the command line.

xcc -o xscopetest.xe xscopetest.xc XR-AVB-LC-BRD.xn -lxscope

Code: Select all

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

void xscope_user_init() {
   xscope_register(0, 0, "", 0, "");
}

void core0() {
  int i = 0;

  xscope_config_io(XSCOPE_IO_BASIC);

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

  xscope_config_io(XSCOPE_IO_TIMED);

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

void core1() {
  int i = 0;

  xscope_config_io(XSCOPE_IO_BASIC);

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

  xscope_config_io(XSCOPE_IO_TIMED);

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

int main (void) {
   par {
     on stdcore[0]: core0();
     on stdcore[1]: core1();
   }
   return 0;
}
Redeye
XCore Addict
Posts: 131
Joined: Wed Aug 03, 2011 9:13 am

Post by Redeye »

Matt,

That seems to run okay :

bash-3.2$ xrun --xscope-file "test.xmt" --xscope-limit 1000 --verbose xscopetest.xe
0x00010000 in main ()
Loading setup image to XCore 0
Loading section .text, size 0x24c lma 0x10000
Loading section .globcode, size 0x22 lma 0x1024c
Loading section .cp.const4, size 0x4 lma 0x10270
Loading section .ctors, size 0x4 lma 0x10274
Loading section .dp.data, size 0x28 lma 0x10278
Start address 0x10000, load size 670
Transfer rate: 93 KB/sec, 134 bytes/write.
Enable xscope on core 0 at address 0x10298
Loading setup image to XCore 1
Loading section .text, size 0x240 lma 0x10000
Loading section .globcode, size 0x22 lma 0x10240
Loading section .cp.const4, size 0x4 lma 0x10264
Loading section .ctors, size 0x4 lma 0x10268
Loading section .dp.data, size 0x20 lma 0x1026c
Start address 0x10000, load size 650
Transfer rate: 90 KB/sec, 130 bytes/write.
Enable xscope on core 1 at address 0x10284
First stage multi-node boot completed
Loading application image to XCore 0
Loading section .text, size 0x4dba lma 0x10000
Loading section .init, size 0x5c lma 0x14dba
Loading section .fini, size 0x3a lma 0x14e16
Loading section .globcode, size 0x10 lma 0x14e50
Loading section .text.__call_exitprocs_impl, size 0x2 lma 0x14e60
Loading section .rodata, size 0x4 lma 0x14e70
Loading section .eh_frame, size 0x44 lma 0x14e74
Loading section .cp.rodata, size 0x124 lma 0x14ec0
Loading section .cp.const4, size 0x8 lma 0x14fe4
Loading section .cp.rodata.cst4, size 0xb0 lma 0x14fec
Loading section .cp.string, size 0x3e lma 0x1509c
Loading section .ctors, size 0x8 lma 0x150dc
Loading section .dtors, size 0x4 lma 0x150e4
Loading section .dp.data, size 0x54 lma 0x150f0
Loading section .dp.rodata, size 0xe4 lma 0x15150
Start address 0x10000, load size 21000
Transfer rate: 120 KB/sec, 1400 bytes/write.
Enable xscope on core 0 at address 0x1513c
Loading application image to XCore 1
Loading section .text, size 0x4cc2 lma 0x10000
Loading section .init, size 0x5c lma 0x14cc2
Loading section .fini, size 0x3a lma 0x14d1e
Loading section .globcode, size 0x10 lma 0x14d58
Loading section .text.__call_exitprocs_impl, size 0x2 lma 0x14d68
Loading section .rodata, size 0x4 lma 0x14d70
Loading section .eh_frame, size 0x44 lma 0x14d74
Loading section .cp.rodata, size 0x124 lma 0x14dc0
Loading section .cp.const4, size 0x8 lma 0x14ee4
Loading section .cp.rodata.cst4, size 0xb0 lma 0x14eec
Loading section .cp.string, size 0x3e lma 0x14f9c
Loading section .ctors, size 0x8 lma 0x14fdc
Loading section .dtors, size 0x4 lma 0x14fe4
Loading section .dp.data, size 0x40 lma 0x14ff0
Loading section .dp.rodata, size 0xe4 lma 0x15030
Start address 0x10000, load size 20732
Transfer rate: 123 KB/sec, 1382 bytes/write.
Enable xscope on core 1 at address 0x15028

Program exited normally.
Outputting xscope file test.xmt
CORE 0 - Value of i = 0
CORE 1 - Value of i = 1
CORE 0 - Value of i = 1
CORE 1 - Value of i = 2
CORE 0 - Value of i = 2
CORE 1 - Value of i = 3
CORE 0 - Value of i = 3
CORE 1 - Value of i = 4
CORE 0 - Value of i = 4
CORE 1 - Value of i = 5
CORE 0 - Value of i = 5
CORE 1 - Value of i = 6
CORE 0 - Value of i = 6
CORE 1 - Value of i = 7
CORE 0 - Value of i = 7
CORE 1 - Value of i = 8
CORE 0 - Value of i = 8
CORE 1 - Value of i = 9
CORE 0 - Value of i = 9
0 -- CORE 1 - Value of i = 0
11644 -- CORE 0 - Value of i = 0
1404 -- CORE 1 - Value of i = 1
13093 -- CORE 0 - Value of i = 1
2808 -- CORE 1 - Value of i = 2
14497 -- CORE 0 - Value of i = 2
4212 -- CORE 1 - Value of i = 3
15901 -- CORE 0 - Value of i = 3
5616 -- CORE 1 - Value of i = 4
17305 -- CORE 0 - Value of i = 4
7020 -- CORE 1 - Value of i = 5
18709 -- CORE 0 - Value of i = 5
8424 -- CORE 1 - Value of i = 6
20113 -- CORE 0 - Value of i = 6
9828 -- CORE 1 - Value of i = 7
21517 -- CORE 0 - Value of i = 7
11232 -- CORE 1 - Value of i = 8
22921 -- CORE 0 - Value of i = 8
12636 -- CORE 1 - Value of i = 9
24325 -- CORE 0 - Value of i = 9
User avatar
XMatt
XCore Addict
Posts: 147
Joined: Tue Feb 23, 2010 6:55 pm

Post by XMatt »

Ok I will have to investigate the other issue, im am suspecting that running a single core binary with xscope enabled (which is what you get without the multicore main) on a dual core device is producing the issue you are seeing. The example you have should give you a framework to start using xscope on your board. Let me know if there are any other issues. There are some examples here which may help https://github.com/xcore/sw_xscope_examples.

Matt
Redeye
XCore Addict
Posts: 131
Joined: Wed Aug 03, 2011 9:13 am

Post by Redeye »

Matt,

I've just tried compiling and running this code :

Code: Select all

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

void xscope_user_init()
{
	  xscope_register(2,
			XSCOPE_CONTINUOUS , "Microphone Left", XSCOPE_UINT , "mV",
			XSCOPE_CONTINUOUS , "Microphone Right", XSCOPE_UINT , "mV" );
}

void thread1()
{
	while(1)
	{
	    int sample;
	    sample++;
	    xscope_probe_data_pred(0, sample);
	}
}

void thread2()
{
	while(1)
	{
	    int sample;
	    sample++;
	    sample++;
	    xscope_probe_data_pred(1, sample);
	}
}

int main()
{
  par
  {
		on stdcore[0]: thread1();
		on stdcore[1]: thread2();
  }
}
Which compiles fine, but when I run :

xrun --xscope-file "test.xmt" --xscope-limit 1000 --verbose xscopetest.xe

it seems to hang xgdb - it goes totally unresponsive. This is similar to what I was seeing yesterday when I was trying to get XScope going - XDE kept hanging and then trying to melt my Macbook. It also seems very flaky at picking up the XTAG2 - sometimes it says it can't find a device even when it's just run fine. I'm beginning to wonder if it isn't the XTAG2. I've only just got this kit which was sent direct from Hong Kong to me.