Minimum hello world in C

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Minimum hello world in C

Post by Folknology »

What is the minimum hello world program in C running on XS1?

Code: Select all

#include <stdio.h>
int main(void)
{
  printf("Hello XS1 from C");
  return 0;
}
What I mean is what do I need apart from the above C code, ie minimum requirements tool chain/library wise?

PS Assume I have a dev board and I'm running Linux, I am looking for absolute minimums and pref from source so only what I need for this example.

regards
Al


User avatar
leon_heller
XCore Expert
Posts: 546
Joined: Thu Dec 10, 2009 10:41 pm
Location: St. Leonards-on-Sea, E. Sussex, UK.

Post by leon_heller »

I'd use puts instead of printf. The latter requires a lot of code.
Heater
Respected Member
Posts: 296
Joined: Thu Dec 10, 2009 10:33 pm

Post by Heater »

I posted a "hello world" program for XC to wikibooks here:
http://en.wikibooks.org/wiki/Computer_P ... o_world#XC

The idea was the a "Hello World" for the xcore would at least implement a UART transmitter so as to be able to get the message out to a terminal.

The "hello world" I posted has a UART thread and a "greeter" thread that generates the message. But that was only to show of some XC features other wise it would just be the same as the C version.

Actually I'd like to know what happens when you call printf. Seems to put the xcore into some kind of DEBUG mode whilst it's outputting. All very drastic.