Help Compiling

New to XMOS and XCore? Get started here.
User avatar
rp181
Respected Member
Posts: 395
Joined: Tue May 18, 2010 12:25 am

Help Compiling

Post by rp181 »

I opened up XDE, and went to the LEDs in Sequence tutorial. I clicked "Automate this step", and it created the project. However, when I try to build it, I get

Code: Select all

**** Build of configuration Debug for project XC1A-Sequence-LED-Project ****

xmake all 
Building file: ../src/xc1a-sequence-led.xc
Invoking: XC Compiler
xcc -O0 -g -Wall -c -o "src/xc1a-sequence-led.o" "../src/xc1a-sequence-led.xc" "../XC-1A.xn"
../src/xc1a-sequence-led.xc: In function `main':
../src/xc1a-sequence-led.xc:16: error: `cledG' undeclared (first use in this function)
../src/xc1a-sequence-led.xc:16: error: (Each undeclared identifier is reported only once
../src/xc1a-sequence-led.xc:16: error: for each function it appears in.)
../src/xc1a-sequence-led.xc:16: error: `cled0' undeclared (first use in this function)
../src/xc1a-sequence-led.xc:16: error: `PERIOD' undeclared (first use in this function)
../src/xc1a-sequence-led.xc:16: error: `cled1' undeclared (first use in this function)
../src/xc1a-sequence-led.xc:17: error: parse error at end of input
xmake: *** [src/xc1a-sequence-led.o] Error 1
The tutorial code:

Code: Select all

#include <platform.h>

void tokenFlash (chanend left, chanend right, out port led, int delay, int isMaster) {
    timer tmr;
    unsigned t;

    if (isMaster) /* master inserts token into ring */
        right <: 1;

    while (1) {
        int token;
        left :> token; /* input token from left neighbor */
        led <: 1;
        tmr :> t;
        tmr when timerafter (t+ delay ) :> void;
        led <: 0;
        right <: token; /* output token to right neighbor */
    }
}

int main (void) {
    chan c0, c1, c2, c3;
    par {
        on stdcore [0]: { cledG <: 1;
                            tokenFlash (c0, c1, cled0, PERIOD, 1);
                        }
        on stdcore [1]: tokenFlash (c1, c2, cled1, PERIOD, 0);
	// other cores
    }
    return 0;
}
EDIT: Nevermind, I thought they were declared (Assumed tutorial example would be ready-to-run).


User avatar
kris
Experienced Member
Posts: 84
Joined: Mon Jan 18, 2010 2:52 pm

Post by kris »

Hi, appologies for this, they should indeed be compiling/ready to run without modification. Will sort this out.

Cheers,
Kris.