Macro unwrap to reduce call stack usage.

Moderator: Benj

Post Reply
IVL
Posts: 17
Joined: Sat Sep 17, 2011 7:10 pm
Location: Belgium
Has thanked: 8 times
Been thanked: 5 times
Contact:

Macro unwrap to reduce call stack usage.

Post by IVL »

Macro's are often used in 3 contexts
- to reuse a block of code more than once and maintain this code in 1 place only
- a block of code called by an interupt. This is just a special case of the above
- help structuring your code regardless of the fact you are calling this macro only once. Personally i often (re)use a macro INIT which is called only once.

My question is mainly related to the 3th case.

It would be nice to have an option somewhere to tell FC to unwrap macros prior to start compilation.
This would make sence to minimize the call stack as a lot of pics can handle only 8... and some components already use more than 1 level on their own.
I know there is some software call stack you can use to increase the max stack size above 8, but it remains a waiste of scare pic resources not to unwrap single used macros.
One could consider to only unwrap single used macros, but even for simple macros used 2 or 3 times, it could be a way to balance between code size and call stack.
Now you have to do this manually.

The unwrap option could be a macro property and/or a project option. On project level one could foresee 3 options
- no unwrap (default)
- unwrap single used macros only
- unwrap all macros


I'm curious to see if other users find this usefull.
Regards,
Ivan

Post Reply