xrun: Program received signal ET_ILLEGAL_PC, Illegal program

If you have a simple question and just want an answer.
tomshannon
Member
Posts: 10
Joined: Fri Jan 29, 2016 10:00 pm

xrun: Program received signal ET_ILLEGAL_PC, Illegal program

Post by tomshannon »

Hello all,

I am writing a data acquisition program that writes data from the XMOS StartKit's ADC lines to a micro SD card. I seem to be running into this error when trying to write a buffer to the micro SD CARD.
Screen Shot 2016-06-01 at 6.11.38 PM.jpg
It seems to be stopping after I fill the buffer and go to uplink the data in this function:
Screen Shot 2016-06-01 at 6.14.56 PM.jpg
I use this data_write() function in another function called app() here:
Screen Shot 2016-06-01 at 6.16.50 PM.jpg
If anyone could help, I would greatly appreciate it.

Tom
You do not have the required permissions to view the files attached to this post.
User avatar
infiniteimprobability
Verified
XCore Legend
Posts: 1164
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

HI,
I'm afraid I have no experience of that codebase, but from the exception type, my guess is that you have an out of bounds array write or something... Anyhow, you need more visibility so time to debug.

The PC is indeed illegal - it's odd aligned which would only happen if you had code trampled over. It looks like data rather than valid address.

RAM starts at 0x10000 (we don't use 0x00000 specifically so we can catch null pointers as this address range will cause an exception) and code is at the bottom of this space. RAM and stack are at the top so 0x1FFFC and below.. 0x48c148c1 is very much not a valid address!

You need to get some more visibility of what has happened so either run xgdb from the command line or use the debugger (Debug As) in the GUI.

Also read this https://www.xmos.com/published/how-find ... using-xgdb

This may be useful too if you prefer the GUI over command line

https://www.xmos.com/download/private/U ... 8590A).pdf

Find out what the contents of the SPC (save program counter) are, which will hopefully track down the section of code (I'm guessing C as XC has array bounds checks as standard) which caused the issue..

If you are using xgdb command line, once you can also set hardware memory access breakpoints by typing watch <my address> eg. watch 0x1fefc. You can place these at the end of arrays and see when bounds are exceeded.

Good luck!