Open dzarda opened 3 years ago
It's up to you. It's also possible to add two weak empty functions like void user_init(void)
before the main loop and void user_task(state or somewhat_to_track_progress)
inside the main loop to generalize this feature.
I think it's a good idea to add void user_exit(void)
before a system reset.
Yeah the weak definitions are probably the way to go.
Do we want user_init before OR after dfu_init?
I think it doesn't matter.
I'm back at this thing again. I need to be able to perform custom user_verify() on each start (same stage as validate_checksum). Would you consider having DATA/BSS sections initialized before it? user_verify() would need access to that data.
Or more likely move the initialization directly after clock setup.
I can change it locally but I would want to opensource that feature if you're ok with it.
What is the "correct" procedure for injecting user code into the bootloader? For example I want to display some content on the display while the device is in DFU.
One solution might be adding user_init and user_poll to the existing main:
Another solution might be to allow disabling the default main (and then calling dfu/usbd from user source: