Showing posts with label assembler. Show all posts
Showing posts with label assembler. Show all posts

Wednesday, December 4, 2013

Prevent GCC from auto-inline a function

Sometimes GCC goes too "smart" by inlining a function (put entire block of it's code directly in place) rather than assembling it as normal subroutine (block of code invoked by RCALL/CALL instruction and returns with RET instruction).

You can tell GCC not to automatically inline a specific function by declaring noinline attribute modifier before function type declaration. For example:
__attribute__((noinline)) int myStrictFunction() { }

Thursday, November 28, 2013

Online Tool for Easily Write Inline Assembler from Arduino IDE

Inline assembler is practical optimizing technique to speed-up some time-sensitive routines in your program. Unfortunately, it's not as convenience as it should be, for example:
  • You have to enclose asm instructions within quotes
  • You have to manually add hard-coded line separator (and tabs, for making it readable for later debugging)
  • You have to manually describe what register used for input/output, plus you have to report what registers are being clobbered
To help you assembler-inlining, we create this simple tool for you. No software to download / install, it's running right in this blog using embedded javascript. Just type your code below and hit the  Generate Code  button below, an inline assembler code suitable for avr-gcc will be automatically generated.
Enter your plain assembler code below...
Click to generate inline assembler code...