I always wanted to use QtCreator for embedded(ARM) programming. But i never found any documentation regarding that.Most of the tools for arm programming are only available for windows and they are very expensive. With their evaluation version either we can compile up to 32KB or we can use them only for one month.Other free IDE are based on Eclipse. So i decided to write a small plugin for QtCreator so that i can create and manage basic ARM projects without maintaining their makefile and writing other assembly and linker files each time.
What problems this plugin will solve ?
- You can create a new project with some clicks. It will automatically create a generic start up code and linker file, so that you can directly start with main function.
- For each linker file you add to project it will create two build configuration one for release and second for debug mode.With project wizard you will find a ROM.ld file and two build configuration ROM-debug and ROM-release.
- you don’t need to maintain a makefile for the project. When ever you add any source file(c or assembly) it will automatically update the makefile according to its dependency. Right click on project will give you options to build , clean the project and generate makefile for the project.
What are the limitations ?
- Right now it only support C and assembly.
- Only work with GNU Arm compiler (elf or eabi )
- There is no run configuration because running an arm program means loading the bin or hex file to the micro controller and it depends on hardware.
- No debug support.
If you are professional embedded programmer than its not the right plugin for you, but if you are beginner to arm programming this plugin will help you a lot, and i can surely say that QtCreator will save a lot of time. Its editor is the best i have ever seen.This is just a start for this plugin. Right now you can create and manage the basic projects.But i will add lot more feature like full C++ support and debugging along with graphical interface to configure each and every aspect of project.
- make sure you have arm tool chain installed on your system.Sourcery toolchain light is good enough and is available for free.You can download it here . Installed the toolchain on your system. This toolchain is available for both window and Linux.
- Make sure you have a build tool like make. Linux users can install make and windows users can use nmake or other make tools like jom.
How to install ?
For windows users i have compiled the plugin for QtCreator 2.8.1.You can download the QtCreator from Qt official site. I will compile all most of my plugins for QtCreator 2.8.1 because i use don’t use windows all the time and QtCreator update very often. So i have save the QtCreator 2.8.1 installer in my dropbox folder.
Download the QtCreator and plugin from the links above. Install QtCreator. By Default it will install in C:\Qt\qtcreator-2.8.1 directory. Now unzip the plugin in C:\Qt\qtcreator-2.8.1\lib\qtcreator\plugins . Your installation is done. Just restart the QtCreator and you can create Arm Projects.Look the screen shot below for reference.After copying the unzipped ChopsGNU folder in plugin directory of qtcreator the directory will look like the below image.
for linux there is no binary. But you can compile your self from the source code. You can clone the git repository email@example.com:sanjuchopracool/arm-ide.git
How to Build:
- Download the qtcreator source code from qt website
- unzip and open the qtcreator.pro project file in qt creator it will create two configuration one debug and other release . Compile the code in release mode.
- clone the git repo to build the plugin. In BareEmbeededProjectManager.pro file you need to change some of the fields , QTCREATOR_SOURCES is path to qtcreator sourcecode and IDE_BUILD_TREE is path to qtcreator build directory.
- If you building the qtcreator in debug mode then you need to build the plugin also in debug mode otherwise build both in release mode.
How to create a new project ?
creating an arm project is very simple but before that you need to configure toolkit.
Add Arm Toolkit:
open the qtcreator click on the tools menu and select option.Select Build & Run , in that section click on the compiler tab. Add a custom compiler. Gice it a name, compiler path is path to your arm toolchain compiler , click on the browse and select the compiler. make path is path to you build tool in case of linux it will be path to make and in windows it will be path to nmake or other make tool you are using. save this configuration as Arm. See the screen shot below.
Now you are done with toolchain configuration. now you can create new projects.
Creating a project:
From file menu click on new file or project.
click on the Non-Qt project, select Bare minimal arm project and click on choose button.
Select the project parent folder and project name
configure the build setting for the project.
select toolchain and flags to be used for compiling c files and assembly files.
Next configure the linker setting, select the base address and sizes of ROM and RAM for the particular micro controller.
Last setting is related to startup code , you can select the stack sizes for different modes of processor. The processor will run in system mode after setting up stack in each mode.
If you don’t know anything just click on next (working fine for LPC2148)
Now the project will open and it will have four files Asm.g , main.c , Start.S and ROM.ld.
You will find two build Configuration one ROM-Debug and second ROM-Release.
For each build configuration you can change the flags and build directory and whenever you will add a linker file it will add two more configuration for that linker file.
To build the project right click on the project in project explorer and you will see the menu with build, clean and generate makefile options.
Click build – build the project
Clean – clean the project.
generate makefile – wil make a makefile for the current project .
You can also add addition files to project from some other location.