I have a macro which is supposed to service the internal watchdog in a Dallas 87C520. The code looks like this: #define clearWatchdog() EA=0; TA=0xAA; TA=0x55; RWT=1; EA=1 The problem is that instead of repeating the macro everytime I have the clearWatchdog(); instruction in my C code the compiler has implemented the macro as a long call. How can I make it implement the macro inline?
As for the reverse in-lining, you'll need to be sure that the optimization is set for speed and maybe drop down a bit in optimization level too. maybe OT(8, speed)? Keep dropping the OT level until it stops doing the common code factorization. - Mark
OT(8) will work fine here. If you still want to use OT(9), the following trick will do:
#define clearWatchdog() do { EA=0; TA=0xAA; TA=0x55; RWT=1; EA=1; } while (0)