3 years, 3 months ago.

Offline Compliling


I am sure there are many challenges in maintaining the online compilers up and running at all times. I can empathise with the team thats maintaining it for Free. Firstly a huge thanks to the team for this awesome environment. Guys, like me, who didnt have the faintest idea of getting into embedded programming now have a solution that is pretty easy and sturdy.

Since online has been working a significant period of time, I have been lazy. I am willing to move offline to enable reduction of load on your servers. Could someone kindly clarify the following questions I have

1) When I export code, I am only getting *.o files in the toolchain_gcc_arm folders. Example is gpio_api.o. Can I download the c/c++ files for these?

2) Mbed cli seems to have a reference to MbedOS. Does that mean when I write a program for LPC824 the OS will be "included"? Or will it get downloaded and as long I dont include mbed OS specific functions it will not get "embedded" into the code

3) If I include mbed-dev, how does that affect the size of final output. Online compilation has different sizes for mbed and mbed-dev. It used to be the same but off-late mbed-dev is taking more space

4) Will the code sizes be the same for online and offline compliations.

Intention is to have complete control of my dev environment with no dependency on mbed.

Best Regards

2 Answers

3 years, 3 months ago.


1. That's because these files come in pre-compiled form (when having the mbed library attached). Try adding mbed-dev (or mbed-os).

2. mbed CLI is aware of both mbed OS 2 (mbed/mbed-dev library) and mbed OS 5 (mbed-os library), so you can start writing applications using CLI and it will automatically pull in the OS. However, if you don't use any functions they will not be linked in, so it does not have effect on code size.

3. Interesting, that shouldn't happen. On which target do you see this?

4. Depends. If you use ARMCC locally it will. If you use GCC locally it won't.

Intention is to have complete control of my dev environment with no dependency on mbed.

mbed CLI will do that. To easily migrate without the need to export, first *publish* your program from the online compiler, then import using CLI via `mbed import https://developer.mbed.org/path/to/project`. It will pull in your app and the sources for mbed OS and you can build straight away locally.


thanks for the quick response

  1. 3: Yes its happenign on LPC824. Normally our code is about 27k. When with mbed-dev it comes upto 31k (which is very close to the limit). WE need the mbed-dev to reduce the processor speed to about 10MHz

Best Regards ram k

posted by Surendar S 20 Feb 2017
  1. 4: Using ARMCC will keep the size the same and GCC will increase the size? Should I use GCC (Arm Embedded) to export the project?

Thanks a bunch for your time(s)

posted by Surendar S 20 Feb 2017

Regarding 3: I created a bug. It might have something to do with optimizations. What compiler flags are you using? Or are you compiling with the online compiler?

Not a simple answer to 4. ARMCC and GCC can optimize code differently, so it's not that one is better than the other, or generates bigger code size. Here's some interesting read.

posted by Jan Jongboom 21 Feb 2017

FYI, there's quite some discussion in the bug, with a number of suggestions.

posted by Jan Jongboom 21 Feb 2017


  1. 3: Using onllne compiler creates the larger code.
posted by Surendar S 22 Feb 2017

If you could respond in the bug linked that would help pinpoint the problem, core engineers are reading along there.

posted by Jan Jongboom 22 Feb 2017
3 years, 3 months ago.


Sincerest apologies for this, we are working more broadly to improve stability across the site, the compiler in particular.

We're trying to make sure the community has more visibility on such issues. There's a post with some more context for todays downtime on our status page.

Best, Phil

Web Team Lead