HOME

SDCC and Eclipse for 8051

There is a complete free and open source toolchain for 8051 microcontroller.

This is the combination of following

1. Eclipse IDE

2. SDCC Compiler

 

1. Eclipse IDE:

Eclipse is free and open source ide, which is now a days used widely across different development tools.

This ide was initially developed by IBM and later donated to open source community. This IDE is used for JAVA, PHP, C/C++ etc developments. There are lot of plugins available for different purposes, these plugins are available either free of cost or commercially.

For more about eclipse  more.. .

you can download it from following link…

www.eclipse.org

2. SDCC (Small Device C Compiler)

SDCC (Small Device C Compiler) is free open source, retargettable, optimizing ANSI-C compiler by Sandeep

Dutta designed for 8 bit Microprocessors.

8051 family

Freescale (formerly Motorola) HC08

Zilog Z80

It is also distributed under GPL.

To read more Click Here

 

Development Tools for 8051

For 8051 we need following tools

1. Eclipse IDE for C/C++ Developer

2. SDCC compiler for window

3. Eclipse Plugin for SDCC compiler

 

All above mentioned tools are free of cost, let us see then in details

 

Download Eclipse IDE for C/C++ Developers

Download eclipse IDE for C/C++ development from this location

For window this is the name of file eclipse-cpp-ganymede-win32.zip

http://www.eclipse.org/downloads/

           

 

 

Download SDCC

For downloading of SDCC please visit following link

SDCC download page

http://sourceforge.net/project/showfiles.php?group_id=599/&abmode=1

There select sdcc-win32.

This is exe file and will install by running it.

Downloading Eclipse Plugin for SDCC

For eclipse plugin click on following link.

 

Eclipse – SDCC

http://eclipse-sdcc.sourceforge.net/

Following is the link for downloading eclipse plugin

Click Here

 

Installation Procedure

Now we have all the tools needed to prepare our free development tool chain for 8051 microcontroller.

 

Let us install them.

Install SDCC

Just click on the setup file  and installation will start

 

Click on Next to proceed further.

 

Here accept this GNU license.

 

 

Choose the SDCC folder here.

 

 

At this point we have to choose components of SDCC for that choose all here.

 

Here choose installation path as per your system.

 

Installation is going on…

After that it will ask to add SDCC installation path into your PATH variable, just make sure that it is checked and click on Finish.

 

            Checking sdcc installation

            To check whether SDCC is properly installed on not, just open DOS Prompt and type

            sdcc –version

            this command will show you version of SDCC compiler installed in your PC.

 

 

 

Installing Eclipse

Installation of eclipse is very simple, just extract the zip fine into C drive.

Just right click the archieve and extract it into C drive.

Checking Eclipse Installation

 

After that a folder in the name of eclipse will be created.

Now there will be eclipse.exe file in that folder just double click on that file and eclipse will start.

 

Installing Eclipse Plugin for SDCC

Installation of the eclipse plugin little tricky. Actually for installation of eclipse plugin we just have to copy files into corresponding folder.

Actually in eclipse there are two folders

C:\eclipse\features

and

C:\eclipse\plugins

same two folders will also be there in your downloaded plugins, so actually we just need to copy content of plugins and features folder of [net.sourceforge.eclipsesdcc-1.0.0-win32.x86] folder.

I hope this figure will tell complete story

 

 

After copying content from net.soruceforge.eclilpsesdcc folder into corresponding eclipse’s plugins and features folder, content of features and plugins will be as following.

Feature folder                                                                            Plugins folder

 

              

 

see only highlighted folders only , because rest of folders depends on other plugins which are installed in our PC.

Creating project

Click on eclipse.exe present in eclipse installation directory,  eclipse welcome window will open

 

 

 

 

click on Go to workbench button to reach to workbench.

 

 

 

 

 and workspace launcher will opened

 

Choose appropriate workspace file.

Just open File > New > C Project

 

In this window choose MC551 family as project type.

 

Here give appropriate project name.

 

 

 

In configuration choose both options release and debug.

In Release configuration, generated output file will not contain debugging information.

In Debug configuration, generated output file will contain debug information.

In order to download fine into flash memory choose Release configuration option.

 

click on yes at this point

 

 

This is the view of eclipse IDE. Now we need to add C source file here.

 

For that go to File > New > C Source File

 

Give the C file name.

 

It will open in new new tab.

add following C code in main.c file

#include <8051.h>

void delay()

{

      int i,j;

      for(i = 0;i<=100;i++)

            for(j = 0;j<=100;j++);

}

void main()

{

      while(1)

      {

            P1_0 =0;    // led glow

            delay();

            P1_0 = 1;   // led off

            delay();

      }

}

Now build the project as shown below.

 

 

 

building is taking place.

After building Release directory will be created. This directory contain .ihx file. This file can be downloaded into flash memory.

 

To download ihx file into memory use programmer.

For further working of SDCC compiler please refer to the sdccman.pdf present in \SDCC\doc directory.