trezor-firmware
trezor-firmware copied to clipboard
Kernel fails to build with `PYOPT=0`
In the following code, printf is called when PYOPT is set to 0. But printf is not available in kernel context. And including <stdio.h> does not seem to be the way to go :woman_shrugging:
https://github.com/trezor/trezor-firmware/blob/matejcik/global-layout-only3/core/embed/kernel/main.c#L51-L69
This does not affect current builds because PYOPT is never 0 in kernel, but it blocks #4234 .
The printf statements are supposed to output to the USB VCP on real device (and to console in emulator, but that's irrelevant because emulator does not use optiga)
Yes, that seems to be a system problem. Currently, the kernel itself is not aware of usb_vcp, as it is now initialized by the unprivileged app via a syscall. We need to move the USB initialization to the kernel and make usb_vcp available to the kernel as well. The unprivileged app would then call the print syscall instead of directly accessing the usb_vcp interface.