Turbo51 is a free Pascal compiler for the 8051 family of microcontrollers - http://turbo51.com
Дистрибутив 470К в архиве, free, но не open source.
Main features:
* Win32 console application
* Fast single-pass optimizing compiler
* Borland Turbo Pascal 7 syntax
* Full floating point support
* Mixed Pascal and assembler code
* Full use of register banks
* Advanced multi-pass optimizer
* Smart linker
* Generates compact high quality code
* Output formats: BIN, HEX, OMF
* Assembler source code generation
* Source-level debugging with absolute
* OMF-51 extended object file
Used optimizations:
* Constant folding
* Integer arithmetic optimizations
* Dead code elimination
* Branch elimination
* Code-block reordering
* Loop-invariant code motion
* Loop inversion
* Induction variable elimination
* Instruction selection
* Instruction combining
* Register allocation
* Common subexpression elimination
* Peephole optimization
Мигалка:
program blinky; procedure init; begin tmod := 1; tr0 := true; et0 := true; ea := true; end; procedure systick; interrupt timer0; var led : boolean absolute p1.1; begin led := not led; end; begin init; end.
Это всё, никаких доп файлов не требуется, компилируется в bin просто turbo51 blinky.pas
Сгенерированный ассемблер:
; Turbo51 version 0.1.3.17, Copyright 2000 - 2013 Igor Funa $REGISTERBANK (0) _CODE SEGMENT CODE EXTRN IDATA (StackStart) ; program blinky; ; ; procedure init; RSEG _CODE USING 0 init: ; begin ; tmod := 1; MOV TMOD, #1 ; tr0 := true; SETB TCON.4 ; et0 := true; SETB IE.1 ; ea := true; SETB IE.7 ; end; RET ; ; procedure systick; interrupt timer0; ; var ; led : boolean absolute p1.1; led BIT P1.1 CSEG AT $000B systick: ; begin PUSH PSW MOV PSW, #0 ; led := not led; CPL P1.1 ; end; POP PSW RETI CSEG AT $0000 AJMP blinky RSEG _CODE blinky: ; ; begin MOV SP, #StackStart-1 ; init; LCALL init ; end. L_0009: SJMP L_0009 RSEG _CONST END