ARM Development on Linux

13,783

Solution 1

It's always the same, no matter which eval board you have: STM32 discovery, LPCXpresso, TI Launchpads. They are very cheap, but the recommended IDEs are limited: Their code size is limited, Windows only, or they are bound to a specific Linux distribution.

In my experience the choice depends on your long-term goals:

  • Do you want to share code with AVR 8-bit (or PIC32, Renesas RX 32, ...)?
  • Is it a mid-term/long-term goal to have a build system based on make?
  • Do you need tab-completion and/or an integrated debugger?
  • Do you want to try other eval boards in the future (without being forced to install yet another IDE)?

or do you just want to get this one up and running quickly. In that case I would use one of the recommended IDEs to get an impression.

On the other hand, all 32-bit microcontrollers I have used (Cortex-M0/3/4, PIC32, Renesas RX) can be programmed with gcc. As far as I know Code Red, Mentor, and MPLABX use gcc (or a modified gcc).

So there is always the possibility to use Eclipse with a Makefile project, and gcc. I have tried it twice, but it did not work well for me, because I share libraries between the different targets, and I found it difficult to pass around the defines in Eclipse.

So my IDE is Makefile, Emacs, and gcc, and I have switched completely to using C++: This might be another advantage of using gcc.

Both possibilities (Eclipse with Makefile project or just editor with make) are not "off the shelf": They require time, patience, and your favourite Internet search engine.

Update

I am not aware of a complete tutorial on how to setup a GCC + make based environment, so I simply describe the basic steps I did it some years ago (with some changes).

The following steps are STM32 specific:

  • Get one of the discovery boards, for example the STM32 value line Discovery.

  • Get a flash utility: I am using stlink (git clone https://github.com/texane/stlink.git). This includes a GDB backend as well.

  • There are various examples available, search for "stm32vl discovery blink" (I cannot recommend one here, the one I used has vanished)

As an alternative (or follow-up): Get the Peripheral firmware examples

  • You will find a GNU ld compatible linker script in Project/Examples/GPIOToggle/TrueSTUDIO/stm32_flash.ld

  • You will find a GNU as compatible startup in Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/TrueSTUDIO/startup_stm32f10x_ld_vl.s

  • You will find all other required library include files and sources in the .zip archive as well

  • Look at the GPIOToggle project (Project/Examples/GPIOToggle)

  • Write a Makefile to compile, link, and flash

Solution 2

To build your own development environment you could use the following combination:

  • Eclipse CDT
  • Get the toolchain to be used (official GCC version or some third-party customized for your platform)
  • Integrate the toolchain into Eclipse environment either through the internal Eclipse build system (CDT builder) or through some external builder (i.e. make)
  • In order to have JTAG debugging support, there is a GDB Hardware Debugging Eclipse plug-in you will need to setup

I've managed to complete my own setup in such a way for LPC1769 (Cortex-M3 CPU) and it worked :)

Share:
13,783
pvh1987
Author by

pvh1987

Updated on June 14, 2022

Comments

  • pvh1987
    pvh1987 almost 2 years

    I have purchased a Tiva C series LaunchPad TM4C123G Evaluation Kit from Texas Instruments. This kit contains a small PCB with an ARM Cortex M4F microcontroller. Now I want to start writing software for this microcontroller. I am used to program AVR 8-bit microcontrollers using AVR Studio on Windows. I heard that it shoud be easy to program ARM-based microcontrollers on Linux, and since Linux is my main platform, I would like a simple IDE that will work more or less like I am used to from AVR.

    For several days I have been searching for a good IDE and tools that will do the job. To my surprise, only a few will run on Linux, and none is open source or freeware. Can this really be true? I do not want to spend several hundred dollars just to try out some programming for the Cortex M4F. Nor do I want to learn one IDE now and then another later when I found out it is not good enough or too expensive. I am used to Linux and the open source way of doing things and I am very shocked that nobody seem to be doing any serious embedded ARM programming with open source tools on Linux. Please correct me if I am wrong.

    I have no plans running Linux on the Cortex M4F - I just want to program it like a normal microcontroller.

    Texas Instruments recommends one of the following tool chains on the back cover of the evaluation kit:

    • Code Composer Studio IDE: full functional board locked
    • Keil: 32KB address limited
    • IAR: 32KB address limited
    • Mentor Embedded Sourcery CodeBench: 30-day full functional

    I have also been recommended Red Studio from code_red.

    Neither is open source or free and all have limitations. It seems to me that only Code Composer Studio and Red Studio is Linux compatible.

    I stumbled upon yet another product, Rowley CrossWorks, which is also Linux compatible but still very commercial and expensive.

    Is it really true that there is no open source alternative? Most of the products seem to use Eclipse and GCC, which one should be able to do without these commercial packages, right? I just can't find any tutorial or guide explaining how to do set this up for embedded ARM programming. Also I need to know how to program the device after compiling.

    I really want to get started soon. Any advice and ideas are very appreciated :-)

    • old_timer
      old_timer almost 11 years
      github.com/dwelch67/stellaris_launchpad I wonder if they got rid of the stellaris name and now it is tiva. I dont use an IDE, if you are limited to using an IDE, well you are on your own. But the gnu tools work perfectly fine, you do not have to go with those pay-for brand name tools...unless you really want to...
    • old_timer
      old_timer almost 11 years
      yep, they rebranded stellaris as tiva c...
    • Chris Stratton
      Chris Stratton almost 11 years
      @pvh1987 - your question seems to be attracting both spammy answers and excess moderator attention. Simple fact is that what you want to do is possible, using only free tools (typically some version of GCC) however it can take a bit of work and experience to set up, and manufacturer's example code will often need some porting and build-script writing before it will work.
  • Mahendra Gunawardena
    Mahendra Gunawardena over 9 years
    Can you share any links that will help to get Eclipse configured do develop embedded linux. I would like to configure Eclipse CDT to develop software for TIVA Cortex M4 processor
  • Adi
    Adi over 9 years
    Cortex M4 is not capable of running a full blown embedded Linux, only uClinux.
  • Mahendra Gunawardena
    Mahendra Gunawardena over 9 years
    Thanks for you input, I was able to get Eclipse CDT configured to program Cortex-M4. Attach is a link that help me get started. chrisrm.com/howto-develop-on-the-ti-tiva-launchpad-using-lin‌​ux. Your post was very helpful.
  • norlesh
    norlesh over 9 years
    can you suggest any tutorials for someone considering biting the bullet and doing it from the command line? [setting up tool chain, work flow, ...] I confess to having an IDE dependency habit (considering a support group for it). But as you point out the options under Linux are slim to non existent. I have a couple of STM32 boards I want to play with but would like to be able to cope with other vendors also.
  • Beryllium
    Beryllium over 9 years
    @norlesh I have updated the answer. These steps are applicable to other vendors as well: NXP (lpc), TI (Stellaris), ... as well.
  • 71GA
    71GA almost 8 years
    Don't use open source tools. You need good debugger, nice interface to read register states and other cookies for PRO use. These never come together with open source tools. I tried everything to establish free programming interface for ARM together with debugger and overall it can't be done on Linux for free. My best shot was using IDE KDevelop/Eclipse/CodeBlocks together with makefiles but none of those tools had inbuilt cookies. I compensated this by buying Segger's J-LINK JTAG probe and used JLink Commander to monitor registers in external terminal but it sucked... Buy propietary tools...