Eclipse is a great multiplatform graphical interface practically for any language. If you choose to use it – you won’t loose. We’ve been using it when writing software for ARM microcontrollers. As compiler Mentor Graphics Sourcery Codebench Lite works just fine. If you have both – Eclipse and Sourcery tools installed we can move on.
So far in our earlier project we’ve been using an external makefile project setup. This means that we had to write/edit makefile in order to compile and link project files. This is hand job and requires some knowledge and time. You cannot run away from them if you are using free tools, but there should be some way out and automate at least some parts of this work. Eclipse Indigo comes with CDT C/C++ development tools. It works great with general C/C+ projects and we’ve been using it without problem along with external makefile and project settings. But there is a better way of developing project for ARM platforms. It’s GNU ARM Eclipse Plug-in. It supports most of GNU toolchains including Sourcery Codebench Lite, Yagarto, GNUARM, WinARM and other. So lets set up Eclipse to use this plugin and see how it works.
Installing GNU ARM plugin
So start Eclipse and go to Help->Install New Software… In field “Work With” enter following URL:
Then Add Repository window pops asking to name this location. Enter GNUARM Plugin in Name field and click OK.
Soon in the list you will see list of available tools:
Just select All and click Next to install. You will have to accept licenses – accept them to continue.
When you get a security warning click OK to continue:
We recommend EasyEDA for circuit design and PCB prototype
After installation completes – restart Eclipse.
After this procedure you are set up to work with C and C++ programs including all editor features. ARM GNU plug-in adds graphical interface of setting GCC projects including makefile creation, and calling toolchain. Lets move on and see how it works.
Creating C project
To do so lets create new project using same STM32 blinky example. First of all go to menu File->New-> C Project. A new window will open asking to select project type. We need to type Project name. Let it be “ST32blinky”. As Project type we need to select ARM Cross Target Application->Empty Project. From toolchains list we select Arm Windows GCC (Sourcery G++ Lite).
After clicking button Next we are asked to select project configurations. Select Debug and Release and click Finish. After this action we should see new project in Project explorer with several Includes listed from Sourcery Codebench.
Now we can start creating and adding project source files. We have working blinky example so we can add those files to test this plugin. First we need to add startup, linker, CMSIS and STM32F10x_StdPeriph_Driver files. And of course our project files main.c, stm32f10x_conf.h, stm32f10x_it.c and stm32f10x_it.c. For this just use import functionality:
Then select files using General->File System. You can import using any directory structure. So in this example we should end up with following structure:
So we have all project files in place now we need to set properties for it as plugin needs to know what processor type is here, where is linker file and where include files to look for. Continue to Part 2.