GCC toolchain

To compile NXT Improved Firmware, you need a toolchain targeting the ARM processor used in the NXT. The toolchain includes:

  • the compiler which transforms C files to machine code (GNU GCC),
  • the assembler which transforms assembly files to machine code (GNU as),
  • the C and math libraries (newlib),
  • the linker which gathers object files (GNU ld),
  • other miscellaneous utilities (GNU binutils).

Firmware source code relies on some assumptions about compiler behaviour (struct packing and size for example), therefore you need a compiler using the new ARM EABI binary format (see FAQ).

If you already have a GCC ARM toolchain using the old APCS binary format (like GNUARM, WINARM, old YAGARTO or NXTGCC), do not use it, NXT firmware will not work using theses compilers.

So please use an ARM EABI GCC toolchain.

See GCC installation for details about how to install your toolchain.

Download NXT Improved Firmware sources

By accessing NXT Improved Firmware, you accept the license.

Using git, clone the main repository:

git clone http://git.ni.fr.eu.org/nxt-firmware.git/

Alternatively, you can download a source tarball and extract it on your computer. However using git would help you to track your changes and to share them with other people. If you choose this path anyway:

tar xzf nxt-firmware-master.tar.gz

If you are not comfortable using a command line, you can of course use the GUI of your choice.

See sources for more details about sources and git usage.

Use the Makefile to build the firmware

NXT Improved Firmware uses GNU Make for its build system. Go to the AT91SAM7S256/SAM7S256/gcc directory and run make:

cd AT91SAM7S256/SAM7S256/gcc
make

If your compiler prefix is not arm-none-eabi-, define the CROSS_COMPILE variable when calling make:

make CROSS_COMPILE=my-arm-eabi-

This will produce a file named nxt_firmware.bin which can be downloaded to the NXT brick to replace the firmware. Warning: this will erase every files in the brick user file system. If you want to keep any of the user or program files in the NXT, please copy it to your PC using John Hansen's NeXTTool or equivalent before replacing the firmware.