xSCOPE link fails on xCORE-200

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
cl-b
Active Member
Posts: 44
Joined: Fri Sep 15, 2017 2:58 pm

xSCOPE link fails on xCORE-200

Post by cl-b »

Hi,

I try to use xSCOPE to trace data in my application based on xCORE-200 MC AUDIO evaluation board. I would like to use xscope_start() and xscope_stop() functions but application build always fails with the following error
xscope_probe_xlink.S:(.text+0x3e): Error: value 0x00000291 for relocation R_XCORE1_DP_REL6 is out of range
C:\Users\user\AppData\Local\Temp\sod_2: Error: relocation with respect to '__sodEnd'
xSCOPE initialisation

Code: Select all

void xscope_user_init()
{
    xscope_register(1,
            XSCOPE_STARTSTOP, "Function1", XSCOPE_UINT, "Units"
            );
    xscope_config_io(XSCOPE_IO_BASIC);
}
xSCOPE in XN file

Code: Select all

  <Nodes>
    <Node Id="2" Type="device:" RoutingId="0x8000">
      <Service Id="0" Proto="xscope_host_data(chanend c);">
        <Chanend Identifier="c" end="3"/>
      </Service>
    </Node>
  </Nodes>
  <Links>
    <Link Encoding="2wire" Delays="4,4" Flags="XSCOPE">
      <LinkEndpoint NodeId="0" Link="XL0"/>
      <LinkEndpoint NodeId="2" Chanend="1"/>
    </Link>
  </Links>
If I use xscope_int instead of xscope_start and xscope_stop, compilation is OK

Application is compiled with xTIMEcomposer 14.3.2

Thanks


robertxmos
XCore Addict
Posts: 169
Joined: Fri Oct 23, 2015 10:23 am

Post by robertxmos »

Hi cl-b,

Yes, the problem is with the linking.
The linker is trying to fit the relative distance 0x00000291 into an instructions that takes 6bits immediate viz: R_XCORE1_DP_REL6.
This should only be a problem if your data pool (DP) is larger than 2^6*4bytes = 256bytes.
The value 0x291 (word offset) suggest you have at least 657 bytes - very reasonable!

The solution is to either
1. Reorder you data pool so that '__sodEnd' comes early.
  • This can be done by including xscope_probe_xlink.S earlier in the list of include files.
    Try adding the following to your Makefile (relative location of xscope_probe_xlink.o may need adjusting - look in your .build directory):

    Code: Select all

    XCC_EXTRA_MAP_FLAGS = -Xmapper --first -Xmapper xscope_probe_xlink.o
2. Fix the underlying problem of using a 6bit immediate.
  • I believe the problem may be due to xscope_probe_xlink.S (line 558) doing a 'ldwdp' in dual issues - forcing it to use a smaller instruction/immediate.

    Code: Select all

    xscope_stop_int_chan_init:
    {ldw     r2, dp[__sodEnd] ; getr    r3, 2}
    I believe that unbundling the instruction will fix things by allowing the use of a R_XCORE1_DP_REL16 (256K byte offsets) viz:

    Code: Select all

    xscope_stop_int_chan_init:
    ldw     r2, dp[__sodEnd]
    getr    r3, 2
I will log your report as a bug.
If you are happy to try #2 out I would be pleased to know if this fixes the bug.

robert
cl-b
Active Member
Posts: 44
Joined: Fri Sep 15, 2017 2:58 pm

Post by cl-b »

Hi Robert,

Thanks for your answer.
Both solutions are not working because I cannot find xscope_probe_xlink.S file. Is it normal ?

Claire
Post Reply