I wrote a C extension file program where my function is declared with C langage with parameters and writen in ASM langage: int MyFunc(int param1, int param2) { #asm ... ... #endasm } From other files, the call is working but I have WARNING in compilation of my assembly file on param1 and param2 because I don't use them directly but I use register R4 to R7. The program is working but I don't understand how can I write the program to don't have any warning.
If you want help with Compiler messages, please be sure to tell us precisely what message it is that's bothering you! Presumably, you're getting "Unused local variable" or similar warnings for param1 & param2? As you say, you don't actually use these symbols, so it's not that surprising! However, I find this message rather misleading; I think it'd be more helpful if Keil gave distinct warnings which specifically stated whether it's an usused local variable, or an unused parameter. It would also be useful if there were some way to specify that a particular symbol is known to be "unused" (to be fair, this is a perennial problem, and I don't know of a compiler that handles it well).
in fact with dummy assigments at the beginning of the function warnings disappear int MyFunc(int param1, int param2) { param1 = param1; param2 = param2; #asm ... ... #endasm } it's still warning on non-return value...
Yes, I've seen that trick before, but some compilers actually generate code for the useless statements! With some others, this just gives you a different warning, "code with no effect" or something!