Skip to content

Debug console #5619

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

Open
wants to merge 3 commits into
base: cepetr/usb-config
Choose a base branch
from
Open

Debug console #5619

wants to merge 3 commits into from

Conversation

cepetr
Copy link
Contributor

@cepetr cepetr commented Aug 22, 2025

This PR introduces a new dbg_console kernel module that introduces new logging layer that allows
printing debug output via ITM SWO, SEGGER SystemView, or USB VCP.

The new dbg_printf() can now be called anywhere in the codebase (including interrupt routines, when not using the VCP target).

The output target can be selected with the new DBG_CONSOLE argument from the command line when building the firmware. The same approach is used across all layers: coreapp, kernel, secmon, bootloader, boardloader, and prodtest.

make build_firmware DBG_CONSOLE=<xxx>

where <xxx> can be

  • SWO - logging via ITM SWO (requires ST-Link or J-Link)
  • SYSTEM_VIEW - logging via SEGGER SystemView (requires J-Link)
  • VCP - logging via USB VCP
  • empty - logging is disabled

For the firmware build:

  • if PYOPT=0, DBG_CONSOLE defaults to VCP
  • if PYOPT=1, DBG_CONSOLE defaults to an empty string (logging disabled)

DBG_CONSOLE be also used when building boardloader, bootloader and prodtest. For these targets, it defaults to an empty string (logging disabled).

The following table show valid combinations:

bootloader boardloader prodtest coreapp kernel secmon
SWO
SYSTEM_VIEW
VCP

Resolves #4253 - to enable Optiga logging, USE_OPTIGA_LOGGING must be defined.

NOTE: Optiga logging works only with SWO or SYSTEM_VIEW on T3W1 (since the Optiga driver is implemented in secmon on T3W1)

@cepetr cepetr force-pushed the cepetr/usb-config branch from 281c4c5 to bcf0287 Compare August 22, 2025 11:34
@cepetr cepetr self-assigned this Aug 22, 2025
@cepetr cepetr added this to Firmware Aug 22, 2025
@github-project-automation github-project-automation bot moved this to 🔎 Needs review in Firmware Aug 22, 2025
@cepetr cepetr changed the base branch from cepetr/usb-config to main August 22, 2025 11:36
@cepetr cepetr force-pushed the cepetr/dbg-console branch from 289b6d0 to c23983f Compare August 22, 2025 11:42
@cepetr cepetr changed the title Cepetr/dbg console Debug console Aug 22, 2025
Copy link

en main(all)

model device_test click_test persistence_test
T2T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3B1 test(all) main(all) test(all) main(all) test(all) main(all)
T3T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3W1 test(all) main(all) test(all) main(all) test(all) main(all)

Latest CI run: 17154342236

@cepetr cepetr changed the base branch from main to cepetr/usb-config August 22, 2025 12:12
@cepetr cepetr marked this pull request as ready for review August 22, 2025 12:13
@cepetr cepetr removed the request for review from obrusvit August 22, 2025 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🔎 Needs review
Development

Successfully merging this pull request may close these issues.

Kernel fails to build with PYOPT=0
1 participant