1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-04-20 00:59:02 +00:00
Commit Graph

4455 Commits

Author SHA1 Message Date
Roman Zeyde
2d7b4b8a39 wip: log GC roots from regs & stack
 TREZOR_MODEL=T3T1 BITCOIN_ONLY=0 QUIET_MODE=1 PYOPT=0 make -C core build_unix_frozen
 core/emu.py -ea --profiling -o /tmp/trezor.log -c pytest -xv tests/device_tests/test_msg_applysettings.py::test_apply_homescreen_jpeg
======================================================================================= short test summary info ========================================================================================
FAILED tests/device_tests/test_msg_applysettings.py::test_apply_homescreen_jpeg - trezorlib.exceptions.TrezorFailure: FirmwareError:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================================================== 1 failed in 1.55s ===========================================================================================
Terminating emulator...
Emulator shut down after 0.064 seconds

 grep -B2 '>Layout' /tmp/trezor.log
alloc(424) = 0x71612f4723e0 flags: 0
alloc(176) = 0x71612f4725a0 flags: 1
>LayoutObj::new_root
--
alloc(424) = 0x71612f4711c0 flags: 0
alloc(176) = 0x71612f471380 flags: 1
>LayoutObj::new_root

 grep 0x71612f471380 /tmp/dump*
/tmp/dump-002.json:6930	6900	6	0x71612f471380	#7	<0x637d78>
/tmp/dump-002.json:7089	6900	6	0x71612f471380	#2	<0x637d78>
/tmp/dump-003.json:6930	6900	6	0x71612f471380	#7	<0x637d78>
/tmp/dump-003.json:7089	6900	6	0x71612f471380	#2	<0x637d78>
...

 python deps.py 6900 < /tmp/dump-002.json | colrm 200
6930     6900     6        0x71612f471380 #7       <0x637d78>
6769     6930     6        0x71612f471740 #3       <0x5e92>
3508     6769     1        0x71612f470320 #69      <0x71612f46ba60>
3040     3508     24       0x71612f456b80 #3       <0x6eba>
3036     3040     1        0x71612f453100 #1       dict {'T': 0, 'utime': 0x61d3e0, 'const': 0x61ef80, 'backlight_fade': 0x63b210, 'Shutdown': 0x71612f453920, 'refresh': 0x71612f453740, 'HEIGHT': 240
3437     3036     1        0x71612f453080 #1       module {'T': 0, 'utime': 0x61d3e0, 'const': 0x61ef80, 'backlight_fade': 0x63b210, 'Shutdown': 0x71612f453920, 'refresh': 0x71612f453740, 'HEIGHT': 2
3457     3437     2        0x71612f4562a0 #1       gen_wrap
3116     3457     15       0x71612f456520 #3       <0x7d6a>
3447     3116     1        0x71612f453a80 #14      dict {'_handle_usb_iface': 0x71612f4562a0, 'stop': 0x71612f456060, 'create_tasks': 0x71612f456220, '__del__': 0x71612f4563a0, '_handle_input_iface':
6156     3447     4        0x71612f4563e0 #13      type Layout
6187     6156     4        0x71612f46b680 #13      type HomescreenBase
6333     6187     4        0x71612f46ba60 #1       type Homescreen
6095     6333     12       0x71612f46cca0 #3       <0x7eaa>
6012     6095     1        0x71612f46aee0 #1       dict {'Homescreen': 0x71612f46ba60, 'busy_expiry_ms': 0x71612f457820, '__file__': 'apps/homescreen/__init__.py', '__name__': 'apps.homescreen', 'Mes
6285     6012     1        0x71612f46a480 #1       module {'Homescreen': 0x71612f46ba60, 'busy_expiry_ms': 0x71612f457820, '__file__': 'apps/homescreen/__init__.py', '__name__': 'apps.homescreen', 'M
2050     6285     2        0x71612f46c6a0 #5       gen_wrap
1948     2050     15       0x71612f44b540 #3       <0x7742>
1936     1948     1        0x71612f44a880 #1       dict {'IdleTimer': 0x71612f44b420, 'spawn': 0x71612f44ae20, 'default_constructor': 0x71612f46c6a0, 'ALLOW_WHILE_LOCKED': 0x71612f44ad40, '__name__':
2823     1936     1        0x71612f44a700 #33      module {'IdleTimer': 0x71612f44b420, 'spawn': 0x71612f44ae20, 'default_constructor': 0x71612f46c6a0, 'ALLOW_WHILE_LOCKED': 0x71612f44ad40, '__name__
1666     2823     15       0x71612f4515e0 #3       <0x84b2>
1663     1666     1        0x71612f448540 #1       dict {'UnexpectedMessageException': 0x71612f44d1c0, 'with_context': 0x71612f44d2c0, 'DataError': 0x71612f44f600, 'Message': 0x71612f44c0a0, '__name_
2802     1663     1        0x71612f4484e0 #1       module {'UnexpectedMessageException': 0x71612f44d1c0, 'with_context': 0x71612f44d2c0, 'DataError': 0x71612f44f600, 'Message': 0x71612f44c0a0, '__nam
2936     2802     2        0x71612f451340 #3       fun_bc
785      2936     19       0x71612f452400 #3       <0x85ca>
784      785      1        0x71612f441720 #1       dict {'UnexpectedMessage': 0x71612f44de80, 'failure': 0x71612f451340, 'PinInvalid': 0x71612f44ffa0, 'setup': 0x71612f4528e0, 'protobuf': 0x71612f445
2977     784      1        0x71612f441700 #1       module {'UnexpectedMessage': 0x71612f44de80, 'failure': 0x71612f451340, 'PinInvalid': 0x71612f44ffa0, 'setup': 0x71612f4528e0, 'protobuf': 0x71612f4
6450     2977     2        0x71612f452920 #2       gen_wrap
1644     6450     9        0x71612f46db40 #3       gen_instance
364      1644     15       0x71612f448280 #3       <0x23a>
293      364      1        0x71612f43e280 #1       dict {'close': 0x71612f442640, 'this_task': 0x71612f46db40, 'io': 0x61c830, 'schedule': 0x71612f442120, '__name__': 'trezor.loop', '_TIMEOUT_ERROR':
3906     293      1        0x71612f43d9a0 #7       module {'close': 0x71612f442640, 'this_task': 0x71612f46db40, 'io': 0x61c830, 'schedule': 0x71612f442120, '__name__': 'trezor.loop', '_TIMEOUT_ERROR
210      3906     5        0x71612f459d40 #3       <(nil)>
199      210      1        0x71612f43cf40 #1       dict {'log': 0x71612f43d8a0, '__name__': 'session', 'loop': 0x71612f43d9a0, 'utils': 0x71612f43d3a0, 'apps': 0x71612f44a380, 'workflow': 0x71612f44a
315      199      1        0x71612f43cde0 #1       module {'log': 0x71612f43d8a0, '__name__': 'session', 'loop': 0x71612f43d9a0, 'utils': 0x71612f43d3a0, 'apps': 0x71612f44a380, 'workflow': 0x71612f4
0        315      2        0x71612f43dc60 #552     fun_bc

 nm core/build/unix/trezor-emu-core | grep 637d78
0000000000637d78 d _ZN10trezor_lib2ui6layout3obj9LayoutObj8obj_type4TYPE17hb6ebd6797ed3a6e4E
# from objdump => `637d78 <trezor_lib::ui::layout::obj::LayoutObj::obj_type::TYPE>`
2025-04-03 12:00:53 +03:00
tychovrahe
101d584aa4 fix(core): fix BLE polling
[no changelog]
2025-04-01 21:53:30 +02:00
cepetr
7248bf2a48 fix(core): fix issue with frame buffer access on D001
[no changelog]
2025-04-01 10:00:26 +02:00
cepetr
cfea362cfc fix(core): skip polling in storage callback (workaround)
[no changelog]
2025-04-01 10:00:26 +02:00
cepetr
7dcdb54262 feat(core): introduce new polling in coreapp event loop
[no changelog]
2025-04-01 10:00:26 +02:00
cepetr
7994a0b93b feat(core): introduce kernel event loop
[no changelog]
2025-04-01 10:00:26 +02:00
cepetr
2dff869883 feat(core): add event polling to ble driver
[no changelog]
2025-04-01 10:00:26 +02:00
cepetr
edf3f19ef5 feat(core): add event polling to usb hid driver
[no changelog]
2025-04-01 10:00:26 +02:00
cepetr
97bb16776d feat(core): add event polling to usb vcp driver
[no changelog]
2025-04-01 10:00:26 +02:00
cepetr
f61da5777a feat(core): add event polling to usb webusb driver
[no changelog]
2025-04-01 10:00:26 +02:00
cepetr
cd97b8c55b feat(core): add event polling to usb driver
[no changelog]
2025-04-01 10:00:26 +02:00
cepetr
4815118a6d feat(core): add event polling to touch driver
[no changelog]
2025-04-01 10:00:26 +02:00
cepetr
8d7a25e5eb feat(core): add event polling to button driver
[no changelog]
2025-04-01 10:00:26 +02:00
cepetr
b9d15cb343 feat(core): introduce system-level event polling
[no changelog]
2025-04-01 10:00:26 +02:00
cepetr
6b045dd43d feat(core): introduce systask id & task count limit
[no changelog]
2025-04-01 10:00:26 +02:00
cepetr
24048d7094 fix(core): remove unused function declaration
[no changelog]
2025-04-01 10:00:26 +02:00
cepetr
271f029be7 fix(core): fix emulator build on macOS
[no changelog]
2025-04-01 10:00:26 +02:00
Roman Zeyde
ad73e41080 feat(core): support USB/BLE sessions
All interfaces are sharing a single 8kB buffer.
It is reallocated once per session and is acquired by the first active session.
Other concurrent sessions will respond with an "Another session in progress" error.

[no changelog]
2025-03-31 13:20:53 +03:00
Roman Zeyde
567de7e643 feat(core): increase MicroPython bytecode optimizations
[no changelog]
2025-03-28 19:46:24 +03:00
Roman Zeyde
cc416720f0 build(core): explicitly map PYOPT to MicroPython bytecode optimization level
[no changelog]
2025-03-28 19:46:24 +03:00
tychovrahe
9d46ad259c fix(core/prodtest): remove final wait from report commands
[no changelog]
2025-03-27 18:25:46 +01:00
tychovrahe
aa682bcc6e fix(core): generate coin support for discovery kits
[no changelog]
2025-03-27 15:46:46 +01:00
tychovrahe
b7b8e77ccb feat(core): enable tropic in firmware/kernel on hw
[no changelog]
2025-03-27 11:59:10 +01:00
Roman Zeyde
aecaf306f3 fix(core): don't handle nostr-related messages in BTC-only firmware
[no changelog]
2025-03-27 12:30:02 +02:00
Roman Zeyde
63a17ea0f9 chore(core): exclude all_modules.py bytecode from frozen_mpy.c
See `all_modules.py.mako` for more details.

[no changelog]
2025-03-27 10:22:44 +02:00
Roman Zeyde
ac0fc30ee9 perf(core): intern single-digit strings
[no changelog]
2025-03-26 21:16:06 +02:00
Roman Zeyde
bafad6e453 chore(core): remove unused function from modtrezorutils-meminfo.h
[no changelog]
2025-03-26 21:16:06 +02:00
Roman Zeyde
48b2f07ad3 fix(core): correct dump_qstr_pool()
[no changelog]
2025-03-26 21:16:06 +02:00
tychovrahe
4fce1f55ee fix(core): fix bootloader build for models with HW keys but without optiga
[no changelog]
2025-03-26 14:59:19 +01:00
Roman Zeyde
3a24945de9 fix(core): allow firmware upgrade even if language change failed 2025-03-26 13:12:38 +02:00
Ioan Bizău
b1cd4cb469 chore(core/build): don't build with Tropic by default
[no changelog]

Co-authored-by: Martin Milata <martin@martinmilata.cz>
2025-03-26 10:32:31 +01:00
obrusvit
419737db7c chore(core): remove obsolete font names from blobs
[no changelog]
2025-03-25 18:26:15 +01:00
Roman Zeyde
8b4936926c fix(core): preallocate storage.debug.reset_internal_entropy
It should allow GC to cleanup `int_entropy`, which can be
allocated in random heap position, causing fragmentation.

[no changelog]
2025-03-25 12:05:52 +02:00
Roman Zeyde
f942d13748 fix(core): alloc GC to free _previous_remaining in trezor.pin
[no changelog]
2025-03-25 12:05:52 +02:00
Roman Zeyde
19f576123c feat(core): enable GC map dump on debug firmware
[no changelog]
2025-03-25 12:05:52 +02:00
tychovrahe
3bccf2d8f7 fix(core): fix emulator usb polling
[no changelog]
2025-03-24 14:31:14 +01:00
tychovrahe
4d48fbf845 fix(core): fix emulator usb deinitialization
[no changelog]
2025-03-24 14:31:14 +01:00
tychovrahe
8e0e3a1787 refactor(core): complete bootloader refactoring 2025-03-24 14:31:14 +01:00
obrusvit
9a14654ff7 perf(core): improve render in Delizia button
- allcase_text_height unnecessarily loads GlyphData in this frequent
call, text_height just reads a constant

[no changelog]
2025-03-24 12:11:56 +01:00
obrusvit
079873ced7 feat(core): use newer version of Delizia fonts 2025-03-24 12:11:56 +01:00
cepetr
5b9caf1ac6 fix(core): enable shsi clock after resuming from suspend mode
[no changelog]
2025-03-24 10:38:53 +01:00
tychovrahe
283561c073 fix(core: fix homescreen ble checker task
[no changelog]
2025-03-23 17:04:05 +01:00
Roman Zeyde
1e3b02771b fix(core): don't use 'static lifetime for BLEEvent
[no changelog]
2025-03-21 17:13:27 +02:00
matejcik
acc584ce25 fix(core/rust): fix quotes in bindgen macros for T2B1 2025-03-21 12:16:23 +01:00
Roman Zeyde
52f5593f28 feat(core): add BLE checker task to Homescreen
[no changelog]
2025-03-20 15:22:32 +02:00
Roman Zeyde
4c2c6f13e7 fix(core): add BLE feature flag to MicroPython build sed scripts
[no changelog]
2025-03-20 15:22:32 +02:00
Roman Zeyde
9926df6ab5 fix(core): add LayoutObj.ble_event mock
[no changelog]
2025-03-20 15:22:32 +02:00
Roman Zeyde
fabb5e8c6c perf(core): don't allocate if BLE event data is empty
BLE event data is not empty only on pairing:
```
core/embed/io/ble/stm32/ble.c
176:      ble_event_t event = {.type = BLE_CONNECTED};
182:      ble_event_t event = {.type = BLE_DISCONNECTED};
227:  ble_event_t event = {.type = BLE_PAIRING_REQUEST, .data_len = 6};
244:  ble_event_t event = {.type = BLE_PAIRING_CANCELLED, .data_len = 0};
```

[no changelog]
2025-03-20 15:22:32 +02:00
tychovrahe
cf00130409 feat(core): add support T3W1 rev C board
[no changelog]
2025-03-20 11:07:49 +01:00
tychovrahe
6fb65bcfd9 refactor(core): refactor button events
[no changelog]
2025-03-20 11:07:34 +01:00