Offline compiler

06 Jan 2013

I have been trying to get an offline compiler / toolchain working for my mbed. I have read lots and lots of threads here and i have tried various scripts to build gcc and the rest of the tool chain and in the main these result in a toolchain which will compile but will not link. This is with even the most simple of programs.

Is there a set of instructions anywhere that i can follow or if anyone has this working could you please give me a few pointers..

I am running OS X 10.8.2.

Kind Regards,

Steve

07 Jan 2013

I just tried exporting a basic HelloWorld sample using these Handbook instructions for GCC ARM Embedded. and got it to work after a few modifications...it didn't just work out of the box due to recent changes in the mbed library.

First of all, the easiest way to get a GCC toolchain for OS X, is to install the latest 4.7-2012-q4-major release which includes this archive for OS X: https://launchpad.net/gcc-arm-embedded/4.7/4.7-2012-q4-major/+download/gcc-arm-none-eabi-4_7-2012q4-20121208-mac.tar.bz2. Once you download this archive, you will want to extract its files and then place the /bin directory within it to your PATH so that the makefile can find the tools like arm-none-eabi-gcc, etc.

After exporting using the Handbook steps, I extracted its files and then had to update one line in its makefile. The following diff shows where I added -lnosys to the LD_SYS_LIBS variable.

diff --git a/Makefile b/Makefile
index fd15d03..d18ad0e 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ AS = $(GCC_BIN)arm-none-eabi-as
 
 LD = $(GCC_BIN)arm-none-eabi-gcc
 LD_FLAGS = -mcpu=cortex-m3 -mthumb -Wl,--gc-sections
-LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc
+LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
 
 OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy

If you hit any issues going through this process, give me as much information about the errors that you hit and I will try my best to help.

-Adam

07 Jan 2013

Hi Adam,

Many thanks for this, was already using the launchpad build of GCC 4.7 the bit i had missed was adding the -lnosys to the LD_SYS_LIBS variable..

Kind Regards,

Steve

09 Jan 2013

Hi Steven, Adam, we updated the GCC ARM Embedded exporter:

  • Fix the ".s.o" rule for building assembly files adding the "-mcpu=cortex-m3 -mthumb" information.
  • Use the new v4.7 "newlib-nano" in the linker rule ("-specs=nano.specs -u _printf_float -u _scanf_float")
  • Add missing system library ("-lnosys") in the linker rule

You can use now the new exporter enabling beta mode here: http://mbed.org/betamode/

The fix should appear live around Monday next week.

Cheers, Emilio

10 Jan 2013

Emilio, thanks for the update. Much appreciated!

-Adam

10 Jan 2013

Hi Emilio, Sorry for not responding sooner. Many thanks for the information.

Kind Regards,

Steve