nxtOSEK Installation in Mac OS X Lion
By Dmitry Prokhorov
DISCLAIMER: This installation procedure
is provided “as is” with no guarantees.
1.
Installing LEGO Fantom driver for Mac OS
http://mindstorms.lego.com/en-us/support/files/Driver.aspx
2.
Downloading GNU ARM toolchain
Download YAGARTO GNU ARM toolchain (http://www.yagarto.de/):
yagarto-bu-2.21_gcc-4.6.2-c-c++_nl-1.19.0_gdb-7.3.1_eabi_intelmac_20111119.dmg
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 we’ll need to rebuild nxtOSEK
libraries (as shown later) which were built under EABI 0:
libecorobotc++.a
libecorobotc.a
libnxtway_gs_balancer.a
nxtOSEK\ecrobot\bios\nxt_bios_rom.rfw
3.
Installing GNU ARM toolchain
To unpack toolchain
(as described at YAGARTO
Readme file):
1) Create directory “yagarto” (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 don’t 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 haven’t /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 don’t need .dmg file and installer,
feel free to delete it.
4.
Installing Wine
Download and install WineBottler (Wine port
for Mac OS X) from:
http://winebottler.kronenberg.org/
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.
http://sourceforge.net/projects/lejos-osek/files/nxtOSEK/nxtOSEK_v2161.zip/download
7.
Installing & building native tools
Note that tools
for Windows (NeXTTool.exe,
appflash.exe and ramboot.exe) doesn’t work in Wine under Lion so
we
don’t need them.
We’ll 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)
nexttool
Download native nexttool for Mac OS X:
http://bricxcc.sourceforge.net/nexttool_osx.zip
Unpack and move nexttool to nxtOSEK/bin
directory.
Also
you can download GUI NeXT Tools utility (it is not nessesary):
http://bricxcc.sourceforge.net/nexttools_osx.zip
fwexec
Download libusb
0.1 for Mac OS X Lion and
install it.
http://www.anyma.ch/blogs/research/2011/08/13/libusb-for-macosx-lion-10-7/
Download libnxt-0.3 and unpack
it
http://libnxt.googlecode.com/files/libnxt-0.3.tar.gz
Download
scons
Install
scons:
sudo python setup.py
install
Go to linnxt-0.3 directory and run:
scons
to build fwexec
appflash
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:
TARGET_PREFIX = arm-elf
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
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:
http://lejos-osek.sourceforge.net/installation_windows.htm#ENF_inst
11. Testing
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 Ribiero’s way):