Channels ▼

Al Williams

Dr. Dobb's Bloggers

ARM Cortex M3 - Part 3: Tool Chains

November 15, 2010

The hardest part of getting started with any of the Arm processors is getting a working toolchain. There are basically four approaches:

1) Buy something. 2) Get a free "demo" version of a commercial toolchain and live with the limitations 3) Get a free toolchain bundle that has everything prebuilt 4) Build your own tools

Since I run 64-bit Linux primarily, my choices are a bit limited. For example, CodeSourcery provides a "lite" version of their port of the gcc ARM compiler on 32 bit Linux. Granted, my 64-bit machine can probably run it, but there's no native 64-bit build.

The ST Microelectronics site has plenty of links to other prebuilt toolchains (if you are using the STM32). Many of these have limited free demos including those from Atollic, Hitex, IAR, Kiel, and Raisonance. If you are using Windows and don't mind spending money on tools, you can easily be all set.

There are some free bundles like YARGARTO (Windows only) or GNUARM. Unfortunately, GNUARM hasn't been updated in a few years so if you want the latest and greatest, you may just get stuck with option 4.

Luckily, there are some very clever scripts available that will download and build the whole tool chain for you. Thats the way I do it. It does take awhile to download and build, but once its done you know exactly what you have and can tweak it if necessary. If you have a 486 and 33.6K modem, this might not be the best answer for you, but with a good network connection and a modern processor it isn't that big of a deal.

I used the nxtOSEK script (which is modified from an original script provide by NxOS). However, there are several similar scripts out there (this one for example). When I first built the tools I found I was missing some libraries. The key is a bunch of MULTILIB options in the script. Here's what worked for me:

echo "
MULTILIB_OPTIONS     = marm/mthumb
MULTILIB_DIRNAMES    = arm thumb

MULTILIB_OPTIONS    += mcpu=cortex-m3
MULTILIB_DIRNAMES   += cortex-m3
MULTILIB_EXCEPTIONS  += marm/mcpu=cortex-m3
MULTILIB_EXCEPTIONS  += mcpu=cortex-m3

MULTILIB_OPTIONS    += mno-thumb-interwork/mthumb-interwork
MULTILIB_DIRNAMES   += normal interwork

MULTILIB_OPTIONS    += mhard-float/msoft-float
MULTILIB_DIRNAMES   += fpu soft
MULTILIB_EXCEPTIONS += mthumb/mhard-float

MULTILIB_EXCEPTIONS += mcpu=cortex-m3/m*float
MULTILIB_EXCEPTIONS += mcpu=cortex-m3/m*interwork
MULTILIB_EXCEPTIONS += mcpu=cortex-m3/m*interwork/m*float
MULTILIB_EXCEPTIONS += mcpu=cortex-m3/m*interwork/m*float

MULTILIB_EXCEPTIONS += marm/mcpu=cortex-m3/m*interwork
MULTILIB_EXCEPTIONS += marm/mcpu=cortex-m3/m*interwork/m*float
MULTILIB_EXCEPTIONS += marm/mcpu=cortex-m3/m*float

MULTILIB_EXCEPTIONS += mthumb/mcpu=cortex-m3/mthumb-interwork 
MULTILIB_EXCEPTIONS += mthumb/mcpu=cortex-m3/mthumb-interwork/m*float
MULTILIB_EXCEPTIONS += mthumb/mcpu=cortex-m3/mno-thumb-interwork/mhard-float 
MULTILIB_EXCEPTIONS += mthumb/mcpu=cortex-m3/mhard-float
" >> $MULTILIB_CONFIG

Of course, if you get another script you may have to tweak it a bit differently.

At the end of it all you should be able to run the compiler and get a blinking light program or a "Hello World" running. You should even be able to debug it with the simulator or on hardware if you have the right hardware (I'll talk more about that in a future installment).

I know I'm old school and I don't mind the command line or a Makefile. But you can get Eclipse, among others, working with all of the above too. That'll be the subject of Part 4.

Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 


Video