8051 C Development Using FREE Compiler SDCC

SDCC is a free and open source compiler for 8-bit mcus.

this instructables tell you:

how to install sdcc compiler;

how to use sdcc to compile a 8051 c program;

how to use a makefile for sdcc program;

Not tell you:

how to write a program in C;

how to download to program to the MCU;

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Download and Install

download sdcc from : http://sdcc.sourceforge.net

windows users have to download unxutils in order to use makefile: http://unxutils.sourceforge.net

BTW: while installing, select "add to system path".

after that, open a commandline, input:



you should see something like below picture;

if you get: command not found. this means something is wrong. most likely that the program is not added to the system path.

Step 2: Doc Structure and Makefile

their are 4 forlder and one makefile file.

hex folder-- compile result.

inc folder-- include files folder

obj folder-- object files folder

src folder-- source files folder


the makefile can scan the src file, compile the src/*.c file to one hex file in hex folder.

usually the only thing in makefile need to be changee is the TARGET.

which means the hex file name.

the sdcc_hello_world.zip is the makefile and test files.

Step 3: Write You Code and Compile

touch(make a empty file ) a test.c file in folder src.

write some test code like that:


void main()
{ while(1); }

save the file.

and type make on the directory where makefile exist.

something like that may show up, which means you have compiled you file correctly.

Step 4: DONE

I have put the test file into a zip file, so that you could download and try easily.

Be the First to Share


    • CNC Contest

      CNC Contest
    • Make it Move

      Make it Move
    • Teacher Contest

      Teacher Contest