Multi-node simulations?

Technical questions regarding the XTC tools and programming with XMOS.
m_y
Experienced Member
Posts: 69
Joined: Mon May 17, 2010 10:19 am

Post by m_y »

Jamie wrote:Just a couple more simulator-related issues:
Does it mean anything when the simulator spits out a '^@' character mid-trace:

Code: Select all

^@0@0@0   A-.----00010336 (initSystem          +  6) : ldw     r1(0x1), sp[0x0] L[0x1eff4] @4315
I've not seen it do that by accident. The most likely thing is that it's emerged from stdout or stderr. When doing a trace these streams get mixed in with the trace. Most commonly one gets one character at a time and at the start of a line (and not necessarily at exactly the instruction which caused it).

It's likely this is connected with the other message you're seeing...
And, I'm not sure what to make of this:

Code: Select all

ERROR: Unimplemented OS call '-9'
as it's not clear what's causing it, unlike a TRAP or ECALL which give a location and time.
The simulator deals with system calls by placing a pseudo break-point at the address of _DoSyscall. The address of _DoSyscall is loaded from the ELF for each core. I would guess that you've hit this address by accident with some register values which the simulator doesn't understand.

I assume your application ELF doesn't define _DoSyscall however the network setup ELF does define it and it seems that xsim is using that address even after loading your application.

There are two workarounds that spring to mind both of which have essentially the same effect: (1) Add a label named _DoSyscall in your app at a location the PC will never reach, or (2) Pass "--defsymbol _DoSyscall=0" to the linker (and don't jump to the NULL pointer!).

N.B. The pseudo break-point actually has some extra "magic" in it which makes it especially confusing when you hit it by accident. From memory, it performs the syscall function and then pretends the following instruction is a retsp. Thus control moves to the location pointed to by LR which is likely to be the address after the last branch-link instruction executed.


User avatar
Jamie
Experienced Member
Posts: 99
Joined: Mon Dec 14, 2009 1:01 pm
Contact:

Post by Jamie »

The simulator deals with system calls by placing a pseudo break-point at the address of _DoSyscall. The address of _DoSyscall is loaded from the ELF for each core. I would guess that you've hit this address by accident with some register values which the simulator doesn't understand.

I assume your application ELF doesn't define _DoSyscall however the network setup ELF does define it and it seems that xsim is using that address even after loading your application.
That makes sense -- it seems the _DoSyscall symbol is persisting even after the second binary is loaded. My loadable 1 contains:

Code: Select all

<_DoSyscall>:
    0x00010180: c0 77:       retsp (u6)      0x0
    0x00010182: 00 00:       stw (2rus)      r0, r0[0x0]
Then when the execution of loadable 2 gets to 0x00010180:

Code: Select all

@4532	   A-.----0001017a (_master             + 10) : bu      0x1 
@4533	   A-.----00010180 (initMaster          +  0) : retsp   0x0 L[0x1eff8] 
@4534	   A-.----0001017a (_master             + 10) : bu      0x1 
@4535	   A-.----00010180 (initMaster          +  0) : retsp   0x0 L[0x1eff8] 
You get a very confusing retsp at 0x00010180!

As you suggested, changing the value of _DoSyscall to an inaccessible pc fixes the problem.

Thanks again :)
Post Reply