Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ARM Development on Linux [closed]

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 :-)

like image 525
pvh1987 Avatar asked Jul 21 '13 22:07

pvh1987


2 Answers

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).

  • Get a binary distribution of GCC for ARM from https://launchpad.net/gcc-arm-embedded

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

like image 50
Beryllium Avatar answered Oct 08 '22 16:10

Beryllium


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 :)

like image 31
Adi Avatar answered Oct 08 '22 17:10

Adi