arduinofreepascallazarus

What would be involved in getting Free Pascal to compile into AVR, ATMega and Arduino?


Would it be too much of an effort to have FPC compile to the Arduino platform?

I would really like to use Lazarus to do some "sketches".


Solution

  • I'am working from time to time on the FPC AVR port. Current state is: an AVR FPC compiler can be built and it creates reasonable code and we are working on the startup code. After this, we will start to debug the code of simple programs.

    If you want to play with it, you can build (not sure though if it currently builds, we run no regression tests yet on avr) an avr cross compiler from FPC trunk by

    make all OS_TARGET=embedded CPU_TARGET=avr CROSSOPT=-O-
    

    having avr binutils (avr-embedded-*) and FPC 2.4.4 installed (don't forget the CROSSOPT=-O-, the optimizer is currently broken for AVR).

    Edit: Formatting

    Updating my old answer: FPC for AVR got significant improvements

    make all OS_TARGET=embedded CPU_TARGET=avr
    

    works now (FPC trunk) and creates reasonable code (still needs improvements and fixes though).