FreeRTOS.org STM32 demo using Eclipse, OpenOCD and GCC

 I


Last updated February 23, 2011

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 STM32 based embedded application. It must be powerful enough to simplify and speed up the application developing and testing.



My personal thanks to Richard Barry for FreeRTOS.org: I use many of his work, in term of source code and documentation, to build this demo.
Thank you also to Ben that contributed to this demo.



Main Components

  • STM3210E-EVAL - evaluation board.
  • FreeRTOS.org - real time scheduler. Tested with version 6.0.1.
  • OpenOCD - On-Chip debug solution for embedded target systems. Tested with version 0.4.0 RELEASE.
  • CodeSourcery G++ Lite  - ARM EABI GCC development tools. Tested with version 2010q1-188.
  • Eclipse - open development platform (the IDE). Tested with Helios release.
  • Versaloon - the hardware IF.

    The Demo

    Introduction

    I have developed and tested the demo on Windows XP SP3, but all components are cross-platform and are available also for Linux. Should you be interested to port the demo under Linux, please look at the Linux demo web page, it was an interesting challenge! ;-)

    Developer environment setup.

    1. Install the ARM EABI Lite version of the CodeSourcery G++ development tools. I use version 2010q1-188.
    2. Ensure that [install path]/CodeSourcery/Sourcery G++ Lite/bin folder is included within your PATH environment variable.
      • You can leave the setup wizard to modify the PATH variable for you by checking one of the two options as shown in the picture.

    3. If you prefer not to modify the path, you will modify the project configuration later.
    4. Download Eclipse IDE for C/C++ developer, install and configure it. Please refer to the instructions provided by FreeRTOS.org to install and configure Eclipse. I simply followed it! ;-)
      Note that the instruction provided by FreeRTOS.org refers to a previous version of Eclipse - Eclipse Europa - which has some differences in the UI respect to Eclipse Galileo. Look at the "Using the project with Eclipse Ganymede" web page for more information. I will update that web page with information on Eclipse Galileo as soon as possible. To run Eclipse you must have installed a Java Virtual Machine on your PC. You can download the Java Runtime Environment from the Java web site.
    5. Download the demo source files by looking at the instruction provided in the Download section.

      One note about the Project configuration and the Debug Options

      If you did not modify the PATH to include the toolchain folders, Eclipse is not able to find the compiler, the debugger and so on. In this case you have to modify some project options.
      1. Click the Properties command from the Project menu. The Properties for RTOSDemo dialog is displayed.
      2. On the left tree-view choose C/C++ Build and then the Environment tab.
      3. Press the Add button on the right to add a new variable:
        • Set the Name field to PATH
        • Set the Value field to  ${Path};<SOURCERY_G++_LITE_ROOT>\bin folder
        • Press OK to confirm your choice.
      4. Now  open the Debug Configurations dialog from the Run | Debug Configuration... menu.
      5. Choose the Debugger tab.
      6. Set the full path of the arm-none-eabi-gdb.exe file in the GDB Command text box.
      7. Press the Apply button to confirm your choice.
      8. That's all.


      Microcontroller programming and application debugging

      Eclipse cannot itself program the flash memory of a target microcontroller but does provide a convenient interface for calling whichever tool is being used for this purpose. Now it is the time to reveal the last component needed to setup the development environment:
      • Versaloon is the STM32 based dongle I use as hardware interface (IF).
                            Versaloon mini

      It is only one of the IF supported by OpenOCD. Look here for a complete list of suitable IFs. I used also another hardware IF from Amontec before to switch to Versloon because it is better supported, and Versaloon firmware is open and constantly improved. If you want to use the Amontec JTAGkey-Tiny look at this web page.
      Setup Versaloon as follows:
      1. Download and unzip the Versaloon driver for Windows.
      2. The driver package provides many installation files (.inf), but we need only the Versaloon.inf file in order to support OpenOCD.
      3. Connect Versaloon to the PC.
      4. Choose to Browser my computer for driver software
      5. Press the Browser button, search for the <Versaloon_driver_win32_ROOT>\driver\win32 folder, and press the Next button.
      6. When the driver installation is finished Windows shows a dialog to confirm that Versaloon is ready to be used.
      7. For more information about Versaloon driver please refers to Simon Quian web site and the Versaloon how to web page.
      8. If you are interested in buy Versallon please refer to the bottom of the Versaloon web page.
      9. The Eclipse demo project includes a menu item that can be used to program the flash directly from within the Eclipse Workbench. Ensure your target hardware is connected to your host computer and than select Run | External Tools | OpenOCD Programmer(jtag) menu item as showed in the following picture.
      10. Inspect the output in the Console view to ensure the programming operation was successful.
      11. To start a debug session follow these instructions.
      12. That's all.

      One more thing

      (Please, Apple's lawyers let me use these words)

      Let me show you the whole picture. Eclipse is also a powerful source code editor. it uses GCC compiler to produce the ARM EABI coded binary file according to the Makefile. Then Eclipse pass the RTOSDemo.bin file to OpenOCD in order to program the MCU. OpenOCD uses a JTAG hardware interface to comunicate with the MCU, and it acts also as a GDB Server to support Eclipse to debug the application.

      The Open Source Tool Chain

      The next step is to profit from the Eclipse's open Plugin  architecture.

        More details...

        I hope my explanations are clear enough despite my poor English..! (my preferred languages are C, C++, ObjectiveC, Java, ARM
        Assembler and so on :-). If you need more details, or if you are interested in further development, or if you have an idea to improve Eclipse as Embedded Development Platform, or simply if you have any problems with the demo, please don't hesitate to contact me at software@stf12.net

        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 the following components:
        • The FreeRTOS source files: Source.zip
        • The files shared by all demos: Common.zip
        • The demo specific files: CORTEX_STM32F103E_Eclipse.zip
        Please look at the Download web page for more details.

        Eclipse in 7 minutes

        The following video shows how to configure Eclipse. Ok... It show what I tried to explain in this web page and I hope it could be helpful! Before look the video, install the CodeSourcey toolchain, Versaloon and Java.



        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:53 PM by Stefano Oliveri
        • Uploaded demo version 2.10.1 This version was developed on STM3210E-EVAL board powered by the hi-density STM32 MCU.If you have a working configuration you can download only the project files from the ...
          Posted Sep 1, 2010, 2:14 AM by Stefano Oliveri
        • Uploaded demo version 2.10.0 This version was developed on STM3210E-EVAL board powered by the hi-density STM32 MCU.If you have a working configuration you can download only the project files from the ...
          Posted Sep 1, 2010, 2:15 AM by Stefano Oliveri
        • How to buy Versaloon I added some information on how to buy Versaloon. Look at the point 8 of the Microcontroller programming and application debugging section.For simplicity I reported here that point:If ...
          Posted Feb 7, 2010, 9:21 AM by Stefano Oliveri
        • Updated Versaloon driver and installation instruction. I'm starting Windows 7 migration, so some image in the demo have the Aero look.- Uploaded a new version of Versaloon driver. For more information about the change in ...
          Posted Jan 2, 2010, 10:33 AM by Stefano Oliveri
        Showing posts 1 - 5 of 21. View more »

        Known Issues

        Unable to start a debug session. (#B2.1)

        Unable to start a debug session after updating the CodeSourcery G++ Lite to version 2008q3-39. Whit this new version of the GNU tool chain is possible to build the application and to flash the MCU with success, but the system blocks when trying to launch a debug session. The problem persist also whit the update version 2008q3-66.

        The problem seems to be a bug in GDB 6.8.5 that could causes a bad memory access under some circumstance. The workaround is to change the GDB Initialization Command in the Debug Configuration dialog by removing the continue command.

        GDB Inizialitation Commands

        target extended-remote localhost:3333
        b main
        monitor soft_reset_halt

        See this web page for more information on the GDB Initialization Command configuration.
        When a debug session starts, this configuration causes the program execution to stop at first instruction of the Reset Handler.

        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.
        ċ
        Stefano Oliveri,
        Jan 2, 2010, 9:42 AM
        ċ
        demo_src_v2.5.zip
        (7200k)
        Stefano Oliveri,
        May 17, 2009, 3:27 PM
        ċ
        demo_src_v2.6.zip
        (9233k)
        Stefano Oliveri,
        May 17, 2009, 4:15 PM
        ċ
        demo_src_v2.8.zip
        (9018k)
        Stefano Oliveri,
        Jul 14, 2009, 6:48 AM
        Comments