SparkFun Forums 

Where electronics enthusiasts find answers.

Everything ARM and LPC
By mac
Using a codesourcery toolchain is as simple as a tar command (on linux).
Building a gcc toolchain is something a little more tricky. Having it build is only a small part from it, having good binutil/gcc/lib versions is the real part.
I agree that most people never need to do this, except student because it's a very valuable knowledge (it's mandatory to know how a toolchain works this if you want to be hired where I work). Some linux distribution (like gentoo) make the toolchain building an easy task.
Setup a full IDE system with prebuild toolchain and eclipse with pluggins is a matter of an hour.

The toolchain is only a compiler/linker and sometime C library for a given architecture,ie familly of processors for short, like arm. You can use the same toolchain with arm processors from ST, NXP or other for example (unless the arm familly variant is not supported by the toolchain). It's like GCC for x86: you can build code from i386 to the latest core familly of processor.
Then you need additional support: additional library support, board support files (like startup file and linker files).

IDE packages all this with they own build system/debugger/editor, I do not like this approach myself as I mainly worked on projects that do not fit this approach (and being also an emacs addict).

For the JTAG, it's more or less used as a debug and programming interface. In fact it is a very low level interface to the chip, but it's another story.
You can use it for programing, but it's primary use is debugging. For programming, a bootstrap on usb/serial is often easier and faster to use.
OpenOCD allows to link you board to GDB debugger, through the JTAG interface. OpenOCD needs to know how to access your jtag interface. I use myself a embeddedproject jtag interface which is well supported and fast enough for my use, and it's cheap also.
OpenOCD allows also to program your board thought script.
OpenOCD itself is very painful to configure: very low level, configuration changes between major versions (making some examples found on the net obsolete).
Wow, great detailed info mr.Mac, thanks for the sharing.
I have already bookmarked this topic, for now I'm short in funding so I wont buy any JTAG soon, so I will just stick to the Code Red LPCXpresso IDE and use my LPC1768 board, but I cant even get my feet wet in the ARM world, because the only blinky included in the Code Red IDE is for the 13xx micro-controller and mine is different and so I cant even manage to make a led blink :(
Are there any tutorials/blog posts about this?
Or an hint how to acess the GPIO pins.

After some more tinkering, I think that I have found the essential thing, all the defines for each processor is inside the CMSIS files that are provided by each manufacturer, finally I can see some light!
I have also found this:
Looks like a good start to the all glorified blinky.
Here I am again at it, sorry for being so boring, but I want to really understand this..

After all this help I still dont really know what to do/choose, using a simple compiler like the CodeSourcery I need to create makefiles and I dont know really how to do that, I cant even create makefiles for an avr project :(
For the LPCXpresso there is the codered IDE that compiles up to 128Kb, thats more than enough for what I do, but I think I will chose the STM32 arm's because I can get free samples from then and if I understand correctly they have a serial bootloader in a ROM memory, so I dont need a JTAG programmer(at least not essential, but I'm following the BusBlaster project and will get one when they are good to use ;) )
So, I think that one of the most complete guides about setting up a toolchain for STM32 arms is the wiki of the OpenPilot project: ... _Toolchain

Its all very well explained, but I dont really understand if the makefiles are handmade or if the Eclipse IDE takes care of that, and this brings me to my other option, which is the Attolic True Studio, a friend of mine as already shown me how to edit a small config line and add the Yagarto files so the Attolic True Studio will give out the build-size and some other small things, that makes it almost perfect, but I like to know what is going on, so maybe I should try the tutorial from the OpenPilot guys, but then again, makefiles and not really knowing how to even make a simple blinky because I dont know what files I should include to have the CMSIS and the registers definitions up and running for each arm model is intriguing me.

I also found this tutorial and its very detailed, but again the problem of the makefiles is confusing me, even compiling trought the command line is a mystery for me :(
stevech wrote:WinARM is free.

I think you'll find more example code for NXP than ST.

As a newbie, did you consider mbed?
AFAIK the Standard WinARM doesn't support Cortex (Thumb2) (the last beta might)
And Martin Thomas stopped with a comment that even he now uses codesourcery.

The "dropin" replacement for WinARM would be Yagarto

As codesourcery doesn't include arm-insight (it does include gdb).
I usually snip arm-insight from the yagarto package for windows.
On linux it's quite easy to build arm-insight.

I have an x64 machine , and wasn't sure the standard codesourcery linux binaries would run on a 64-bit. So i just build codesourcery from source (Ubuntu 10.04LTS) using this script
That was easy :D

Btw: I prefer Code::Blocks , as i find Eclipse to heavy

What is arm-insight?
For what I see I think I will settle for the Codesourcery and learn how to use it, as you say its up to date, or is the Yagarto a easier tool to use, I can use both windows vista, or ubuntu 10.04.
Thanks for your opinion/suggestion.
Senso wrote:What is arm-insight?
For what I see I think I will settle for the Codesourcery and learn how to use it, as you say its up to date, or is the Yagarto a easier tool to use, I can use both windows vista, or ubuntu 10.04.
Thanks for your opinion/suggestion.
If you run a dual environment Win/Linux , i'd chose Codesourcery.
Then you have the same compiler on both systems , as CS can be downloaded for both.

arm-insight is a gdb frontend (graphical debugger tool)

If you have a powerfull machine (lots of mhz+ram) , you might consider Eclipse (java app) for an ide.
Else i suggest Code::Blocks. Both are free and downloadable for Win/Linux.

I might even suggest Eclipse , as a lot of people seems to use it (lots of help)
And with Eclipse you don't need arm-insight , as it has it's own graphical debug frontend.

I can't remember if CB has one , i always use insight and "plain" makefiles.
Else there is to much Clicky..Clicky.

One other advice if you run win/linux ....
Keep all file names in lowercase , or you will be "bitten" in linux at some point.

I dont really need to have the "toolbox" in both OS, just in one of them, I think I will go the CodeSourcery and CodeBlocks or Eclipse, the one that I can find the best tutorial :lol:
Thanks for all the help provided.
Now, I have just one more little doubt :oops:
How can I upload code to the STM32 board and/or the LPCXpresso, I know that with some hacking I can access the STM32 chip using the built-in serial bootloader, as the provided programmers will most likely not work outside the fancy and paid IDE's that are made for them, maybe the LPC programmer work stand alone, but using what tool to make it work? :oops:
Hello Senso,

flashmagic is the most popular serial programming software for LPC. For STM32, I've been using sloadhost (also mentioned here) under Linux. I've not tried the windows version.

Of course you can't run RS-232 (or EIA-232) levels directly to your uC pins. A level shifter would seem like the simplest solution to that but then you have to power it... An FTDI breakout board might be the easiest overall.

I was too lazy to study the schematics but be careful: the interface uCs are likely to be driving your bootloader control pins. (For the LPCXpresso, you might want to snap off the LPC-Link. It looks like the STM32xxDiscovery has jumpers?)
By cfb
leon_heller wrote:It's a very good IDE and they have written their own libraries. Support is excellent.
For anybody whose time costs money the support alone would be worth the purchase price.
The primary ARM IDE/compiler tool vendors I know of are

Rowley (GCC + their own libraries and IDE)
Keil (ARM's preferred. Expensive but very good. Free version limited to 32KB)
IAR (My preferred. Expensive but very good. Free version limited to 32KB. Excellent Calif. phone support).
ImageCraft (inexpensive, limited capability)
GCC with IDEs called Yagarto, WinARM, others.
Code:Blocks - an IDE for various open source compilers

any others?

In a professional setting, I'd go for IAR or Keil.
For a serious hobbyist, not for profit, Rowley's low end version is likely a good investment to improve productivity versus the freebie GCC+IDE which can be awkward to get setup.