esp-println prints to usb even when only uart feature is enabled
Bug description
To Reproduce
Create a new project for esp32s3(I don't know if other socs are affected). Add esp-println like this:
esp-println = { version = "0.16.1", default-features = false, features = [
"critical-section",
"esp32s3",
"uart",
] }
Write a program that prints something, upload it, connect via USB, open the monitor with espflash monitor.
The text get printed to usb, which should not happen as only the uart feature is enabled.
Expected behavior
No output coming from usb.
Environment
- Target device: esp32-s3
- Crate name and version: esp-hal 1.0.0
I looked into this and the thing is, we are calling ROM functions when using UART - on C3 and S3 those ROM functions choose to print to serial-jtag if it's connected so in this case the "uart" feature is effectively the same as "auto".
I tried to "convince" the ROM functions to not consider serial-jtag by setting the channel to UART0 explicitly but that doesn't really work as expected.
The only thing I can think of right now is to let esp-println directly access UART0 (like we do for S2 for other reasons, already) - but that is replicating what esp-hal is doing (in a naive way)
If you want me to try something out just tell me, I have access to an esp32s3 obviously.