Difference between revisions of "FreeRTOS CortexM3 HowTo"

From ConceptCar
Jump to: navigation, search
Line 21: Line 21:
 
   http://developer.berlios.de/project/showfiles.php?group_id=4148&release_id=17280
 
   http://developer.berlios.de/project/showfiles.php?group_id=4148&release_id=17280
  
4) Since June/July of 2009 due to alleged GPL license violation OpenOCD cannot be distributed with support for ftd2xx.dll library. That's why FT2232 JTAGs have to be used via libusb-win32 drivers, and OpenOCD will be linked with libftdi library.
+
4) Because of a GPL license violation OpenOCD cannot be distributed with support for ftd2xx.dll library. FT2232 JTAGs have to be used via libusb-win32 drivers and OpenOCD will be linked with libftdi library.
  
  

Revision as of 08:13, 13 July 2010

We need several things to run FreeRTOS on a CortexM3 in Eclipse:

Configuring Eclipse

1) Download Eclipse CDT from the Website below and install it:

  http://eclipse.org/downloads/packages/

2) Now you will need to install Zylin GDB embedded debugging plugin. Therefore open Eclipse, go to Help->Software Updates or Help->Install new Software (depends on which Version of Eclipse CDT you are using). Download and install Zylin Embedded CDT from:

  http://opensource.zylin.com/zylincdt 


Get FreeRTOS and a Toolchain

1) Download the newest Version of FreeRTOS from

  http://sourceforge.net/projects/freertos/files/FreeRTOS/

2) The next step is to get a Toolchain. In our case, we decided to work with the Sourcery G++ Lite because it supports us with a special library for the thumb2 which the Cortex M3 is using. For downloading CodeSourcery G++ Lite use the following Link:

  http://www.codesourcery.com/sgpp/lite/arm/portal/subscription?@template=lite

3) After all that, be sure using the newest Version of OpenOCD, which can be downloaded from

  http://developer.berlios.de/project/showfiles.php?group_id=4148&release_id=17280

4) Because of a GPL license violation OpenOCD cannot be distributed with support for ftd2xx.dll library. FT2232 JTAGs have to be used via libusb-win32 drivers and OpenOCD will be linked with libftdi library.


Create an Eclipse Project for using FreeRTOS

There are different ways to create a FreeRTOS specific Project under Eclipse. In this case, the Project contains three folders:

- FreeRTOSSource
- Boot
- Scripts

The FreeRTOSSource folder includes all FreeRTOS specific Header and Source files. The Boot folder contains all files which are necessary for the Board. The Script folder holds the cfg for openOCD and the linker scripts.

The following steps describes how to create a Project which is running FreeRTOS.

1) Create a new empty C Makefile Project

2) Create the three folders mentioned above. The FreeRTOSSource folder and the Boot folder are declared as source folders.

3) Fill the FreeRTOSSource folder with the FreeRTOS specific files you will need. Do not forget to copy also the Port.c, Portmacro.c and the heap_n.c files into FreeRTOSSource. The files Port.c and Portmacro.c can be found at ..\FreeRTOS Install Path\Source\portable\GCC\ARM_CM3 if an CortexM3 is used with the gcc. If the gcc is not the compiler you are using, the portable folder contains all by FreeRTOS supported compiler and Microcontroller. The MemMang folder which can also be found at ..\FreeRTOS Install Path\Source\portable\ holds heap_1.c, heap_2.c and heap_3.c. In our case heap_2.c is used.

4) Go to Project Settings->C/C++ Build

4.1)under "Settings" select "GNU Elf Parser"

4.2)under "ToolChain Editor" select "No Toolchain"

5) Go to Project Settings->C/C++ General->Paths and Symbols and add the following folder to GNU C

  \Code Sourcery Root\arm-none-eabi\include

6) After preparing the folder structure, the next step will be to configure OpenOCD and the GDB debugging.

For configuring OpenOCD click Run->External Tools->External Tools Configurations.

6.1) Create a new configuration for OpenOCD by:

6.1.1) choosing a name for the new created configuration

6.1.2) setting the location of the openocd.exe

6.1.3) setting the working directory

6.1.4) specifying the arguments to run openocd. Below is a simple example for the arguments used for the Olimex STM32, Olimex JTAG TINY

-f \openocd-0.4.0\0.4.0\board\olimex_stm32_h103.cfg

-f \openocd-0.4.0\0.4.0\interface\olimex-jtag-tiny.cfg

-c init

-c reset run

-c halt

-d 3

-l openocd.log

-f can be used to load e.g. a configuration file. -c specifies commands for openocd. -d chooses the debug level and with "-l openocd.log" a Log file will be created and saved under openocd.log

6.1.5) Save changes by clicking on the Apply Button


The next step is to set the Debug Configurations, therefore go to Run->Debug Configurations

6.2) Create a new configuration for Debugging:

6.2.1) Create a new Zylin Embedded debug (native) configuration

6.2.2) Choose a name for the new configuration

6.2.3) Select the Project

6.2.4) Pick the C/C++ Application which should be used

6.2.5) Click on Debugger Tab and load the GDB debugger

6.2.6) Commands Tab and use the following 'Initialize' Commands for GDB

target remote localhost:3333

reset

load

break main

6.2.7) Save changes by clicking on the Apply Button