<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Christophe Nowicki &#187; NXC</title>
	<atom:link href="http://www.csquad.org/tag/nxc/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.csquad.org</link>
	<description>Just for fun</description>
	<lastBuildDate>Fri, 14 Jan 2011 08:32:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Build NXC programs under Debian GNU/Linux</title>
		<link>http://www.csquad.org/2008/06/12/build-nxc-programs-under-debian-gnulinux/</link>
		<comments>http://www.csquad.org/2008/06/12/build-nxc-programs-under-debian-gnulinux/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 22:50:05 +0000</pubDate>
		<dc:creator>cscm</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Robotics]]></category>
		<category><![CDATA[LEGO]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[NXC]]></category>

		<guid isPermaLink="false">http://www.csquad.org/?p=59</guid>
		<description><![CDATA[This document explain how to build and load an Not eXactly C program for the Lego Mindstoms NXT Robot under Debian GNU/Linux.
Introduction
Lego does not provide tools for building programs for the NXT under Linux.
I don&#8217;t like Bricxcc, because :

It looks like Visual Studio ;
runs only on Microsoft Windows ;
I&#8217;m more familiar with VIM, make and [...]]]></description>
			<content:encoded><![CDATA[<p>This document explain how to build and load an <i>Not eXactly C</i> program for the <a href="http://mindstorms.lego.com/eng/Overview/default.aspx">Lego Mindstoms NXT</a> Robot under Debian GNU/Linux.</p>
<h3>Introduction</h3>
<p>Lego does not provide tools for building programs for the NXT under Linux.<br />
I don&#8217;t like <a href="http://bricxcc.sourceforge.net/">Bricxcc</a>, because :</p>
<ul>
<li>It looks like Visual Studio ;</li>
<li>runs only on Microsoft Windows ;</li>
<li>I&#8217;m more familiar with VIM, make and GCC ;0)</li>
</ul>
<h3>Install the compiler</h3>
<p>Ths NXC compiler can be downloaded on the <a href="http://bricxcc.sourceforge.net/nbc/beta/index.html">Bricxcc</a> web site. The compiler is writen in Pascal.</p>
<p>You need to install the <a href="http://www.freepascal.org/">FreePascal Compiler</a> and build the compiler :</p>
<p><code><br />
$ wget http://downloads.sourceforge.net/bricxcc/nbc-1.0.1.b34.src.tgz<br />
# apt-get install fp-compiler fp-units-fcl fp-units-base<br />
$ mkdir nbc<br />
$ tar xzf nbc-1.0.1.b34.src.tgz -C nbc<br />
$ cd nbc/nxt<br />
$ make -f nbclinux.mak<br />
$ ./nbc<br />
Next Byte Codes Compiler version 1.0.1.b34 (1.0.1.34, built Thu Jun 12 21:21:22 CEST 2008)<br />
     Copyright (c) 2006, John Hansen<br />
Use "nbc -help" for more information.<br />
# mv nbc /usr/local/bin/<br />
</code></p>
<h3>Hello world</h3>
<p>Let&#8217;s try to build and send a simple hello world program to the robot :</p>
<p><code><br />
$ cat > hello.nxc < <EOF<br />
task main() {<br />
        TextOut(0, 0, "Hello world!");<br />
        Wait(1000);<br />
}<br />
EOF<br />
$ nbc hello.nxc -O=hello.rxe<br />
</code></p>
<h3>USB Transfert</h3>
<p>In order to send the program to the robot, you need the Talk 2 NXT program : <a href="http://www-verimag.imag.fr/~raymond/edu/lego/t2n/"> T2N</a>.</p>
<p><strong>Warning</strong>: on amd64, you need to patch the source code.</p>
<p></code><code><br />
# apt-get install g++ libusb-dev<br />
$ wget http://www-verimag.imag.fr/~raymond/edu/lego/t2n/t2n-0.2.src.tgz<br />
$ wget http://www.csquad.org/wp-content/t2n_amd64.diff<br />
$ cd t2n-0.2.src<br />
$ patch -p1 < ../t2n_amd64.diff<br />
patching file src/usbmisc.cc<br />
patching file src/usbmisc.h<br />
$ make<br />
# mv obj/t2n /usr/local/bin/<br />
</code></p>
<p>Now you can plug, turn on your NXT and send the program via the USB port.</p>
<p></code><code><br />
# t2n -i<br />
#### NXT INFOS ###############<br />
protocol version=1.124 firmware version=1.1<br />
NXT Name: NXT<br />
Blutooth address: 16:53:06:37:ffffffbc:00<br />
Blutooth signal: 0<br />
Free user flash: 44416<br />
# t2n -v -put  hello.rxe<br />
nxt brick found, usb initialized<br />
testing for existing file "hello.rxe"<br />
deleting for existing file "hello.rxe"<br />
upload hello.rxe (376 bytes) from /goinfre<br />
that's all folks...<br />
</code></p>
<p>That&#8217;s all folks&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csquad.org/2008/06/12/build-nxc-programs-under-debian-gnulinux/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

