Debug Console
The debug console is currently conceptually composed of the debug output and of the ability for the target to close it (when supported).
The debug console is enabled by default and the corresponding laze module is debug-console.
Printing on the Debug Console
The ariel_os::log::println!() macro is used to print on the debug console.
When the debug console is enabled, panic messages are automatically printed to it.
If this is unwanted, the panic-printing laze module can be disabled.
Closing the Debug Console from Firmware
When using semihosting, it is possible for the target to request the debug console to exit, and to return an exit code indicating success or failure.
In Ariel OS, the ariel_os::debug::exit() function can be used for this.
When using a host tool that supports semihosting, this will cause the tool to exit, with the exit code given to exit() on the target being passed to the host.
The laze configuration automatically enables semihosting on the target when the host tool used for flashing supports semihosting (e.g., probe-rs).
When the flashing tool does not, support for semihosting can still be enabled in the firmware by selecting the semihosting laze module.
This is needed to later be able to attach a semihosting-enabled host tool to the target.
Note
When semihosting is enabled on the target and no host tool supporting semihosting (or a debugger) is connected, calling
ariel_os::debug::exit()may result in a panic. For example on ESP usingespflashyou would get:[ERROR] panicked at 'Unhandled interrupt on ProCpu' (esp_hal src/interrupt/mod.rs:90)