C Compiler

From ElectroDragon Wiki
Revision as of 17:25, 14 August 2020 by Chao (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Keil C51 Setup

  • Click the thumbnail to see large GIF animation tutorial
  • Notice to install Keil C51 and MDK-ARM in different folder
  • Add MCU list from STC-ISP into Keil C51
  • Add header file, optionally maybe name it to STC15.h, or any

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.

Notepad

Visual Sudio