From ElectroDragon
Revision as of 01:14, 3 November 2017 by Chao (Talk | contribs) (Flashing Downloader)

Jump to: navigation, search


Keil C51


  • install sdcc: apt-get install sdcc
  • complie .c file: sdcc main.c, then pack ihx, packihx stc.ihx > stc.hex
  • replace reg51.h by 8051.h header

Multi-file project

SDCC does not support the simultaneous translation of multiple source files, so the compilation of multiple file projects need to be carried out step by step.If your project contains foo1.c foo2.c main.c three files, then the compilation process is as follows:

  • Sdcc -c foo1.c
  • Sdcc -c foo2.c
  • Sdcc main.c foo1.rel foo2.rel

You can also compile using the following methods:

  • Sdcc -c main.c
  • Sdcc main.rel foo1.rel foo2.rel

Finally, you can deal with the ihx file. For multi-file project is best to write a makefile file with make to maintain or write a batch file.

Flashing Downloader


  • STCMCU, download STC-ISP, header file, simulation file.
  • STC-ISP page (old version), version 4.88
  • Use flash magic on windows, in linux use wine flash, support LPC type MCU only
  • Flash in Linux use stcgal: python stcgal.py -P stc15 led.hex -b 1200, stc15 can only work on a low speed
  • gstc-isp in linux
  • stcflash in linux


  • [File:Progisp1.72.zip Download at here]
  • Once you have programmer pluged in, you should see the programm status is "colorful" with corrected programmer name.
  • This is the version 1.72, support usbasp, but not usbtinyisp, seems more powerful.

Flash STC


Demo Code

  • C51 (mostly in Chinese)