Using eclipse IDE for embedded development

From Embedded Nirvana

Jump to: navigation, search

Eclipse is one of the finest editor that the programmer can use for their development work, be it Java, C/C++, Python, PHP, etc.


Contents

Brief about Eclipse architure

Eclipse is based on OSGI architecture which allow IDE to dynamically enhance itself with modular packages which can be added at any point of time without disturbing the existing code.

Eclipse was initially developed for


Configuring your gcc cross-compiler with Eclipse

  • You can download the CDT IDE here.
  • Make sure you have jre installed on your machine, because eclipse needs JRE.
  • Unpack the zip file in preferably in your home dir and start the eclipse IDE.
  • Specify workspace (default dir where all your projects would be created.)
  • Now create new project "HelloArmWorld" from File-> C project
  • Right click on the project in the "Project explorer" window select Properties
  • In the C/C++ Build entry, select Settings then GCC C Compiler then insert the path of the ARM compiler in the field Command; i.e.:
arm-linux-gcc 
  • Now the ARM linker has to be chosen as well. GCC C Linker then insert the path of the ARM linker in the field Command; arm-linux-gcc
  • And finally the ARM assembler. GCC Assembler then insert the path of the ARM assembler in the field Command; arm-linux-as
  • Now we have to specify where our include files are. The include folder basically consist of glibc header file. If your are unsure what is the path to the include folder you can run a simple commmand.
cd /opt/toolchain/
find . -iname string.h

so mine turned out to be

/4.3.3/arm-none-linux-gnueabi/libc/usr/include/linux/string.h

Now mention the complete path in the C/C++ General, select Paths and Symbols then GNU C in languages and add

/opt/toolchain/4.3.3/arm-none-linux-gnueabi/libc/usr/include/

Depending on the application additional paths can be specified.

Getting started

Now let start with a hello world example. Create a hello.c file in your project.

#include <stdio.h>

void main()
{
	printf("Hello world");
}


Building your project

press CTRL+b , shortcut for build.

You would find a make file being generated.


################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables 

# All Target
all: helloarmworld

# Tool invocations
helloarmworld: $(OBJS) $(USER_OBJS)
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C Linker'
	arm-linux-gcc  -o"helloarmworld" $(OBJS) $(USER_OBJS) $(LIBS)
	@echo 'Finished building target: $@'
	@echo ' '

# Other Targets
clean:
	-$(RM) $(OBJS)$(C_DEPS)$(EXECUTABLES) helloarmworld
	-@echo ' '

.PHONY: all clean dependents
.SECONDARY:

-include ../makefile.targets

Your would find your binary in Debug folder of your project.

Personal tools