Recent

Author Topic: avr hardware pins acces from pascal[SOLVED]  (Read 7363 times)

PascalDragon

  • Hero Member
  • *****
  • Posts: 4014
  • Compiler Developer
Re: avr hardware pins acces from pascal[SOLVED]
« Reply #15 on: January 17, 2022, 01:36:08 pm »
Btw, bithelpers have been added to trunk FPC (sysutils and syshelpers), so now you should also be able to do something like this (not tested on AVR):

Two points:
  • the SysUtils unit is not available on AVR
  • it's not said that the helper code can produce as streamlined code as what code mentioned above is generating (though I did not test that either)

avra

  • Hero Member
  • *****
  • Posts: 2331
    • Additional info
Re: avr hardware pins acces from pascal[SOLVED]
« Reply #16 on: January 17, 2022, 03:01:46 pm »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

dseligo

  • Hero Member
  • *****
  • Posts: 580
Re: avr hardware pins acces from pascal[SOLVED]
« Reply #17 on: January 17, 2022, 06:23:26 pm »
@dseligo: Try specifying optimization, such as -O1.  The compiler by default generates conservative instructions, which gets optimized by the peephole optimizer.

Thanks, that was the cause.
I struggled to find it for a while. I tried to set optimization level in Lazarus' Project Options without success,
This was inserted in the top of the source when I created it with '[Embedded GUI] AVR-Project (Arduino)' in Lazarus:
Code: Pascal  [Select][+][-]
  1. {$H-,J-,O-}

Once I removed O- everything worked. :)

 

TinyPortal © 2005-2018