1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-03-14 07:06:05 +00:00

build(core): allow increasing VCP write timeout

It should allow us exporting larger amounts of debug data.

[no changelog]
This commit is contained in:
Roman Zeyde 2025-03-10 11:17:58 +02:00 committed by Roman Zeyde
parent 21ad24fc31
commit c95158751a
3 changed files with 11 additions and 3 deletions

View File

@ -48,6 +48,10 @@ STORAGE_INSECURE_TESTING_MODE ?= 0
RUST_PRINT_TYPES_SIZES ?= 0
UI_DEBUG_OVERLAY ?= 0
# If set, VCP writes will be blocking, in order to allow reliable debug data transmission over VCP.
# Disabled by default, to prevent debug firmware from getting stuck while writing log messages (if the host is not reading them).
BLOCK_ON_VCP ?= 0
# OpenOCD interface default. Alternative: ftdi/olimex-arm-usb-tiny-h
OPENOCD_INTERFACE ?= stlink
# OpenOCD transport default. Alternative: jtag
@ -135,7 +139,8 @@ SCONS_VARS = \
TREZOR_EMULATOR_DEBUGGABLE=$(TREZOR_EMULATOR_DEBUGGABLE) \
TREZOR_MEMPERF="$(TREZOR_MEMPERF)" \
TREZOR_MODEL="$(TREZOR_MODEL)" \
UI_DEBUG_OVERLAY="$(UI_DEBUG_OVERLAY)"
UI_DEBUG_OVERLAY="$(UI_DEBUG_OVERLAY)" \
BLOCK_ON_VCP="$(BLOCK_ON_VCP)"
SCONS_OPTS = -Q -j $(JOBS)
ifeq ($(QUIET_MODE),1)

View File

@ -21,6 +21,7 @@ THP = ARGUMENTS.get('THP', '0') == '1' # Trezor-Host Protocol
BENCHMARK = ARGUMENTS.get('BENCHMARK', '0') == '1'
LOG_STACK_USAGE = ARGUMENTS.get('LOG_STACK_USAGE', '0') == '1'
DISABLE_ANIMATION = ARGUMENTS.get('TREZOR_DISABLE_ANIMATION', '0') == '1'
BLOCK_ON_VCP = ARGUMENTS.get('BLOCK_ON_VCP', '0') == '1'
UI_DEBUG_OVERLAY = ARGUMENTS.get('UI_DEBUG_OVERLAY', '0') == '1'
STORAGE_INSECURE_TESTING_MODE = ARGUMENTS.get('STORAGE_INSECURE_TESTING_MODE', '0') == '1'
@ -88,6 +89,7 @@ CPPDEFINES_MOD += [
('USE_EOS', '1' if (EVERYTHING and TREZOR_MODEL == "T2T1") else '0'),
('DISABLE_ANIMATION', '1' if DISABLE_ANIMATION else '0'),
('LOG_STACK_USAGE', '1' if LOG_STACK_USAGE else '0'),
('BLOCK_ON_VCP', '1' if BLOCK_ON_VCP else '0')
]
SOURCE_MOD += [
'embed/upymod/trezorobj.c',

View File

@ -36,9 +36,10 @@ int mp_hal_stdin_rx_chr(void) {
void mp_hal_stdout_tx_strn(const char *str, size_t len) {
if (vcp_iface_num >= 0) {
// The write timeout is set to 0, because otherwise when the VCP receive
// The write timeout defaults to 0, because otherwise when the VCP receive
// buffer on the host gets full, the timeout will block device operation.
int r = usb_vcp_write_blocking(vcp_iface_num, (const uint8_t *)str, len, 0);
int r = usb_vcp_write_blocking(vcp_iface_num, (const uint8_t *)str, len,
BLOCK_ON_VCP ? 1000 : 0);
(void)r;
}
}