Offline GCC compiler works with mbed libraries!

25 May 2017

Please feel free to use this GitHub issue for general discussion about the GCC4MBED project. If you just want to ask me or the community a general question, then that issue is the place to do it.

27 May 2017

Sarah Marsh wrote:

This is quite a long and detailed thread. I want to pop in and say that there are two supported ways to compile your code offline with the GCC:

1) You can use the export function that is integrated into the online compiler - https://docs.mbed.com/docs/mbed-os-handbook/en/latest/dev_tools/third_party/. In this case, you might export to a GNU ARM Embedded makefile.

2) You can use our command line tool, mbed CLI, to compile your code, manage dependencies, and use the export functionality of (1) offline.

Thanks for the links! If the export or mbed-cli option works for people, then I definitely recommend that they use them. GCC4MBED was created back in 2011 before there was any official offline support from the mbed team.

Why have I continued to maintain it after the mbed team has added this support? Mostly because I still find it useful for my own projects:

  • Many of my projects start offline with GCC and never see the online compiler. I find the GCC4MBED makefiles easier to use for creating a new project. I just need to create a short makefile for my new project and then use an include directive to pull in the existing GCC4MBED makefiles containing all of my tweaks from the last couple of years. mbed-cli should be an adequate solution to this issue as well.
  • I don't want to take Python as a dependency for building my C/C++ open source projects. I don't regularly use Python and don't have tools like PIP installed on my machine so ofcourse the first step in the mbed-cli install steps fails for me. I don't want to have to install Python and its related tools just to build my C/C++ code. Tools should be distributed in ready to execute forms. This had been done with pyOCD in the past and it was the only version I successfully got to work on my main build machine.
  • I still primarily use the LPC1768 based mbed board in my projects and I prefer to use my MRI debug monitor rather than the CMSIS-DAP solution for debugging the 1768. GCC4MBED has MRI support tightly integrated.
  • I am used to the GCC4MBED workflow and I don't want to change :)

Sarah Marsh wrote:

Additionally, you can use pyOCD to debug your code with a GDB client.

I have used pyOCD a bit and have even made a few contributions to its code base in the past. From my own experience, I have found that pyOCD only continues to get better with time. The pyOCD contributors have done a great job of making it more robust while also adding more features!

I personally use JLink as my debugging solution when possible. I also use MRI on the mbed-LPC1768 board since the interface chip firmware which adds CMSIS-DAP support isn't very reliable.

14 Oct 2017

Rainer Geissendoerfer wrote:

-- I SOLVED BELOW ONE THROUGH CHANGING DEVICE.H (as it is the source for conditional compiling based on device) -

Rainer Geissendoerfer wrote:

Indexer cannot find "Serial"

/media/uploads/rgeissen/bildschirmfoto_2016-11-11_um_20.00.05.png

Unfortunately the Indexer marks my reference to the Serial class "Serial pc(USBTX, USBRX)" as invalid (Type Serial cannot be resolved), even though mbed.h includes Serial.h (see attached picture) ... any idea on how to get rid of this annoying behaviour?

I have added two include directories to PATHS & SYMBOLS:

.../gcc4mbed/external/mbed-os

.../gcc4mbed/external/mbed-os/targets/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_MCU_K64F/TARGET_FRDM

Can you elaborate? I have similar problem