Since transitioning to Ubuntu Linux, I’ve continued working on my Lego NXT projects. I spent several hours figuring out how to configure my machine to write, debug, and upload code to the NXT brick. I found several sites and message board posts, each detailing a specific step in the process. I thought it would be a good idea to bring all of this information together and hopefully make it easy for anyone else who wishes to follow in my footsteps.
The entire process consists of setting up a Windows emulator (WINE), installing an IDE (BricxCC), and installing and running a communications tool between linux and the brick (Talk2NXT).
1.) install WINE
sudo apt-get install wine
2.) install bricxCC
a. download from sourceforge: http://sourceforge.net/projects/bricxcc/files/bricxcc/
[UPDATE]At some point, Ubuntu required that all software not coming from a trusted repository be blocked unless the permissions were changed to “executable”. Explanation here. The only change is that the bricxccinstall.exe file will need to be chmod777’ed.[/UPDATE]
b. right click and select “Open with ‘Wine Windows Loader Program’ ”
c. complete the Windows-like installer
At this point, in the BricxCC GUI, try to compile some code and save it as a .NXT. If this works then you’re ready talk to the Brick.
3.) get Talk2NXT
apt-get install g++ libusb-dev
tar -xzvf t2n-0.2.src.tgz
mv obj/t2n /usr/local/bin/
4.) physically connect the NXT Brick via USB, and turn on the Brick
5.) test connection
NXT INFOS ###############
protocol version=1.124 firmware version=1.1
NXT Name: NXT
Blutooth address: 16:53:00:23:74:00
Blutooth signal: 0
Free user flash: 115536
6.) not necessary, but list the files on the NXT Brick
7.) Generate .rxe files.
If you have any files uploaded from before (maybe under a Windows usage) you’ll see that the program files are .rxe even though BricxCC saves files as .nxc. We now need to generate .rxe files from the code, so that the Brick will know what to do. When you upload through BricxCC in Windows, it autmatically generates a .rxe file from the .nxc. We can do this easily during compiling. In BricxCC GUI
Edit->Preferences->General->Save compiler output
8.) Upload a .rxe file, in terminal
t2n -put do_something.rxe
9.) List files on the brick to confirm that the upload was completed
I certainly can not claim any credit for this except for bringing it all together. Credit goes to: