6 years, 7 months ago.

GCC Availability for KL25Z


I've spent my day playing with mbed and the KL25Z. The mbed project is outstanding - I'm thrilled to finally own a board supported by mbed. But I would really like to be compiling locally with a full-featured IDE (code completion, multiple tabs, formatting, etc). I'm a Linux user as well, which makes things slightly more complicated since so many of the evaluation tools are for Windows.

I've poked through gcc4mbed, the mbed SDK, and the "GCC in Eclipse" tutorial. None of which are setup for the KL25Z in Linux from what I can tell.

Looking at current development, am I correct in guessing that the best and easiest option is to finish porting the mbed SDK to use gcc4mbed? If so, what is the next step to make that work? I have some time this summer and would be happy to help out where possible.


I'm using three existing folders to construct the necessary files for the mbed/libraries/mbed/targets/cmsis/Freescale/TARGET_KL25Z/TOOLCHAIN_GCC_ARM folder.

I'm doing a diff between the ARM_MICRO files for the KL25Z and LPC17xx and then modifying the LPC17xx's GCC_ARM files to reflect the differences. For the most part, I think it's working really well. I got almost all of startup_MKL25Z4.s written this way. I ran into one problem dealing with the "Flash Configuration" though. Lines 103-228 have no similarities to anything with the LPC17 chip so I have nothing to go off of. Could I get some help with that from someone, or a pointer in the right direction?

Thanks, David

Edit I hope I'm working in the right direction. This was the only place I could find startup files, so I assume this is a key piece to using gcc4mbed with the KL25Z

posted by David Zemon 30 Jun 2013

Hello, how is adding GCC ARM going? Why don't you reuse startup from GCC_CW_NEWLIB? I have not seen that startup but GCC ARM 4.7 added newlib as I recall. Are you planning to share this with community ? If you can share it, I would like to check it out ;)

Regards, c0170

posted by Martin Kojtal 01 Jul 2013

Making progress. I'm able to complete the test builds from the SDK source, but the built binaries don't run [correctly] on the board. The bootloader isn't kicking back errors, but neither are the LEDs blinking. My guess is there's a problem with Flash Configuration, as mentioned above. Investigation continues....

posted by David Zemon 04 Jul 2013

Can you share your work? Are you using github? I would like to check it out.

posted by Martin Kojtal 04 Jul 2013

I'll see if I can create a fork or something of the SDK? I'm familiar with git but only at a basic level. Never done anything this complex with it before. Will update this comment if I get something working.

EDIT Alright, fork created, edits pushed. https://github.com/SwimDude0614/mbed

I'm still really confused by the flash stuff and trying random things. It doesn't build at the moment because I copied and pasted some code into the startup script and apparently GCC doesn't like that syntax. If you run build.py you'll see the error. Comment out (or fix) that section and then you can run make.py no problem.

posted by David Zemon 04 Jul 2013

Thx, I dont see there folder GCC for KL25 in CMSIS directory.. I see there's GCC_ARM in targets for KL25Z.

posted by Martin Kojtal 04 Jul 2013

GCC_ARM is what I created. I saw GCC_ARM in lots of other places so assumed that's what I should create as well. Again... complete guess work.

Also, glad to know I'm not the only one that thinks programming and embedded systems is an appropriate 4th of july activity :P

posted by David Zemon 04 Jul 2013

I'll send you private message here wit hmy email, we can keep it private to avoid flooding here :-)

posted by Martin Kojtal 04 Jul 2013

3 Answers

6 years, 6 months ago.

Hello guys,

I have created a branch on github which will probably be merged into master. It contains GCC ARM support for KL25Z.

Thank you David for bringing up this subject!



Accepted Answer
David Zemon
6 years, 7 months ago.

I will absolutely post it for the community if I get anything done. I'll take a look at newlib to see if that helps any. I don't actually know how to do this - startup scripts are100% new to me so it could take a while

Edit Ugh... did this on my phone and didn't realize I hit the "answer" button instead of comment. sorry.

Ok, I have made my own GCC startup files for Kinetis K, I can do the same for Kinetis L. Although I have seen startup files for kinetis L somewhere. I'll check what I can find.

posted by Martin Kojtal 01 Jul 2013

That'd be great! Thanks.

posted by David Zemon 01 Jul 2013

Example blinky code found here: https://community.freescale.com/thread/303472 Contains makefile and startup code


Nevermind. Doesn't work with mbed. Might help for reference though if anyone wants to look.

posted by David Zemon 03 Jul 2013
6 years, 7 months ago.

Hi guys, GCC, what exactly is it, where do you get it and how would you set it up and use it for the Mbed or any other mcu (I'm using windows, sorry!!). What are the pros and cons apart from off line compiling. A step by step project on the cookbook page would be great if someone has the time to do this. I did hear from someone who would compile off line using GCC then use the Mbed compiler to compact the code.

Any help would be great

Many thanks

What is GCC:

GNU C Compiler (G++ is also often implied with "gcc", which is the GNU C++ Compiler) The original GCC is free and opensource, therefore is commonly ported to various chips.

Where do you get it?

It's freely available in most Linux distributions' package managers or online for Windoze if you want to compile programs for your personal computer (x86 and x86-64 architecture). Compiling for an ARM chip without an operating system is slightly more complicated (just because it isn't as common). CodeSourcery and the Summon ARM toolchains are common choices and freely available online. (BTW, "toolchain" simply means the compiler, the library files, the header files, and everything necessary to build your programs... sometimes debuggers and programmers will come included as well but not often). tl;dr https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q2-update/+download/gcc-arm-none-eabi-4_7-2013q2-20130614-win32.exe


Offline compiling allows you a couple things. For me, the really big, really important thing is being able to use my own IDE (Eclipse). The mbed "compiler" (aka, IDE) is awesome as web applications. As IDEs go though, it sucks. I don't mean to insult the developers, they did great. But I'm sure they never intended for that application to compete with something like Eclipse. Another thing that some people will appreciate is the privacy that offline compiling allows. Some companies have strict policies that won't let them share or even risk sharing their files, which would completely rule out the online mbed compiler/IDE.


If someone hasn't done A LOT of work ahead of time, it can be a royal pain in the...

posted by David Zemon 02 Jul 2013