Make rp2040 wait for usb serial timeout configurable
Adds Pico cmake configuration option AVM_USB_WAIT_SECONDS to set a timeout to wait for USB serial connection before starting the application.
This will allow for release builds that will wait for a console connection, but eventually timeout and run the aplication. This allows testing blinky and network applications without requiring opening a console connection to the device, while still waiting a reasonable ammount of time for the user to make a console connection to the serial to see the output of applications like hello_world.
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
Absolutely. I plan on going back adding this and information about the settings in #1029 at the same time, after current changes to the docs (#1045) are merged. The settings from #1029 are somewhat related - at least in getting pico tooling in the atomvm_rebar3_plugin working nicely.
In speaking with @pguyot, I think we will want to use a reasonable timeout with this setting for release builds. Which will also need explanation in the getting started guide.
Personally I think anywhere between 30-60 seconds is reasonable. If you already have a terminal open after flashing an application, 30 seconds is ample time to connect using minicom or screen. However, 60 seconds might feel like an eternity waiting for a network application to start, if the console is not connected.
Default has been set to 20 seconds. If AVM_WAIT_FOR_USB_CONNECT is on, that will take precedence over the timeout value and wait indefinitely, or the timeout can be changed when configuring the build.