@ccrause
I have some observations on FPC for Arduino Leonardo:
1. After uploading your .hex file on Windows x64 Arduino Leonardo blinking as expected, but its serial port disappear in the system. When I am doing the same with .hex produced by Arduino IDE - there are no such problems, Arduino port appears correctly. After uploading your .hex I can reset Arduino (by pressing button on the board) and I have about 10 seconds to correctly upload anything to Arduino via Arduino IDE. If I dont make it in this time - port disappear in the system. So probably there are some problems in FPC code produced by your example.
2. I compiled your example on my Win x64 system using -Sg and -Si switches. In details .elf is slightly different (additional code generated for debugger, different names of routines etc.), but .hex file is the same. The result of uploading is also the same.
3. Initially I had some problems with your example. I set controller to ARDUINOLEONARDO (absolutely correctly) which unfortunately does not define FPC_MCU_ATMEGA32U4 but FPC_MCU_ARDUINOLEONARDO. At the time I can fix this problem by modifying ifdefs in your example:
const
{$if defined(FPC_MCU_ATMEGA328P) or defined(FPC_MCU_ATTINY104) or defined(FPC_MCU_ATMEGA8)}
// Assume Uno or attiny104 Xplained Nano layout
LEDpin = 1 shl 5;
{$elseif defined(FPC_MCU_ATMEGA32U4) or defined (FPC_MCU_ARDUINOLEONARDO)}
// Assume Leonardo layout
LEDpin = 1 shl 7;
{$elseif defined(FPC_MCU_ATMEGA2560)}
// Assume Mega layout
LEDpin = 1 shl 7;
{$else}
LEDpin = 1 shl 2;
{$endif}
Maybe I am wrong but in my opinion in such case compiller should automatically define FPC_MCU_ATMEGA32U4 (not using name of controller but the name of used unit). Or better - should define both FPC_MCU_ARDUINOLEONARDO and FPC_MCU_ATMEGA32U4.