Introduction: 8051 C Development Using FREE Compiler SDCC

Picture of 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;

Step 1: Download and Install

Picture of Download and Install

download sdcc from :

windows users have to download unxutils in order to use makefile:

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

Picture of 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 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.


About This Instructable



More by jiangshan00000:Using Pm2.5 Sensor With Raspberry Pimake an arduino wifi air monitor8051 C development using FREE compiler SDCC
Add instructable to: