Making some progress in identifying it. So far I’ve been able to tell that the SOS is caused by a NULL pointer reference. There’s a function pointer (cb) kept in the u8g2 struct that gets overwritten by ClearDisplay() causing it to be set to NULL. Still digging further.
I’m kind of stumped at this point. Sometimes cb ends up null after ClearDisplay() does a memset operation. Sometimes it does not. Even when it does not, when u8g2->cb->update_dimension() is called, it causes the SOS. I thought at first this was a simple memory overrun, but it’s bigger than that.
This code is extremely confusing to me. Functions are abstracted out two or three levels, making it nearly impossible to follow, even in the debugger. For instance, I don’t actually know where the code for u8g2->cb->update_dimension() resides or what it does due to all the typedefs, conditional compilation, and apparently some machine generated code.
I’ve lost two days on it. Time to put it aside for now and look for a simpler library. I might pick this back up in the future. Heck, I’d be willing to send the author a free Argon if he’d be willing to fix it.
@picsil They might do it if you send them one. I seem to remember extending that same offer and then communication fell off. Maybe they have more time now to take a look. I seem to remember that they were traveling before or something like that. Thanks for keeping us up to date!