nxtOSEK Installation in Mac OS X Lion

By Dmitry Prokhorov


DISCLAIMER: This installation procedure is provided gas ish with no guarantees.



1. Installing LEGO Fantom driver for Mac OS




2. Downloading GNU ARM toolchain


Download YAGARTO GNU ARM toolchain (http://www.yagarto.de/):




to standard download folder ~/Download


Note that Toolchain contains new arm gcc 4.6.2 compiler. All standard libraries in package were built under EABI 5,

so wefll need to rebuild nxtOSEK libraries (as shown later) which were built under EABI 0:







3. Installing GNU ARM toolchain


To unpack toolchain (as described at YAGARTO Readme file):


1)            Create directory gyagartoh (without quotes) in home folder (~/yagarto).

2)            Mount downloaded .dmg file.

3)            Move installer yagarto-4.6.2 from .dmg to ~/yagarto

4)            Run installer. It will create directory yagarto-4.6.2 in ~/yagarto folder and install toolchain to it.


If you donft want to place toolchain at ~/yagarto/yagarto-4.6.2 and would like to move it after unpacking, for example to /opt directory, do the following:


1)            Run terminal

2)            If you havenft /opt folder, create it:

  sudo mkdir /opt

3)                 Move YAGARTO GNU ARM toolchain to /opt

  sudo mv ~/yagarto/ yagarto-4.6.2/arm-non-eabi /opt


If you donft need .dmg file and installer, feel free to delete it.



4. Installing Wine


Download and install WineBottler (Wine port for Mac OS X) from:





5. Add path to .bash-profile


export $PATH =$PATH:/Applications/Wine.app/Contents/MacOS


Logout and login again to update environment variables.



6. Installing nxtOSEK


Download nxtOSEK v2.161 and unpack it.



Note that the GNU ARM toolchain described in the section 3 requires a patch for linker script file.

Download sam7_ecrobot.lds and replace with the one in nxtOSEK/ecrobot/c


7. Installing & building native tools


Note that tools for Windows (NeXTTool.exe, appflash.exe and ramboot.exe) doesnft work in Wine under Lion so we donft need them.


Wefll use native version of:

nexttool  (for Mac OS X) by John Hansen,

appflash (sources included in nxtOSEK, re-builded in Mac OS X)

fwflash by David Anderson (instead of ramboot)

      Note that fwexec and appflash binaries are stored in nxtOSEK/bin directory


Download native nexttool for Mac OS X:



Unpack and move nexttool to nxtOSEK/bin directory.


            Also you can download GUI NeXT Tools utility (it is not nessesary):




Download libusb 0.1 for Mac OS X Lion and install it.



Download libnxt-0.3 and unpack it



            Download scons


      Install scons:

sudo python setup.py install


      Go to linnxt-0.3 directory and run:


      to build fwexec



Install NI-VISA for Mac OS from here (registration needed, free of charge):



Download NXT++ from here:



Copy all *.h files from fantom directory to nxtcommfantom/fantom


Go to nxtOSEK/nxtcommfantom


Create makefile as shown at the end of this letter (this makefile is attached to this letter).


You should change FANTOM, OSEK and DEPLOY variables to your settings.


            Run:  make



8. Editing  tool_gcc.mak


Specify GNU ARM directory and nexttool directory and tools names.


      Just for example:

  GNUARM_ROOT = /opt/arm

  NEXTTOOL_ROOT = /Users/your_home_dir/nxtOSEK/bin

  NEXTTOOL = nexttool

  APPFLASH = appflash

  RAMBOOT = fwexec


Set up prefix:

TARGET_PREFIX = arm-none-eabi


If arm-elf-gcc 4.4.2 have been installed specify:



Note that BIOSFLASH variable is not used, you can safely delete it.



9. Re-building nxtOSEK libraries


1)         Go to nxtOSEK/ecrobot/c++ and run:

make all

make release

2)         Go to nxtOSEK/ecrobot/c and run:

make all

make release

3)         Go to nxtOSEK/ecrobot/bios and run:

make all

make release

4)         Go to nxtOSEK/ecrobot/nxtway_gc_balancer and run:

make all

make release


Warnings about impossibility of inlining can be emitted during compilation.



10. Installing John Hansen's Enhanced NXT Firmware

       Install John Hansen's Enhanced NXT running Windows as described in nxtOSEK official tutorial:



11. Testing

  1.    Go to nxtOSEK/samples_c++/cpp/Helloworld/

  2.    Build helloworld:
    make all

  3.    Run brick and download helloworld:

  4.    Run downloaded helloword via brickfs menu.

    In some case of using pure virtual function in classes, it may be necessary to define function __cxa_pure_virtual() to avoid of linker error. For example:

    extern "C" void __cxa_pure_virtual() { while (1); }



Summary (differences from Augusto Ribierofs way):