This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Howto export nRF51DK project from online mbed compiler to ARM GCC toolchain?

I have tried to export a very simple mbed program (blinks LED1 and LED2 and writes to Serial (USBTX, USBRX)) with no success. I am running on an Ubuntu 32 bit distro. This is what I have done:

  1. Exported the program from mbed online compiler (developer.mbed.org/compiler) as GCC ARM Embedded:

image description

  1. Installed the GCC ARM Toolchain (launchpad.net/gcc-arm-embedded) in /usr/local

  2. Modified the following in the Makefile associated with the export in 1):

GCC_BIN = /usr/local/gcc-arm-none-eabi-5_2-2015q4/bin/

SOFTDEVICE = mbed/TARGET_NRF51_DK/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/s110_nrf51822_8_0_0/s110_nrf51822_8.0.0_softdevice.hex

The SOFTDEVICE entry was modified since the original exported Makefile referred to an older version that was not part of the export.

  1. Installed srecord (sudo apt-get install srecord) to support the SREC_CAT definition in the Makefile

  2. executed make clean; make; make merge

The make targets executed with success and produced a combined.hex file. The combined.hex file was dropped in the JLINK folder but unfortunately does not run.

Dropping the hex file produced by mbed to JLINK folder works fine.

What have I missed?

Parents
  • The hex file produced by the mbed online compiler for the mbed_blinky project works as expected (i.e. runs and the leds blink on my nrf51DK). I did try to press the reset button after I downloaded the arm gcc toolchain produced hex file but it did nevertheless not work. My guess is that the Makefile produced by the export function in mbed is incomplete. It does not seem to link together the necessary mbed dependencies with the produced main.o file. Why is another question.. I tried an alternative option:

    1. Followed the quick start instructions from (github.com/.../gcc4mbed).
    2. Added a new MakefileGCC to my exported mbed projects following format described in build/gcc4mbed.mk.
    3. compiled (make –f MakefileGCC)
    4. Downloaded the resulting hex file to JLINK

    Option 2 works (i.e. compiles and runs) for simple programs but I get a lot of errors trying to compile projects using the mbed LoRaWAN in C library (SX1276Lib). I think this is due to the mixture of c and c++ syntax in same file that mbed handles but that GCC is not designed to handle.

Reply
  • The hex file produced by the mbed online compiler for the mbed_blinky project works as expected (i.e. runs and the leds blink on my nrf51DK). I did try to press the reset button after I downloaded the arm gcc toolchain produced hex file but it did nevertheless not work. My guess is that the Makefile produced by the export function in mbed is incomplete. It does not seem to link together the necessary mbed dependencies with the produced main.o file. Why is another question.. I tried an alternative option:

    1. Followed the quick start instructions from (github.com/.../gcc4mbed).
    2. Added a new MakefileGCC to my exported mbed projects following format described in build/gcc4mbed.mk.
    3. compiled (make –f MakefileGCC)
    4. Downloaded the resulting hex file to JLINK

    Option 2 works (i.e. compiles and runs) for simple programs but I get a lot of errors trying to compile projects using the mbed LoRaWAN in C library (SX1276Lib). I think this is due to the mixture of c and c++ syntax in same file that mbed handles but that GCC is not designed to handle.

Children
No Data
Related