Allow Pico tools to use automated `BOOTSEL` mode after application exits
After main() exits with a return, the CPU of the pico is put into a hung state, (from the raspberry-pi-pico-c-sdk page 8, Introduction 1.1 section) which prevents triggering the device into BOOTSEL mode to copy a new application.
These changes introduce the cmake AVM_WAIT_BOOTSEL_ON_EXIT option; which, if enabled, will have the cpu spin (if AVM_REBOOT_ON_NOT_OK is not enabled) while a console monitoring application is still attached, allowing users to read the console output. If no console monitor is attached (or the attached monitor closes) the pico will be reset into a mode that will allow if to be put into BOOTSEL mode by the atomvm_rebar3_plugin pico_flash task (or other tools using automated BOOTSEL mode solutions), so a new application (or version) can be copied to the device.
closes #906 Closes atomvm/atomvm_rebar3_plugin#18
These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later