Thanks to various helpful threads, I've managed to share code between my app and bootloader with a jump table at a fixed location in the bootloader.
Now I'd like to share an ISR located in the bootloader with the app. Two questions:
1. I'm thinking the app can just read the ISR address from the bootloader's interrupt table and write that to its own. Any issues with that? I could also create small ISRs in each the bootloader and app that called a shared function, but that would force both ISRs to save and restore most registers.
2. The ISR in question is for handling certain USB events, and it uses a global variable to communicate with non-interrupt code. What is a good way to get a pointer into an ISR? I thought about stashing a pointer in GPIOR2 & GPIOR1, but I'll have to make sure those aren't used for anything else. I could also write the address to EEPROM as well (only when the pointer is different than what was previously stored). Any other ideas?
I did consider using a fixed section like I did for the jump table, but it would be more difficult to find a safe spot to stash it between the changing variable size (upon code changes) and somewhat variable stack size.