8051

From ElectroDragon
Jump to: navigation, search

Complier

Keil C51

SDCC

  • 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

STC

  • 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

Flash STC

Datasheet

Demo Code

  • C51 (mostly in Chinese)