Hi everyone,
First off, apologies if this is covered in a FAQ but I've searched the forums and can't quite seem to figure this one out. This question is on how to build the gcc-arm-elf toolchain on Mac OS Lion so I can build the current leJOS firmware image.
I'm working on a leJOS driver class for the Dexter wifi sensor. It uses the RS485 port on the NXT to speak an AT modem protocol at varying baud rates from 9600 up to 921600 baud. I have the guts of a working webserver written in NXC for this sensor, and now it's time to work on the leJOS equivalent.
I know that the leJOS firmware hard-codes the baud rate to 921600 in hs.c for the RS485 port. I'd like to re-build the firmware to change that to (say) 115200, or better yet allow variable baud rates. Reading hs.c it seems that this would be possible as BAUD_RATE is used in only one place in the file. I know how to make the necessary Java class changes, and also how to adjust the JNI code. So far so good...
I'm struggling to re-build the current 0.9.0 trunk of leJOS. My first challenge is to get a working arm-elf-gcc toolchain working on Mac OS Lion (10.7.1). I've installed Macports arm-elf-gcc but it assumes a hardware FP unit, so none of the libraries link against the code built for leJOS (obviously the NXT does not have a FPU!) After two evenings beating my head on the wall with this I moved on.
Next I turned my attention to running the build_arm_toolchain.sh script in the nxtvm/platform/nxt directory. The first problem I encountered was that nothing would build without adding ---disable-werror to the configure calls on lines 87, 113 and 126 of the script. This is because the format string literals used in dozens of source files caused the compiler to crap out.
The second challenge is getting gcc 4.3.2 to build for the arm-elf target. It was looking for GMP (GNU Multi precision library) and MPFR (multi-precision float library). I got around that problem by adding --with-gmp=/opt/local --with-mpfr=/opt/local to the configure call for gcc-core. I installed GMP and MPFR from macports.org. The compile seemed to go well until died looking for iconv - unmatched symbols is the challenge. Yet iconv exists in /opt/local in my build machine. I have built newlib-1.16.0 and binutils-2.18.50 and have them in the install/ directory.
Has anyone succeeded in building the latest version of leJOS firmware on Mac OS?
Is there a clean known-to-work combination of binutils, gcc and newlib ?
Is there any easier way to adjust the baud rate of the RS485 interface in leJOS than rebuilding hardware?
Many thanks for any pointers!
Mark
