miiInterrupt exception

Technical questions regarding the XTC tools and programming with XMOS.
goodfeather
Member++
Posts: 23
Joined: Wed Mar 30, 2016 11:10 am

miiInterrupt exception

Post by goodfeather »

Dear Sirs,
Due to troubles with lib_xtcp/lib_ethernet, we try to run X200 on module_ethernet and module_xtcp.

An exception happens when miiInterruptHandler() calls miiClientUser() as the picture shows. Disassembly shows that the exception seems due to "std r5, r4, sp[0x0]" which asks for SP to be double-word aligned. At this time, SP is only single-word aligned and it points to miiData's last word.
ET_LOAD_STORE EXCEPTION.png
It has no effect if adding -mno-dual-issue in module_xcc_flags. Please kindly help me to fix this exception.

Many thanks
You do not have the required permissions to view the files attached to this post.


peter
XCore Addict
Posts: 230
Joined: Wed Mar 10, 2010 12:46 pm

Post by peter »

Hi goodfeather,

Thanks for reporting this. I think we'll need some more information to be able to help you on this one. I have looked at a binary using lib_ethernet and all the entsp/extsp instructions are double-word aligned so I am struggling to see how you are getting a non double-word aligned stack pointer.

What version of the tools are you using?

Could you run this using xgdb and give us the output of running the following commands (back trace, register file contents and disassembly) at the time of the error:

Code: Select all

xgdb BINARY
connect
run
... wait for exception ...
bt
info reg
disass
q
If you are able to give us your binary as well or even better a way to reproduce this then that would be great.

Regards,

Peter
goodfeather
Member++
Posts: 23
Joined: Wed Mar 30, 2016 11:10 am

Post by goodfeather »

Dear Peter,
Thanks for your quick reply! We also checked that lib_ethernet is double-word aligned.

Now we want to run XL208 with module_ethernet instead of lib_ethernet due to some unstable issues. SliceKit is OK on the same Studio14 environment. The disassembly is different as the picture shows.

If you need more info, please let me know.

Thanks
You do not have the required permissions to view the files attached to this post.
peter
XCore Addict
Posts: 230
Joined: Wed Mar 10, 2010 12:46 pm

Post by peter »

Hi goodfeather,

There is something strange because your gdb output doesn't match in any way what you are seeing in the xTIMEcomposer. The PCs are not in the same range.

Clearly, if the disassembler is correct in the xTIMEcomposer then that will be the issue because it is doing

Code: Select all

entsp 0x5
which will result in an non double-word aligned stack.

Can you give more details of how the binary is being compiled? Does the disassembly look the same if you look at it using xobjdump?

Code: Select all

xobjdump -d BINARY
If you could add the 'disass' command to the xgdb output that would help align the register contents and instruction at the time of the trap.

Regards,

Peter
goodfeather
Member++
Posts: 23
Joined: Wed Mar 30, 2016 11:10 am

Post by goodfeather »

Dear Peter,
Sorry for me to confuse you. My last post shows you a Slicekit picture to see that Slicekit is OK in the same environment but XL208 is not. The disassembly of miiClientUser() is different.

I attached the files. Please kindly help check.

Thanks
You do not have the required permissions to view the files attached to this post.
peter
XCore Addict
Posts: 230
Joined: Wed Mar 10, 2010 12:46 pm

Post by peter »

Hi goodfeather,

I am wondering whether there is something else going on which is overwriting memory and causing this issue in a different way. The call stack doesn't really make sense, and I can't see how the stack is not dual-issue aligned.

I presume this fails quickly, and is easy to reproduce. One thing you could do is to put a breakpoint on the call to miiClientUser() and add commands to that to see whether that gives any more information:

Code: Select all

xgdb BINARY
connect
b miiClientUser
commands
bt
info reg
c
end
run
... wait for exception ...
bt
info reg
q
It would be interesting to see at what point the stack pointer becomes non word-aligned, and what the backtrace is at that point.

Regards,

Peter
goodfeather
Member++
Posts: 23
Joined: Wed Mar 30, 2016 11:10 am

Post by goodfeather »

Dear Peter,
Thanks for your help. We fix the unstable issue on lib_ethernet.

BTW, do you have any example code for customized exception handler? We want to reboot the system when exception.

Thanks
peter
XCore Addict
Posts: 230
Joined: Wed Mar 10, 2010 12:46 pm

Post by peter »

Hi goodfeather,

First of all, when you say that you have fixed the issue in lib_ethernet, is that an issue with the ethernet library that we should be fixing and releasing for others? If so, can you let us know what the issue and fix were?

I will get back to you soon on installing a custom exception handler.

Regards,

Peter
goodfeather
Member++
Posts: 23
Joined: Wed Mar 30, 2016 11:10 am

Post by goodfeather »

Dear Peter,
The unstable issue is due to our design bugs. We found out on your debugging advice.

Thanks
goodfeather
Member++
Posts: 23
Joined: Wed Mar 30, 2016 11:10 am

Post by goodfeather »

Dear Peter,
Do you have any advice for custom exception handler? Or do you have a better way to deal with run time exception? I want to re-start the system when exception happens.

Thanks