Limitations on [[combinable]] in xC

Technical questions regarding the XTC tools and programming with XMOS.
Hagrid
Active Member
Posts: 44
Joined: Mon Jul 29, 2013 4:33 am

Limitations on [[combinable]] in xC

Post by Hagrid »

Having developed my application in small pieces, I am now doing the dreaded integration of said pieces...

The code is all running OK, as long as I don't attempt to combine functions onto cores.

Currently, it is broken into 7 "driver" functions (so far) and one application function. Interfaces (11 so far) are used extensively between the drivers and the application. It is complicated.

Code: Select all


int main( void )
{

    interface iface_graphics igraphics[2];
    interface iface_touch_event itouch_evt;
    interface iface_touch_control itouch;
    interface iface_font ifont;
    interface iface_sdcard isd;
    interface iface_flash iflash;
    interface iface_Display idisplay;
    interface iface_ui iui;
    interface iface_stepper istepper;
    interface iface_gpout igpout[1];
    interface iface_sensor isensor;

    par
    {
        on tile[0]: application( iui, igraphics[0], isd, iflash, istepper, isensor );
        on tile[0].core[1]: GraphicsDriver( igraphics, 2, idisplay, ifont );
        on tile[0].core[2]: DisplayDriver( idisplay );
        on tile[0].core[3]: UserDriver( iui, igraphics[1], itouch_evt, itouch );
        on tile[0].core[4]: DisplayAuxDriver( itouch_evt, itouch, ifont, isd, iflash );
        on tile[0].core[5]: StepperDriver( istepper, igpout[0] );
        on tile[0].core[6]: GPOutDriver( igpout, 1 );
        on tile[0].core[6]: SensorDriver( isensor );
    }
    return 0;
}
All the drivers are marked as [[combinable]] and follow the designated pattern, such as:

Code: Select all

out port gpport = GPOUTPORT;
[[combinable]]
void GPOutDriver( server interface iface_gpout p[n], unsigned n )
{
    unsigned int state = 0;
    gpport <: state;
    while(1)
    {
        select
        {
        case p[int i].Update( unsigned int mask, unsigned int value ):
            state = ( state & ~ mask ) | (value & mask );
            gpport <: state;
            break;
        }
    }
}
The above driver function was intended to be [[distributable]] and this fails. I have to change to [[combinable]] to make it work - but then only if I don't attempt to combine it with anything else.

The problem is that if I attempt to combine drivers onto cores, I get the application hanging. No compile-time errors, no runtime exceptions. Just the code reaches some point and stops.

Only in one driver do I get a compiler error when attempting to deploy the driver sharing a core:

Code: Select all

../src/Application.xc: Error: Undefined reference to 'DisplayDriver.select.0.enable.cases'
Two of the driver functions don't even deal with ports directly. If I try to combine these drivers, I get this little gem:

Code: Select all

xcc1: terminated due to internal unrecoverable error
For bug reporting instructions, please see:
http://www.xmos.com/support
Unless I can figure out what I am doing wrong that is preventing the drivers from combining, I am stuck as I have run out of cores and need at least two more. I believe that I should be able to combine functions right now across 3 or maybe 4 cores, so should have plenty to spare.

Hardware platform is startKit. Software is Community Ed 13.2.1.

I am looking for any kind of hint as to where to start looking.


User avatar
davelacey
Experienced Member
Posts: 104
Joined: Fri Dec 11, 2009 8:29 pm

Post by davelacey »

The second error is definitely a compiler bug. Could you report it here?

https://www.xmos.com/support/contact/report-a-bug

Dave