We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi!
To speed up a routine in a C-project, I implemented a function which is called several times in assembler. At the moment it looks like the following:
void myop(unsigned char a, unsigned char b) { #pragma asm ..... #pragma endasm } myop(1, 2); myop(3, 4); ....
If I take a look at the debuger, the compiler always does a LJMP to execute the function. The assembler code in myop() is ~35 lines of code.
Is it possible to define myop as a macro that it gets completely inlined without doing LJMPs?
I am search for something like:
#define myop(a, b) (#pragma asm; .....; #pragma endasm)
Or maybe I can just include in from some external file?
Thanks for help in advance! Cheers Markus
A standard C preprocessor can't generate preprocessor statements from a #define'd macro. So, your choices to repeat at each point of call would be manual #pragmas:
#pragma asm MyMacro() #pragma endasm
or, as you say, an separate file containing the pragmas and code with a #include inserted at the point of call:
#include "mymacro.i"