Linux demo (STM32)

Last updated February 23 , 2011



See the newest version of this demo at:

www.stf12.org


The Idea

The amount of memory available today for embedded applications is fast increasing. This brings the firmware complexity (code size)
to grow up. Many powerful and open source tools are available today to address this challenge.

The idea is to setup an open Development Environment  for complex STM32x based embedded application. It must be powerful enough to simplify and speed up the application developing and testing.

For sure to be open enough it must run on Linux platform!




My personal thanks to Simon Qian for his invaluable support to build OpenOCD and install the Versaloon driver.



Main Components

  • STM3210E-EVAL - evaluation board.
  • FreeRTOS.org - real time scheduler. Tested with version 6.0.2.
  • OpenOCD - On-Chip debug solution for embedded target systems. Tested with r0.4.0 release.
  • CodeSourcery G++ Lite - ARM EABI GCC development tools. Tested with version 2010q1-188.
  • Eclipse - open development platform. Tested with Helios release.
  • Versaloon hardware interface.

The Demo

Preface

I have not a strong knowledge on Linux, but I know that Linux is the cradle of every idea is based on open source philosophy. For this reason I started working at this demo. For sure any Linux developer knows how to use Eclipse for embedded application development, so please consider this web page as my personal note I use to start discovering the Linux world. I will appreciate any comment and any suggestion to improve this work.

Moreover, this demo is the porting on Linux of my Windows experience, so  feel free to look at the Windows STM32 demo for more information on the demo.


Introduction

I use only Open source or free software to develop this demo. Ubuntu 10.4 is my preferred Linux distribution due of its easy of use - as I wrote above, I have not much expertise on Linux! :-). I download the ISO image and install it on my machine keeping all default options during the installation process. Ubuntu provide a simple graphical tool to add additional packages and the powerful shell based Advanced Packaging Tool (APT). They are very simple to use, but sometime I don't use it in order to have the latest version of a tool.

By default I install all tools in ~/Application folder in the user domain.


Developer environment setup

  1. Install the ARM EABI Lite version of the CodeSourcery G++ development tools. I use version 2010q1-888. Download the IA32 GNU/Linux Installer. To launch the graphical installer use this command from the command line: sh arm-2010q1-18-arm-none-eabi.bin
  2. Ensure that the Do not modify PATH option is selected.

  3. Install the Java Runtime Environment (JRE):
    • Chose the Add/Remove command from the Applications menu
    • Type "Java" in the search field, check the Sun Java 6 Runtime or OpenJDK Java 6 and press the Apply Changes button.
  4. Download and install Eclipse Helios. Eclipse foundation provides many packages each one suitable for a particular development. The Eclipse IDE for C/C++ Developers is a good starting point for embedded application. To install Eclipse extract the archive content in the installation folder (~/Applications in my case).
  5. Download and install OpenOCD.On February 13th, 2009 the developer group released the first official distribution, but it is a very active project. For this reason I prefer to install OpenOCD from the source code. I first need to install some development tools in order to be able to download the latest source code, compile it and install it. Lets go...
    • Open the Terminal application and type the command git. The shell notifies that git is not installed and suggests how to get it using APT.
    • Use the command sudo apt-get install git-core.
      • Insert your password when required and follow the on screen instruction.
    • Install the build-essential package using the command sudo apt-get install build-essential.
    • Install the patch tool using the command sudo apt-get install patch.
    • Inslall the automake tool using the command sudo apt-get install automake1.10
    • Install the libusb-dev package using the command sudo apt-get install libusb-dev. It is needed to compile OpenOCD with Versaloon support.
    • Install the libtool package using the command sudo apt-get install libtool.
    • Install the texinfo package using the command sudo apt-get install texinfo. It is needed to build the OpenOCD documentation.
    • Install the TeX package using the command sudo apt-get install texlive. It is needed to build the OpenOCD documentation.
  6. Now I'm ready to install OpenOCD. I use a script to automatically do the job.
    • Download the OpenOCD_v2.0beta.tar.gz archive at the bottom of this page.
    • The archive contain a folder named OpenOCD. Extract the archive content in the destination folder
    • Make sure the internet connection is up.
    • Use the command ./update from the OpenOCD folder in the Terminal application to download the last sources from the remote OpenOCD repository, build it, install it. If you want generate the documentation in pdf format use the command make pdf. Below is the content of the OpenOCD folder when the script ended.

    • The script download the latest sources in the openocd folder. If you have build the documentation, you find the openocd.pdf manual is in the openocd/doc folder. Make places the final executable in the openocd/src folder.  Please, insert your password when required to allow make to install openocd in the /usr/local/bin folder
    • Sometime the script fails because the last version of OpenOCD is under development. If the script fails, try to install an older version by passing the version number to the script as a parameter. [This features is not supported at the moment. Sorry!]
  7. The latest step is to install the Versaloon driver and configure our Linux distribution in order to use it.
    • Blacklist cdc_acm.
      cdc_acm is used by default if a CDC device is connected.
      But if cdc_acm is used, libusb will fail to operate Versaloon.
      Edit /etc/modprobe.d/blacklist.conf with root permissions by appending blacklist cdc_acm.
    • Reconnect Versaloon, cdc_acm will not be loaded automatically. Use the dmesg command to verify that cdc_Acm is not loaded.
    • Now Versaloon (the hardware IF) is ready to be used to flash the MCU and debug the application, but in Ubuntu driver module can't be accessed in user mode. So I should run sudo openocd ...
    • To use Versaloon as non-root user, I configure the rules of udev:
      • Download the 60-versaloon.rules file at the bottomo of this page.
      • Copy it into /etc/udev/rules.d/ with sudo: sudo cp 60-versaloon.rules /etc/udev/rules.d.
      • Replug Versaloon.
Now our Linux distribution is ready.  Download the demo source files by looking at the instruction provided in the Download section. The following section explain how to configure Eclipse Ganymede.

Eclipse Configuration

Please refer to the "Developer environment setup" section of the "Eclipse demo(STM32)" web page for general information on Eclipse configuration. Read also this web page containing information specific to Eclipse Ganymede. Following are some details to Linux specific configuration.

  1. To tell Eclipse how to find the CodeSourcery tool chain select the Properties command from the Project menu.
  2. In the "Properties for RTOSDemo" dialog select the Environment panel.
  3. Press the Add... button to add a new Project specific environment variable.
    Type "PATH" in the Name field, and "${PATH}:<CODESOURCERY_ROOT>/bin" in the "Value" field.
  4. Press OK to confirm.
  5. Select the Debug Configuration... command from the Run menu.
  6. Select the RTOSDemo configuration under the GDB Hardware Debugging tree item.
  7. Select the Debugger tab.
  8. Insert the full path of the arm-none-eabi-gdb executable in the GDB Command field.
  9. Press the Apply button to confirm.

The Managed Build System (MBS)

Starting from version v1.3.0 the  workspace contains two projects. The second project, RTOSDemo_mbs, is open by default whereas the original Makefile project RTOSDemo is now closed.
The RTOSDemo_mbs project has not a Makefile, but you can build it with the Build command. This is because this project uses the managed build system of the Eclipse framework. This means that the Makefile is automatically generated and managed by the IDE for all project files. This is a great features if you don't like to manually edit a Makefile! I configured this workspace so that the source files are the same for both projects, so it is possible to use the preferred project type, the Standard Makefile project (RTOSDemo) or the Managed project (RTOSDemo_mbs). To use the last one you have to install the GNU ARM Eclipse Plug-in, a great open source project! :-) Simply follow The recommended way in the  plug-in installation instruction  web page.

That is all. Now I can compile, flash the MCU and debug the application in the usual way! :-)

Download

Starting from July 2010 I'm using Dropbox as hosting service.

You find the old versions packaged in one monolithic zip file at the bottom of this web page. The latest version of the demo file is located in the Download page of the site. To build the demo are needed teh following components:
  • The FreeRTOS source files: Source.zip
  • The files shared by all demos: Common.zip
  • The demo specific files: CORTEX_STM32F103E_Eclipse_Linux.tar.gz
Please look at the Download web page for more details.

Latest news


  • New Version released The demo now supports the Firmware Component Architecture (FCA) concept. I published a new web site in order to review my development approach without disposing all information I collected until ...
    Posted May 15, 2011, 11:56 PM by Stefano Oliveri
  • Uploaded demo v1.3.0 This version was developed on STM3210E-EVAL board powered by the hi-density STM32 MCU.The full project (FreeRTOS sources, Common demo files, project specific files) is available at the ...
    Posted Aug 31, 2010, 7:01 AM by Stefano Oliveri
  • Uploaded OpenOCD v2.0beta OpenOCD has migrated from SVN to git repository. The demo page was updated to explain how to install and use git to build OpenOCD. The file OpenOCD_V2.0.tar ...
    Posted Feb 7, 2010, 9:08 AM by Stefano Oliveri
  • Uploaded demo v1.2.0 This version was developed on STM3210E-EVAL board powered by the hi-density STM32 MCU.The full project (FreeRTOS sources, Common demo files, project specific files) is available at the ...
    Posted Aug 31, 2010, 6:30 AM by Stefano Oliveri
  • Uploaded OpenOCD_v1.4beta What's new:- Tested with OpenOCD trunk 2570.- The patch file is not applied for trunk greater than 2000.
    Posted Aug 3, 2009, 10:55 AM by Stefano Oliveri
Showing posts 1 - 5 of 10. View more »

Known Issues


Questions, Suggestions, Bugs, and...

Every feedback is welcome. If you have a suggestion to improve a demo or the web pages, it's ok. If you found a bug in a demo, please let me know. If you have an idea to improve a demo, I'm pleasure to discuss about it. If you have any questions about a demo, I hope to have the answer!

If you want leave a feedback, please use this web page.

Users wishing to obtain support could also use the Open Forum.


All the code is developed for test purpose and it is unsupported. The author assumes no responsibility for any damage caused by improper uses.
Subpages (1): Latest news
ċ
60-versaloon.rules
(0k)
Stefano Oliveri,
Mar 17, 2009, 2:49 PM
ċ
OpenOCD_v1.1beta.zip
(12k)
Stefano Oliveri,
Apr 9, 2009, 2:15 PM
ċ
OpenOCD_v1.2beta.zip
(1k)
Stefano Oliveri,
May 18, 2009, 1:37 PM
ċ
OpenOCD_v1.3beta.zip
(2k)
Stefano Oliveri,
Jun 2, 2009, 10:55 AM
ċ
OpenOCD_v1.4beta.zip
(2k)
Stefano Oliveri,
Aug 3, 2009, 10:51 AM
ċ
OpenOCD_v2.0beta.tar.gz
(1k)
Stefano Oliveri,
Feb 7, 2010, 9:00 AM
ċ
demo_src_v1.0.tar.gz
(3847k)
Stefano Oliveri,
Mar 17, 2009, 2:55 PM
ċ
demo_src_v1.1.tar.gz
(6155k)
Stefano Oliveri,
May 18, 2009, 1:39 PM
Commenti