Home > Hobby, Tech > ARM development under Ubuntu 10.04

ARM development under Ubuntu 10.04

Introduction

ARM is a very popular microprocessor architecture for embedded systems. Many mobile phones, netbooks and other similar portable computing and communication devices have an ARM core inside. Usually these ARM based embedded systems will have some operating system as well. Hence application development for ARM can be either on top of the OS or without the OS. In this page I will be describing about development of ARM applications without an OS (bare metal development).

C is the language of preference for embedded development, especially when it comes to systems without OS. I’m using the following set of tools to develop the C code and turn it into a machine language.

Tools

Code::Blocks IDE

Compiler, Linker etc.

Computer with Ubuntu Linux

Setting up the system

Code::Blocks is an easy to use Integrated Development Environment, which can be installed form Synaptic Package Manager or Ubuntu Software Center. Install Code::Blocks from one of these application.

Some of the bare metal development tools are listed here. Download the GNU GCC Toolchain for Linux. Extract the archive file by right click >> extract here. Now open the terminal and move the extracted folder to /usr/local/ directory. This can be done by issuing the command sudo mv arm /usr/local/. Though it is not absolutely necessary to move it to the /usr/local/ directory, it is the neat way. Add the location of the binaries to PATH, by issuing echo ‘export PATH=/usr/local/arm/bin:$PATH’ >> ~/.profile. You will need a reboot(Logging out and Logging in may be enough) of your computer for the new path to take effect. Verify whether the steps so far are done correctly by issuing arm-elf-gcc -v and see if the gcc is reporting the version. With this the tool chain installation is done.

You have to configure Code::Blocks to use the ARM GCC Toolchain. For this, goto Settings>>Compiler and Debugger…. A dialog box as shown below should appear.

Change Selected Compiler to GNU ARM GCC Compiler. Choose the Linker settings Tab, and add to other linker options -TLPC2129-ROM.ld, as shown. This configures the Code Blocks to use the file named LPC2129-ROM.ld as the linker configuration script.

In the Search directories tab, add /usr/local/arm/arm-elf/include for Compiler and /usr/local/arm/arm-elf/lib for Linker. This step make the Include and lib directory known to Code::Blocks and hence the compiler/linker.

Click on the arrow to the right of the Search directories tab, to reveal more tabs. In the Toolchain executables tab, set the Compiler’s Installation Directory to /usr/local/arm. Press OK to save the configuration. Code::Blocks is now configured correctly with the ARM GCC toolchain.

Starting an ARM project

Choose File>>New>>Project. Select Empty Project from the dialog box, and press Go. Enter ‘Folder to create Project in:’ and ‘Project Title:’ and press Next. Choose GNU ARM GCC Compiler, and clear the ‘Create “Release” Configuration’ checkbox, and press Finish. Now you can add your own source codes to the project. Do remember to add a crt0.S file to the project and to keep a file named LPC2129-ROM.ld in the project’s directory.

Advertisements
Categories: Hobby, Tech Tags: , , , , , ,
  1. No comments yet.
  1. March 10, 2011 at 10:34 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: