Go Down

Topic: Implement C "inline" is a must - please enhance (Read 510 times) previous topic - next topic

Inline mechanism is a must for programming microcontrollers and it has been for that particular reason of slower CPUs. While in todays computers it is insignificant performance improver it can make day and night difference in terms of 16MHz microcontroller.

I am trying to keep interrupt short wired with programming with tone output (if you do not know technique as it is a bit more advanced then let me know so I can explain). It seems that as in old good 8051 series (I was commercial-industrial design engineer with those 20 years ago) this works in Arduino based on newer Atmels just the same. However, I need to process several tens microseconds time intervals as fast as possible and not missing another interrupt. In other word,s I can give up on length of the code, but i need some places to execute the same code without of overhead of calling procedure (yes it takes time to make space for local variables on stack and then clean it up when returning). So I would prefer to save few microseconds and while programming inline function (not a macro please!) to maintain only one version I would prefer it to be fully inline expanded in the interrupt code.

It would not be an issue if we were talking about microcontrollers working 100MHz and above if we wonted to use that speed/power to control on the level of microseconds.

MarkT

I'm not sure, but I think you are asking for more control on the optimization options passed to avr-gcc?
[ I won't respond to messages, use the forum please ]

bperrybap

Have no clue what you are talking about.
"inline" on gcc works just fine.
http://gcc.gnu.org/onlinedocs/gcc/Inline.html

--- bill

Coding Badly

"inline" on gcc works just fine.


And adding the keyword is sometimes not necessary.  Small static functions are automatically inlined.

dhenry

Quote
Inline mechanism is a must for programming microcontrollers


It may make more sense if you can provide a practical example of what you are trying to do, then maybe others can help you get it done more efficiently (with or without inline).

Go Up