Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel fails to build with PYOPT=0 #4253

Open
matejcik opened this issue Oct 10, 2024 · 1 comment
Open

Kernel fails to build with PYOPT=0 #4253

matejcik opened this issue Oct 10, 2024 · 1 comment
Assignees
Labels
code Code improvements

Comments

@matejcik
Copy link
Contributor

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 🤷‍♀️
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)

@cepetr
Copy link
Contributor

cepetr commented Oct 10, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Code improvements
Projects
Status: No status
Development

No branches or pull requests

2 participants