nxtOSEK Installation in Linux (Ubuntu 11.10/10.04/9.10/8.10)

 

1. Build and Install GNU ARM

2. Set up nxtOSEK

3. Install the Enhanced NXT firmware on NXT

  • a. Installation of the Enhanced NXT firmware under windows
  • b. Installation of the Enhanced NXT firmware under linux

4. Setup nxtOSEK program upload software with enhanced firmware

  • a. NeXTTool (building from source)
  • b. NeXTTool (pre-built executable)

 

DISCLAIMER: this installation procedure is provided "as is" with no guarantees.
Author: loic Cuvillon (loic AT eavr.u-strasbg.fr).
Derivative work from 'nxtOSEK installation in Windows' page. The contributor is not affiliate with the nxtOSEK project.

 


1. Build and Install GNU ARM

GNU ARM is a distribution of GCC (GNU Compiler Collection) for ARM core and it supports the ARM7 CPU inside the NXT.
  • The complete process should take at least half an hour and finish with the message "Build complete !".

  • Install the required libraries by running the following command:

    ~$ sudo apt-get install tk-dev ncurses-dev libmpfr-dev texinfo

    • on ubuntu 8.10 only: gcc-4.2 (and dependencies) is also required

  • Download the script build_arm_toolchain.sh (for Ubuntsu 11.10, use the updated build_arm_toolchain.sh by Laoro Ojeda). This script is a modified version of the toolchain building script from the NxOS project. It will:
    • create SRC, BUILD and GNUARM directories in the current directory
    • download sources of binutils, gcc, newlib and gdb
    • compile them in place with the right options

  • Give a look at the script code before execution (safe behaviour), change GCC_BINARY_VERSION to 4.2 if you are under Ubuntu 8.10, and then run it:
  • ~$ sh ./build_am_toolchain.sh


  • Test the new gcc : this should be the output of arm-elf-gcc -print-multi-lib (hard and soft float support)
  • ~$ ./gnuarm/bin/arm-elf-gcc -print-multi-lib
    .;
    thumb;@mthumb
    fpu;@mhard-float
    interwork;@mthumb-interwork
    fpu/interwork;@mhard-float@mthumb-interwork
    thumb/interwork;@mthumb@mthumb-interwork


  • Note: At the end of the file build_am_toolchain.sh, one can find additional informations and command lines for step-by-step building.

 

 


2. Set up nxtOSEK
  • Package required:
    • wine, to execute toppers_osek/sg/sg.exe (parser of the .oil files)

    ~$ sudo apt-get install wine

  • Extract nxtOSEK in any directory.
  • Under ecrobot directory, update tool_gcc.mak file to specify with the variable GNUARM_ROOT the path to the installed GNU ARM directory.
  • # specify GNU-ARM root directory
    ifndef GNUARM_ROOT
    GNUARM_ROOT = /[absolute path to parent directory of gnuarm]/gnuarm
    endif

  • Test: change directory to nxtOSEK/samples_c/helloworld directory and build binary executables of helloworld sample

    ~$ cd ./nxtOSEK/samples_c/helloworld
    ~$ make all

    If everything went well, binary executables (helloworld.rxe) and program upload scripts should be generated in the directory.

  • Note: the option -Wno-inline can be added to CFLAGS and CXXFLAGS in the file ecrobot/tool_gcc.mak to remove all warnings about inline functions

 

 


3. Install the Enhanced NXT firmware on NXT

nxtOSEK supports three ways to upload a programm to the NXT and those are designed for different purposes. Each way requires installation of different software. Each way has pros and cons and it is strongly recommend to use John Hansen's Enhanced NXT firmware because it provides same GUI as the standard LEGO firmware and other programming languages (i.e. NXT-G, NBC/NXC) also can be used without replacing the firmware.
See the corresponding section in the Windows installation for more information on the 2 other ways.

 

Installation of the Enhanced NXT firmware is a one time procedure and may be safer under windows (but until now, the author never has troubles with firmware update and find it is easier under Linux).


a.Installation of the Enhanced NXT firmware for windows

  • Download LEGO MINDSTORMS NXT Driver v1.02 from LEGO software update website and execute setup.exe to install the driver along with instruction. During the installation, installer adds a USB driver to a Windows system directory, thus you need to provide an administrator right to your user account before installing the driver.

    Note that if LEGO standard programming software was already installed in the PC, there is no need to install LEGO MINDSTORMS NXT Driver.

  • Download John Hansen's (for windows) NeXTTool archive and extract it. NeXTTool is a console program and enables uploading of .rxe and .rfw files to the NXT.

  • Download John Hansen's Enhanced NXT firmware (any version numbered 106 or later) and store the Enhanced NXT firmware (lms_arm_nbcnxc_1xx.rfw ) to the directory where NeXTTool.exe is stored.

  • Open a command Prompt – go to Start => Run => and then type “cmd”. Use the command "cd" to go in the directory where NeXTTool.exe is stored.

  • Connect the NXT brick to the USB port and turn it on

  • To install the firmware, type the command below, where “lms_arm_nbcnxc_1xx.rfw” is the filename that you downloaded previously.
  • nexttool /COM=usb -firmware=lms_arm_nbcnxc_1xx.rfw

  • Troubleshooting: After completion of the upload, sometimes NXT display is messed and block : reboot it by a quick push on reset button (see below) or remove the battery. If the NXT makes a ticking sound, it is still in firmware upload mode.

  • To check that the firmware version of the NXT has changed to 1.xx, type:
  • nexttool /COM=usb -versions

    Protocol version = 1.124
    Firmware version = 1.xx



b.Installation of the Enhanced NXT firmware for Linux

Note: Nextool binary for Linux seems to fail for firmware upload.

  • Install required packages:
  • ~$ sudo apt-get install scons libusb-dev libusb-0.1-4


  • Download the libnxt archive and extract it. Go in the new directory and build the project with scons:

    ~$ cd libnxt-0.3/
    ~$ scons

    A program call fwflash is created.

  • Download John Hansen's Enhanced NXT firmware (any version numbered 106 or later includes the native-invocation feature) and store the Enhanced NXT firmware (i.e lms_arm_nbcnxc_1xx.rfw) in the directory where fwflash is stored.

  • Connect the NXT brick to usb and turn it on. Then press the reset button for more than 4s to put it in firmware upload mode (nxt display is cleared but it makes a ticking sound).

  • Flash the firmware with the following command (it takes some dozen of seconds), where 1xx is replaced by the number of the firmware:

  • ~$ sudo ./fwflash lms_arm_nbcnxc_1xx.rfw

  • Troubleshooting: After completion of the upload, sometimes NXT display is messed and block : reboot it by a quick push on the reset button or remove the battery. If the NXT makes a ticking sound, it is still in firmware upload mode. If troubles, use and see windows firmware update procedure (and LEGO UserGuide).


 


4. Setup nxtOSEK program upload software with enhanced firmware

a.NeXTTool (building from source)

  • Required Packages: libusb-0.1-4 libusb-dev fpc

    ~$ sudo apt-get install libusb-dev libusb-0.1-4 subversion fpc

    Note: fpc is the free pascal compiler

  • Download John Hansen's NeXTTool source from bricxcc repository. Revision 1 is known to work for usb and bluetooth (but last revision may also work even if there seems to be troubles with bluetooth) :

    ~$ svn co -r 1 https://bricxcc.svn.sourceforge.net/svnroot/bricxcc/ bricxcc


  • Compile NeXTTool:

    ~$ cd bricxcc
    ~$ make -f ./nexttool.mak

    NeXTTool binary is created in the current directory and can be moved anywhere.

  • Check the version of NeXTTool, it should be 1.0.1.0:
  • ~$ sudo ./NeXTTool
    nexttool version 1.0.1.0 (1.0.1.0)
    Copyright (c) 2006, John Hansen
    Use "NeXTTool -help" for more information.


  • Turn on the NXT, connect it to USB and run the following command to upload a nxtOSEK program:
  • ~$ sudo ./NeXTTool /COM=usb -download=helloworld/helloworld_OSEK.rxe


  • Troubleshooting: Test the following command to see if NeXTTool is working (set execution right for NeXTTool):
  • ~$ sudo ./NeXTTool /COM=usb -versions
    Protocol version = 1.124
    Firmware version = 1.xx


  • Optionnal 1: To upload over usb without being a priviledge user or To upload over bluetooth, you need to configure udev and define an alias name in a file 'nxt.dat' as explained in this post: Minsdtorm 2.0 development on linux . Then turn on the NXT and run the following command (example: helloword_OSEK.rxe) :
  • ~$ sudo ./NeXTTool /COM=alias_bt -download=helloworld/helloworld_OSEK.rxe


  • Optionnal 2: Building of nbc/nxc assembler/NX C compiler for NXT from brixcc directory (cd NXT; make -f nbcunix.mak). Please refer to this nice blog page on Minsdtorm 2.0 development on linux if you want to go further.


b.NeXTTool (pre-built executable)

  • Required Packages: libusb-0.1-4

  • Download this executable of John Hansen's NeXTTool (built from bricxcc svn repository, revision 1)

  • Check the version of NeXTTool, it should be 1.0.1.0:
  • ~$ sudo ./NeXTTool
    nexttool version 1.0.1.0 (1.0.1.0)
    Copyright (c) 2006, John Hansen
    Use "NeXTTool -help" for more information.


  • To upload over usb, turn on the NXT, connect it to USB and run the following command (example: helloword_OSEK.rxe) :
  • ~$ sudo ./NeXTTool /COM=usb -download=helloworld/helloworld_OSEK.rxe


  • Troubleshooting: Test the following command to see if Nexttool is working (set execution right for NeXTTool):
  • ~$ sudo ./NeXTTool /COM=usb -versions
    Protocol version = 1.124
    Firmware version = 1.xx


  • To upload over bluetooth, you need to define an alias name in a file 'nxt.dat' as explained in this post: Minsdtorm 2.0 development on linux . Then turn on the NXT and run the following command (example: helloword_OSEK.rxe) :
  • ~$ sudo ./NeXTTool /COM=alias_bt -download=helloworld/helloworld_OSEK.rxe


 

 

Home