I've been poking around the a570is firmware gdb disasembly, ARM assembler manual, chdk sources, the wiki and the forums to learn how to find and add Canon's functions to CHDK. My main target was to check if the firmware strings SSAPI::EnterToCompensationEVF and SSAPI::ExitFromCompensationEVF are functions and if they do what I wished them to do, add them to uBasic and use them in my MD script devel version to get rid of some ugly and unreliable keystrokes.
There seems to be some demand for documentation in this part, so I think I'll write down the steps it takes to the wiki some day soon. So far it's been a success, at least the Enter function did exactly what I want it when I replaced the uBasic shut_down command with it.
But to better understand what I did, I have one question: I added
extern void _EnterToCompensationEVF(void);
And that makes a function call EnterToCompensationEVF(); magically work from CHDK.
The question: What exactly is the deal with the underscore (_) i.e. what mechanism in the compiler tools takes the stub and links it with that lolevel.h prototype?
And another question: how come there are lsl instructions in some functions when they're running in arm mode? Or can arm mode use thumb mode instructions as well?