Using C++ on the MRM

I like programming in C++, so I created a small sample file which allows C++ to be used on the MRM. As distributed, the MotoRobots library gives a couple of linker errors when trying to utilize C++.

Newlib (the C runtime library that is used) makes some calls to getpid and kill as part of the exception handler which wraps the call to main. Obviously these functions can't do anything useful if you aren't running an OS on your MRM, so I wrote some simple stubs.

If you wish to use any functions from the standard C++ library, then add

     -lstdc++
to the EXE_LIBS, and add
     -L/usr/local/gcc-m68k/lib/gcc-lib/m68k-elf/2.95.3\mcpu32 \
     -L/usr/local/gcc-m68k/lib/gcc-lib/m68k-elf/2.95.3 \
     -L/usr/local/gcc-m68k/m68k-elf/lib/mcpu32 \
     -L/usr/local/gcc-m68k/m68k-elf/lib
to EXE_LIBDIRS. NOTE: Adding a simple
     cout << "Hello World\n";
to the main program causes the size of the .s19 file to increase by 200k, so I've avoided using C++ streams.

Here are the files:


Home - Line Maze 2006 - Mini RoboMind

Copyright 2010 by Dave Hylands