Build issue with streaming channels

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
User avatar
aleonard
Member
Posts: 15
Joined: Thu Sep 16, 2010 8:19 pm

Build issue with streaming channels

Post by aleonard »

I'm getting a strange build issue when using streaming channels. The issue is intermittent, sometimes the project builds with no problems, and sometimes this issue appears.

Here is the error:
In file included from ../src/UDPServer_support.c:52:
../src/UDPServer.h:54: error: expected ')' before 'chanend'
../src/UDPServer_support.c: In function 'UDP_send':
../src/UDPServer_support.c:178: warning: passing argument 4 of 'xtcp_send_buffer_firefly' from incompatible pointer type

here is the top of the UDPServer.h file, line 54 is the last line in the post:

Code: Select all

#define NUM_UDP_CHANNELS	    2
#define SEND_PORT		    8
#define RECEIVE_PORT		    9

#define ETH_NOT_INITIALIZED 2
#define SENDING_PACKET		0
#define ETH_READY			1

void UDP_Server(streaming chanend D0, chanend tcp_svr, port led);
so not much is happening before this line error.
the second error in the UDPServer_support.c file @178 is somehow being affected by the first error, as in the error in the include of UDPServer.h then messes up subsequent dataset definitions, as the pointer type is definitely fine.
If I take out the streaming channel definition, the problem goes away.
I have other streaming channels defined elsewhere in the project without issue.

Again, the build issue is intermittent. It seems too bizarre. But I'm at a loss as to what to debug. Any ideas?


User avatar
segher
XCore Expert
Posts: 844
Joined: Sun Jul 11, 2010 1:31 am
Contact:

Post by segher »

This is a C file, not XC. "streaming" is not a keyword or macro ("chanend" is
a macro, defined as "unsigned", in xccompat.h).

Intermittent is strange. It sounds like you are not always actually compiling
this file when you think you do.
User avatar
aleonard
Member
Posts: 15
Joined: Thu Sep 16, 2010 8:19 pm

Post by aleonard »

ah, yes this is the problem. Thanks!
User avatar
aleonard
Member
Posts: 15
Joined: Thu Sep 16, 2010 8:19 pm

Post by aleonard »

It turns out that xccompat was already included via another .h file. I needed to surround the streaming channel definition with #ifdef __XC__ in order for the .c file to compile as in:

Code: Select all

#ifdef __XC__
void UDP_Server(streaming chanend D0, chanend tcp_svr, port led);
#endif
I think chanend is defined in xccompat.h but streaming is not.
Post Reply