This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Determine memory usage of C functions

Hi there,

I have a fixed assembly code that I am not allowed to touch. This code potentially utilizes the whole internal memory of my processor.

For some reasons I now have to extend this assembly code by some other code. The other code is already available, but unfortunately it is written in C. Since I am not allowed to touch the assembly code, my problem is now, that I have to adapt the C functions in a fashion that is completly neutral to the assembly code in terms of internal memory usage. Only stack is allowed!

How can I do this?

- Is it possible to tell the compiler to locate all local variables to stack? But what about the registers, accumulator, B and PSW?

- Should I alternatively force my variables to certain locations using the _at_ keyword and save/restore those locations manually to/from stack?

- Would it work if I declare my C functions as "virtual" ISRs? If so, how can I do?

- Do you have any other ideas? Please keep in mind, that the assembly code definitely cannot be changed! Everything has to be done on C side.

Thanks
Jonathan

0