I’ve got to acknowledge that a 2nd-level bootloader is feasible within the Arduino platform and in fact there are several 2nd-stage bootloaders (e.g. SFU, SDU, etc.) within ArduinoCore-samd. They work by storing the compiled bootloader in the first flash section following the bootloader.
My initial thinking that such a bootloader needs to be implemented within an Arduino core is therefore false (sorry @generationmake
) because the reservation of the required flash space (section sketch_boot) at the start of the application already exists (at least within ArduinoCore-samd). Therefore a stand-alone Arduino library implementing the kocherga bootloader outside the core should be possible, as the sketch_boot symbol is available to any Arduino application compiled with ArduinoCore-samd.
Edit: Its worth noting that this approach is very flash consuming as large parts of the Arduino framework are compiled in, even if they are not needed. Furthermore the 2nd stage bootloader needs to be aligned with flash erase size and therefore consumes at least 8k flash (or 16k, 24k, 32k, etc.).