I am trying to share common block in my code to bring down the code size. It's just like the common block subrountine function in Keil.
I am trying to do that in my C code to write c function for share block. But I found that even if I make all the local variables golbal and doesn't pass any parameter, the compile result with SDCC still tries to push and pop. My observation is that sometimes, it pushes and pops AR1-AR4, sometimes it doesn't. I wonder if anyone knows a way to config the compiler so that it doesn't push and pop anything while calling a function.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to share common block in my code to bring down the code size. It's just like the common block subrountine function in Keil.
I am trying to do that in my C code to write c function for share block. But I found that even if I make all the local variables golbal and doesn't pass any parameter, the compile result with SDCC still tries to push and pop. My observation is that sometimes, it pushes and pops AR1-AR4, sometimes it doesn't. I wonder if anyone knows a way to config the compiler so that it doesn't push and pop anything while calling a function.
I'm not sure I understand, but I think you want --callee-saves.
define a function with __naked. It will eliminate 'ret' also, you need assemble code __asm ("ret") at the end of function
Last edit: Maarten Brock 2016-07-23