Q: How much stack can my asm code use in a random C function? Are there ways to reserve stack space?
My code is written in C with some embedded assembly. I need to determine the frequency of an external clock relative to the MCU frequency.
I'm barely able to do this in asm today. But the problem is that the external clock is too fast for me to also increase and check a counter. The MCU's counter resources are spent. If the external clock stops, so does my program. I'd prefer not to use the watchdog for this at the moment since it has some other tasks.
Instead I wish to push PINB to the stack a finite number of time in fast "online" asm code, and then pop it "offline" to determine the frequency.
I wonder how much stack space I can use for something like this.