GCC nxt makefile

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
sega16
Posts: 3
Joined: 04 Nov 2012, 21:43

GCC nxt makefile

Post by sega16 »

I have tried nxc before but well... it is not exactly c meaning that it does not support everything that c supports mainly pointers. I want to write a mod player for the nxt and to do that you need pointers to access the sound hardware directly. Does anybody have a makefile template that I could use to program the lego nxt robot with gcc I am running Debian gnu/linux right now.
hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

Re: GCC nxt makefile

Post by hassenplug »

I don't think it's quite that easy. The compiler needs to have knowledge about the target, in more ways that just that.

Also, the target would be the NXT, which means you'll need to replace ALL the software/firmware in the NXT, not just writing a simple program to run on the existing firmware (because it may be the firmware that has that limitation)

Steve
---> Link to lots of MINDSTORMS stuff under my picture --->
sega16
Posts: 3
Joined: 04 Nov 2012, 21:43

Re: GCC nxt makefile

Post by sega16 »

hassenplug wrote:I don't think it's quite that easy. The compiler needs to have knowledge about the target, in more ways that just that.
That is why I wanted a ready made makefile because I am not sure of the executable format that the nxt uses.
hassenplug wrote: Also, the target would be the NXT, which means you'll need to replace ALL the software/firmware in the NXT, not just writing a simple program to run on the existing firmware (because it may be the firmware that has that limitation)

Steve
I do not understand why the firmware could be a limitation does it not just jump to the program address or is there more or could the programs be run-time interpreted like java and not native arm code.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: GCC nxt makefile

Post by mattallen37 »

The Lego NXT FW runs programs with the .rxe extension (very specific to the NXT).

The FW is not just a boot-loader with a menu. It's a VM that runs the VM OP codes of the user program (.rxe file). The FW VM takes care of user-code multitasking, as well as it's own tasks (updating the LCD, talking with the co-processor, etc.).

At the request of Sivan Toledo, John Hansen has added FW functionality for what you seem to want (in the NBC/NXC Enhanced FW); see here. A normal .rxe file header starts with "MindstormsNXT", but if it starts with "NXTBINARY" instead, then the FW jumps to the function specified, and totally abandons everything else. That means that the user program is now responsible for everything! The user program now needs to take care of any multitasking, LCD updates, co-processor updates, etc. Simply restarting the NXT will boot the FW as usual. From the directions provided, I wasn't able to gather enough details to actually make it work, and Sivan didn't answer an email I sent him requesting assistance. If you get anywhere, please tell us about it!
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
pbenco
Posts: 71
Joined: 29 Sep 2010, 09:43
Contact:

Re: GCC nxt makefile

Post by pbenco »

Hello

Once again, google is your friend!!!

for compiling with NXT GCC ELF program: http://www.jstuber.net/lego/nxt-program ... chain.html
for building GCC ARM EABI toolchain : http://nxt-firmware.ni.fr.eu.org/build/gcc/

Hope this help
Ben
pbenco.wordpress.com/
sega16
Posts: 3
Joined: 04 Nov 2012, 21:43

Re: GCC nxt makefile

Post by sega16 »

Thank you everyone I will be reading up on these links that you guys posted and I will certainly have something working sooner or later.
tcwan
Posts: 186
Joined: 30 Sep 2010, 07:39

Re: GCC nxt makefile

Post by tcwan »

sega16 wrote:Thank you everyone I will be reading up on these links that you guys posted and I will certainly have something working sooner or later.
If you want to program native C on the NXT, there are three free options available:

NXT Native http://www.tau.ac.il/~stoledo/lego/nxt-native/ (This is quite bare-bones, just enough to configure the hardware)
NxOS-Armdebug https://github.com/tcwan/nxos-armdebug (uses same mechanism as Sivan Toledo's approach to download and run executables on the NXT)
nxtOSEK http://lejos-osek.sourceforge.net/

Disclaimer: I'm the current maintainer for NxOS-Armdebug.
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 13 guests