Use the inline keyword or the command line option -Oi for C/C++ functions. The following listing defines a function before it is used helps the Compiler to inline it:
/* OK */ /* better! */ void fun(void); void fun(void) { void main(void) { // ... fun(); } } void main(void) { void fun(void) { fun(); // ... } }
This also helps the compiler to use a relative branch instruction instead of an absolute branch instruction.