SparkFun Forums 

Where electronics enthusiasts find answers.

Everything ARM and LPC
By Senso
Hello to everyone, after getting one LPCXpresso 1768 board and one STM32-Discovery with the 100RB micro-controller, I started the my quest to find one IDE or compiler(compiling via command line is not a problem for me) that would work with both boards, or even one for each one, well, the CodeRed for the 1768 isn’t very very bad but as a size limitation although it is one nice 128Kb, after that I found Atollic TrueStudio, it doesn’t have size limits, but it doesn’t report the size of the compiled program and its pretty hard to put it working, then there is Keil with is just awful, then IAR limited to 32Kb a size that in my opinion is plain stupid, 32Kb of code in one Cortex M3 arm is plain wrong and I don’t have the money to buy an IDE that expensive, the same for Rowley that is limited to 30 days.
I haven’t yet tried Yagarto, what do you guys think of it?
And I have read a little bit about Coocox, and the arm-gcc that doesn’t have any news after 2006 (?!).
Any help in a nice and not crippled compiler that would support my two boards would be perfect, thanks in advance.
I'm a student I cant even afford an 50€ IDE, 150€ is a LOT of money for my budget, yes I know that almost all commercial IDE's use flavours of gcc, but its closed gcc, and I cant afford then, with is a pity :(
You can download, compile, and install the gcc tools, either native if you are actually compiling on your ARM platform, or as a cross-compiler on whatever Unix-like platform you prefer. This is absolutely free, so should be compatible with your budget. I'm afraid my most recent ARM experience is all with ARM embedded in ASIC designs, but gcc has worked fine cross-compiling for those ARMs--I would hope it would work for your development boards. We do tend to compile from the command line (well, technically, I suppose, from inside make), as that is pretty much a requirement for our test and regression environment.
So, if I download the win-arm or yagarto, how can I add the specific libraries to compile code for the LPC1768 and the ST100RB(I think that this is the correct part number for the stm32-discovery board)?
Thanks for all the help provided.
Senso wrote:I'm a student I cant even afford an 50€ IDE, 150€ is a LOT of money for my budget, yes I know that almost all commercial IDE's use flavours of gcc, but its closed gcc, and I cant afford then, with is a pity :(
As a professional, I assessed all these compilers, including GCC and it's for-sale IDEs, in some depth, and chose IAR and pleased two years later.

Often, students' projects are small so you can use the free versions of IAR (or Keil), which limit size of code to 32KB. Your productivity will be much higher with one of these compilers. that means less time fighting with the compiler as a tool, more time on the assignment, and overall more time for beer and pizza.
As another data point, we went with the plain gcc route for ARM development for several projects, and we've been quite happy each time. We didn't have to fight with (or really spend any significant time on) the tools, but then we collectively have a lot more gcc experience than the average student. So go figure! I wouldn't argue against stevech's happy experience with IAR.
Mr.Tecoist, can you explain to me how can I get the arm-gcc compiling code for the lpcexpresso1768 board?
Do I need to include the libraries/CMSIS folders from code red or from the ARM site itself?
All the help provided is highly appreciated and I will be always in debt to everyone that can help me in my "quest".
For the LPC2103, 2106, 2138, 1751 and 1756 you can download our version of gcc and simple IDE we call MakeItC.

With some minor edits to the linker scripts you can add more devices.

We'd even open up the Tcl source for MakeItC to add more devices.

Why would we do this, well it gets more people beating on our tools, though they are pretty stable now, and gives us some exposure, you might choose one of our boards in the future.
Hello Senso,

[first a warning - I may not have any of this right]

I don't know if you're aware that each of your two boards has a different proprietary JTAG-SWD interface. That is to say, the commands between the host PC and the interface are not published. So, tool vendors other than Code-Red won't support the LPC-Link interface for your LPCXpresso unless they have paid some sort of license fee to [either Code Red or NXP or Embedded Artists or - not sure].

The ST-Link built into your STM32 Discovery is also proprietary. However, it has been around longer and a) I think it is more widely supported (by Keil, etc.), and b) I'm 99% sure the protocol has been reverse-engineered for the openOCD project. [Edit: It is the (Raisonance) R-Link that is supported by openOCD, not the ST-Link. (Maybe I should edit that 99% as well.)]

Anyway, the point here is that it may not be possible to find a free IDE with no code size limitiation that supports both of your proprietary interfaces.
The rest is directed mostly towards free tools.

Sorry I can't give details on how to get it all working - I'll try to provide a few bullet points. If I find a good tutorial I'll post the link.

* crt0.s: The CMSIS (provided by ARM) in the STM32 StdPeriphLib had a usable crt0.s for the larger STM32 parts. I don't know if that has been updated to include one that is good for value-line parts. I don't know about the NXP part.
* use the appropriate compiler flags (maybe -mcpu=cortex-m3 -march=armv7-m -mfloat-abi=softfp -mthumb)
* linker script is the hardest part imo. Start with just the linker script section of James Lynch's tutorial (search Sparkfun for Lynch) - I think most of his excellent installation instructions may be dated. Then, the documentation for ld is more readable than I expected it to be. The linker scripts included with the professional tools have astonishing complexity - I presume this is in order to handle Linux applications, which you won't need (yet, anyway).
* programmer debugger and config: ok in your case _this_ may be the hardest part. For the STM32 you might ask in the openOCD forum here on Sparkfun. Dunno re LPC-Link

General comments:

* I agree with viskr that the Coridium tools are the simplest way to get started with arm/gcc. With their boards, it just works right out of the box. Modify the demo program, build, download, and run. Then you can examine the gcc directory structure, the config files, crt0.s and so forth to understand how they got it all working. However, since you already have two (cortex) dev boards, this might not the best approach for you.

* For an up-to-date pre-built command line arm-gcc toolchain, I think codesourcery is the premier site
Last edited by hsutherl on Fri Nov 19, 2010 5:00 pm, edited 1 time in total.
By mac
Yes codesourcery is the premium source for prebuild toolchains. Even if you are builing the chain on your own, it's often wise to look at version number they package (to avoid release with bugs or not well tested).

You can also use eclipse with CDT as an IDE. Not my prefered choice, but it's here and free. ARM toolchains are well supported also (thanks to Android).

Then you need a startup file + linker file to fit your boards. You can also look at a rtos, small one, this way you will have everything on hands for startup. I did this with ChibiOS and an unsupported STM32 board. A couple of modification after I had my code working.

You endup with two choices:

- An integrated and supported IDE which support your board/tools: you won't have to look under the hood for 99% of the time.

- You do everything by yourself or use free tools: you will have to look under the hood, but in the end it's a great knowledge to have and can be usefull in some tricky situation (who said compiler bug?).
I don't get this toolchain-build idea. Does a carpenter first build his hammer and saw? Does his competitor do so as well or does he buy them with the seller's assurance of durability, then amortize the cost over many projects?

(the student/hobbyist may be exceptions - but only where the free limited versions of IDEs are inadequate. Free GCC when plug and play- ready to use, is a durable tool; WinAVR for Atmel is a great example, however Atmel pulled the funding for the toolmaker - a classic).
After some search around the internet I fount the openPilot project [ ... _Toolchain ] that looks to have some write-ups about setting a tool-chain based in the CodeSourcery, I know that the programmers of both my boards are proprietary, if I understand correctly openOCD is an JTAG programmer right(?) I will in the future get either one of those or maybe the JTAG programmer that is used by the openPilot project, or even another one, if I understand correctly one JTAG programmer will work in my two boards, right?
Actually I'm working in a robotic football team in my university, and they use a lot of linux and a bunch of custom tools, maybe in the future they could help me getting the gcc compiling some code, there are some linux gurus in there.
One more thing, Mr. hsutherl and Mr. mac, both of you talk about custom files and the like, can I have the compiler working for more than one target CPU, right?
Thanks a lot to all of your sir's, you are indeed great gurus in this area and a great knowledge source's. :shock: