I'm working on a custom bootloader, to sit ontop of the DFU bootloader, and I'm trying to figure out the "proper" way to start my program in two scenarios.
1) My bootloader is triggered by the presence of a specific file. If the file exists, the bootloader will run, otherwise it should jump to the user application at some higher point in flash.
2) If the file exists, after programming and verifying the flash, I'd like my bootloader to jump immediately to the user application.
I know how to reset to the DFU bootloader, that's easy to use the WDT to just reset to the beginning of flash. What I'm struggling with is jumping to an address other than the beginning of the flash. Looking at the DFU bootloader (1.0.3) it looks like there's a boot.S assembly file that handles this, I was hoping to stick to C (easier for me to understand what's happening), but if that's not possible I'll just reuse the boot.S/h files from the DFU bootloader.