nxt bricks
This past weekend, I fixed “Sid”. Though, I had to downgrade some parts to upgrade some other parts. How does one do more with less? Anyways, my laptop is ready for action. First thing on my to do list was to write and compile nxc code natively from linux so I don’t need to jump over to windows or wine the Brickxx gui. Also, if I can convince my school to ditch windows and cross on over to linux, I could use this as an argument to how we wouldn’t lose productivity in our robotics class.
the NBC complier is not really supported anymore. The last version released is technically a test version. Also, I haven’t tested this out with EV3 bricks yet. Some serious configurations would need to be required (so much for my cross over argument).
Go here: https://sourceforge.net/projects/bricxcc/files/NBC_NXC/NBC%20release%201.2.1%20r4/
So yeah, the NXT brick came out almost a generation ago, literally one or two human generations ago. The first time I used one was in a college robotics lab back in the fall of 2008. Back then, these were ‘rad’. 4 years later, the EV3 model comes out, and since then Lego hasn’t really released anything new. For context, it’s currently 2018. Development on this compiler stopped 7 years ago, and we’re going to need 64bit versions of some dependencies to get it working on a 64-bit linux OS.
So just untar the version you unloaded from above, and cd the NXT folder. The file should already be reconfigured as an executable. In the test folder, a file called “struct.nxc” is ready. You can open it up with vim to check it, but once your satisfied with its conetents, just connect the USB to your nxt and laptop, and envoke
nbc -d -EF struct.nxc
If all goes well, you’ll hear the double download beep (if your nxt settings didn’t mute the buzzer).
But there are some traps to look out for. You probably would want to cd into the nbc executable file location and set a path to the struct.nxc file.
nbc -d -EF ../test/struct.nxc
something like that would work. But ideally, you would want to cd into the struct.nxc file and have the nbc command ran by your terminal (or IDE) set locally. To do this, cd into your NXT directory, and
sudo mv nbc /user/local/bin/nbc
Now your terminal or IDE should invoke nbc command from anywhere.
which nbc
this will verify you’re not using another program.
Another hic-up you might encounter is that the nbc complier seems to have been made for a 32bit OS. Which means when you try to run the nbc complier you’ll read
joule@sid:~/Programs/nbc-1.2.1.r4/NXT$ ./nbc ./nbc: error while loading shared libraries: libusb-0.1.so.4: cannot open shared object file: No such file or directory joule@sid:~/Programs/nbc-1.2.1.r4/NXT$
Really, all you need to do is find the proper library and install it. This will work for a debian machine.
apt-get install libusb-0.1-4:i386
But to get access to the non 64 bit libraries you need to make changes to how apt-get looks for dependencies. This could mean making changes to your /etc/apt/sources.list If you’ve made the appropriate changes in the past, then running the previous command won’t be an issue. However, if this is your first time making changes to your source.list, beware.. Another way to solve it is to simply add another aricheture to your dpkg.
The second solution is easy, simply type
sudo dpkg --add-architecture i386
The first solution is a bit more involved
First, make a copy of your source list
cd /etc/apt/ sudo cp source.list source.list.year.may.month.time sudo vim/emac/w/e
You’ll want to find a repo that you trust that has the required 32-bit version. It’s been about 7 years since the last complier release, and in another 7 those libraries might go missing forever. If you’d like to read more about library architecture support, you can read this article.
https://wiki.debian.org/Multiarch
Okay, so you have everything installed, and everything is working. Congratulations. You’ve heard the double beep sound and your code is saved on the brick. Press the orange button, go to My files –> Software Files —> and look for “struct”.
Now, how to edit it?