[fpc-pascal] AVR Busy Wait implementation

Simon Ameis SAmeis.fpc at web.de
Mon Jan 18 23:04:05 CET 2016


Thanks for the hint! I've had declared delay_loop_1 and delay_loop_2
just inside the implementation section.

Maybe these points should be added to documentation for inlining?
- assembler procecedure currently can't be inlined (may change)
- all procedures called by the procedure and all types used by variables
inside the procedure and must be visible at the calling point; this also
disallows unit private types (but procedure local types are okay).

Am 17.01.2016 um 23:56 schrieb Jeppe Johansen:
>
> On 01/17/2016 11:15 PM, Florian Klämpfl wrote:
>> Am 17.01.2016 um 22:01 schrieb Simon Ameis:
>>> I've now come up with the code below.
>>>
>>> The main problem is, that FPC doesn't inline the procedure _delay_ms.
>>> Thus the calculation of the required ticks is done at runtime wich
>>> timing is merely unpredictable.
>>>
>>> What must be done to get this procedure inlined?
>>>
>> Here it does. Did you add {$inline on} ?
> It probably doesn't if delay_loop_1 and delay_loop_2 are private
> procedures inside a unit referenced from another unit. Then _delay_ms
> would be a procedure referencing the static symbol table. Could that
> be what's going on?
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>



More information about the fpc-pascal mailing list