Sory for bad English, please.
I need write a time-critical piece of code (a strict part of software protocol implementation via bit-bang) that uses delays. C preprocessor at the compile time can compute the number of clock cycles (with F_CPU
macro) for a delay, so I need to implement a assembler delay code for unknown number of cycles.
But GCC provide very useful function __builtin_avr_delay_cycles(unsigned long cycles)
that make delay exactly cycles
clock cycles for defined F_CPU
frequency.
Question. Is there way to use __builtin_avr_delay_cycles
within inline-assembler code?
Note. Bypass way is like this:
__asm__ (...);
__builtin_avr_delay_cycles(...);
__asm__ (...);
but the compiler can make some code around __asm__
pieces. It is bad for me, I need to control each clock cycle.
No, compiler built-ins are not real functions and cannot be called from assembler, nor will the compiler recognise them within assembler.