Skip to content

Project to allow offline GCC compilation of code using mbed cloud libraries.

Notifications You must be signed in to change notification settings

CNCBASHER/gcc4mbed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quick Start

These are the quick steps to get gcc4mbed installed on your computer:

  • Download the gcc4mbed compressed archive from https://github.com/adamgreen/gcc4mbed/zipball/master
  • Decompress and extract the contents of this archive.
  • Run the install script appropriate for your platform:
    • Windows: win_install.cmd
    • Mac OS X: mac_install
    • Linux: linux_install
  • You can then run the BuildShell script which will be created during the install to properly configure the PATH environment variable. You may want to edit this script to further customize your development environment.

Important Notes:

  • During install, you may be prompted for an Authentication realm password for the mbed SVN. You can just press ENTER at this prompt as a blank password response is enough.
  • Files will fail to install to a FAT based file system. Extract to a more appropriate file system (ie. NTFS on Windows) first and then copy to a FAT drive after installation.
  • If the installation should fail, please refer to win_install.log, linux_install.log, or mac_install.log. It will contain the details of the installation process and any errors that were encountered.
  • To run the install script on Mac OS X, you will need to first have the make utility installed. The author had previously installed Apple's XCode which provides this tool.
  • The Mac OS X install only supports 64-bit Intel machines. The installers for the other platforms only install 32-bit Intel binaries.

Overview

The gcc4mbed project was created to give mbed users the flexibility to develop code even when it isn't convenient to be connected to the Internet. While there have been documented steps for quite some time on how to use GCC for building CMSIS based programs for the mbed processor, they have sacrificed the convenience of the mbed libraries. The gcc4mbed project gives you the flexibility of offline compilation through the free GCC based Code Sourcery Lite tool chain without sacrificing the convenience of these libraries.

While it can be very liberating to pull the plug from the online cloud compiler and work on your mbed code in offline mode, there are a few things you should consider before making the switch:

  • Code size. The code currently generated by GCC when used with the gcc4mbed project is about two times larger than when compiled with the online compiler. Initially the size delta was closer to 10x so this is an improvement from the beginnings of the gcc4mbed project. That's not to say that someone in the community might not be able to analyze the code differences and make changes to gcc4med to further reduce the code size.
  • Community support. Most of the mbed user base is going to continue using the cloud compiler. If you encounter an issue with your project while using the gcc4mbed offline process, you may find it harder to get help since there will be a smaller pool of people familiar with this environment. However if you like adventure and helping others then taking the plunge means you will be one more person able to help others who go on this adventure with us.
  • Libraries. You will have to do some more leg work yourself to get community created libraries to work. People writing these libraries will be developing and testing them on the cloud compiler. They may use features that are specific to the cloud compiler which lead to build breaks and runtime crashes or hangs when used with GCC.
  • Testing. In general, everything mbed related will have been much more thoroughly tested on the cloud compiler.
  • LPC1768 only. This is the only version of the mbed device that the original participants of the gcc4mbed project had access to and used in their projects.

If you are the adventurous sort and want to try out the offline gcc4mbed project then there are some things you will receive for your enthusiasm:

  • Offline capability. No Internet connection? No problem!
  • Build customization. Want to tweak something in the build such as optimization levels, generation of disassembly, code profiling, etc? The gcc4mbed project gives you access to the makefiles and you are free to play. Maybe you will be the one to figure out how to make gcc4mbed projects run 5x times faster while cutting the size in half.
  • Editor/IDE of your choice. Like to code in Eclipse, vi or emacs? As long as you can build from a makefile then you are good to go with gcc4mbed.

If using the mbed libraries with GCC had been easy, people would have been doing it since the mbed was first launched. Many of the difficulties comes about from the fact that these libraries are written in C++. There are things like name mangling, RunTime Type Information, and debug symbol formats which could easily be different between the two compilers. If they are different and you combine object files from the two then pure mayhem could ensue. In the simplest case, the link just fails due to missing external references but in the worst case, the code builds but then crashes or hangs because of differences in formats. The fact that this could be made to work at all is mostly due to the work of the developers at ARM, the RealView developers who built a compiler with such good compatibility with GCC and the mbed team for selecting build flags in the cloud compiler which took advantage of these compatibilities. There will no doubt be more challenges to be faced in this area. We are certainly playing with fire here so we should expect to be burned a few more times yet.

More Information

For more information about how to install and use the gcc4mbed project, please refer to https://github.com/adamgreen/gcc4mbed/blob/master/notes/install.creole#readme.

For notes about porting your applications from the cloud compiler to gcc4mbed, check out this mbed forum thread and these summary porting notes.

Thanks

The author wants to thank Arthur Wolf for the posting he made back in May which kicked off this whole gcc4mbed project and for all of the testing and feedback he has given since.

Thanks to Felyza Wishbringer for writing the first Windows install script which provided the inspiration for the Windows, Mac, and Linux scripts that are now included in the gcc4mbed project.

Thanks for all of the others who have provided valuable feedback since this project was first released. Much of that feedback can be found in this mbed forum thread

Have fun!!

About

Project to allow offline GCC compilation of code using mbed cloud libraries.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published