Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions core/SConscript.firmware
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,14 @@ if PRODUCTION_MODEL == 'H':
'embed/firmware/mphalport.c',
'embed/firmware/nlrthumb.c',
'embed/firmware/startup.S',
]

SOURCE_CM_BACKTRACE = [
'embed/cm_backtrace/cm_backtrace.c',
'embed/cm_backtrace/cmb_user_cfg.c',
'embed/cm_backtrace/fault_handler/gcc/cmb_fault.S'
]

SOURCE_TREZORHAL = [
'embed/trezorhal/system_stm32h7xx.c',
'embed/trezorhal/adc.c',
Expand Down Expand Up @@ -697,6 +703,7 @@ if PRODUCTION_MODEL == 'H':
'.',
'embed/rust',
'embed/firmware',
'embed/cm_backtrace',
'embed/trezorhal',
'embed/trezorhal/fatfs',
'embed/trezorhal/fp',
Expand Down Expand Up @@ -1084,6 +1091,8 @@ obj_program.extend(env.Object(source=SOURCE_MICROPYTHON_SPEED, COPT='-O3'))
obj_program.extend(env.Object(source=SOURCE_STMHAL))
obj_program.extend(env.Object(source=SOURCE_LVGL))
obj_program.extend(env.Object(source=SOURCE_TREZORHAL))
obj_program.extend(env.Object(source=SOURCE_CM_BACKTRACE))

if FROZEN:
obj_program.extend(env.Object(source=source_mpyc))

Expand Down
8 changes: 8 additions & 0 deletions core/embed/cm_backtrace/Languages/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# CmBacktrace: ARM Cortex-M 绯诲垪 MCU 閿欒杩借釜搴�

## 澶氳瑷�鏀寔

| Language | Location (or type) | Language tag |
|----------------------|----------------------------|--------------|
| English | United States | en-US |
| Chinese (Simplified) | People's Republic of China | zh-CN |
101 changes: 101 additions & 0 deletions core/embed/cm_backtrace/Languages/en-US/cmb_en_US.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
* This file is part of the CmBacktrace Library.
*
* Copyright (c) 2020, Armink, <armink.ztl@gmail.com>
* Chenxuan, <chenxuan.zhao@icloud.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* 'Software'), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* NOTE: DO NOT include this file on the header file.
* Encoding: UTF-8
* Created on: 2020-09-06
*/

[PRINT_MAIN_STACK_CFG_ERROR] =
"ERROR: Unable to get the main stack information, please check the "
"configuration of the main stack",
[PRINT_FIRMWARE_INFO] =
"Firmware name: %s, hardware version: %s, software version: %s",
[PRINT_ASSERT_ON_THREAD] = "Assert on thread %s",
[PRINT_ASSERT_ON_HANDLER] =
"Assert on interrupt or bare metal(no OS) environment",
[PRINT_THREAD_STACK_INFO] = "===== Thread stack information =====",
[PRINT_MAIN_STACK_INFO] = "====== Main stack information ======",
[PRINT_THREAD_STACK_OVERFLOW] = "Error: Thread stack(%08x) was overflow",
[PRINT_MAIN_STACK_OVERFLOW] = "Error: Main stack(%08x) was overflow",
[PRINT_CALL_STACK_INFO] =
"Show more call stack info by run: addr2line -e %s%s -afpiC %.*s",
[PRINT_CALL_STACK_ERR] = "Dump call stack has an error",
[PRINT_FAULT_ON_THREAD] = "Fault on thread %s",
[PRINT_FAULT_ON_HANDLER] =
"Fault on interrupt or bare metal(no OS) environment",
[PRINT_REGS_TITLE] =
"=================== Registers information ====================",
[PRINT_HFSR_VECTBL] = "Hard fault is caused by failed vector fetch",
[PRINT_MFSR_IACCVIOL] =
"Memory management fault is caused by instruction access violation",
[PRINT_MFSR_DACCVIOL] =
"Memory management fault is caused by data access violation",
[PRINT_MFSR_MUNSTKERR] =
"Memory management fault is caused by unstacking error",
[PRINT_MFSR_MSTKERR] =
"Memory management fault is caused by stacking error",
[PRINT_MFSR_MLSPERR] =
"Memory management fault is caused by floating-point lazy state "
"preservation",
[PRINT_BFSR_IBUSERR] =
"Bus fault is caused by instruction access violation",
[PRINT_BFSR_PRECISERR] =
"Bus fault is caused by precise data access violation",
[PRINT_BFSR_IMPREISERR] =
"Bus fault is caused by imprecise data access violation",
[PRINT_BFSR_UNSTKERR] = "Bus fault is caused by unstacking error",
[PRINT_BFSR_STKERR] = "Bus fault is caused by stacking error",
[PRINT_BFSR_LSPERR] =
"Bus fault is caused by floating-point lazy state preservation",
[PRINT_UFSR_UNDEFINSTR] =
"Usage fault is caused by attempts to execute an undefined instruction",
[PRINT_UFSR_INVSTATE] =
"Usage fault is caused by attempts to switch to an invalid state "
"(e.g., ARM)",
[PRINT_UFSR_INVPC] =
"Usage fault is caused by attempts to do an exception with a bad value "
"in the EXC_RETURN number",
[PRINT_UFSR_NOCP] =
"Usage fault is caused by attempts to execute a coprocessor "
"instruction",
#if (CMB_CPU_PLATFORM_TYPE == CMB_CPU_ARM_CORTEX_M33)
[PRINT_UFSR_STKOF] =
"Usage fault is caused by indicates that a stack overflow (hardware "
"check) has taken place",
#endif
[PRINT_UFSR_UNALIGNED] =
"Usage fault is caused by indicates that an unaligned access fault has "
"taken place",
[PRINT_UFSR_DIVBYZERO0] =
"Usage fault is caused by Indicates a divide by zero has taken place "
"(can be set only if DIV_0_TRP is set)",
[PRINT_DFSR_HALTED] = "Debug fault is caused by halt requested in NVIC",
[PRINT_DFSR_BKPT] = "Debug fault is caused by BKPT instruction executed",
[PRINT_DFSR_DWTTRAP] = "Debug fault is caused by DWT match occurred",
[PRINT_DFSR_VCATCH] = "Debug fault is caused by Vector fetch occurred",
[PRINT_DFSR_EXTERNAL] = "Debug fault is caused by EDBGRQ signal asserted",
[PRINT_MMAR] = "The memory management fault occurred address is %08x",
[PRINT_BFAR] = "The bus fault occurred address is %08x",
78 changes: 78 additions & 0 deletions core/embed/cm_backtrace/Languages/zh-CN/cmb_zh_CN.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* This file is part of the CmBacktrace Library.
*
* Copyright (c) 2020, Armink, <armink.ztl@gmail.com>
* Chenxuan, <chenxuan.zhao@icloud.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* 'Software'), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* NOTE: DO NOT include this file on the header file.
* Encoding: GB18030
* Created on: 2020-09-06
*/

[PRINT_MAIN_STACK_CFG_ERROR] = "错误:无法获取主栈信息,请检查主栈的相关配置",
[PRINT_FIRMWARE_INFO] = "固件名称:%s,硬件版本号:%s,软件版本号:%s",
[PRINT_ASSERT_ON_THREAD] = "在线程(%s)中发生断言",
[PRINT_ASSERT_ON_HANDLER] = "在中断或裸机环境下发生断言",
[PRINT_THREAD_STACK_INFO] = "=========== 线程堆栈信息 ===========",
[PRINT_MAIN_STACK_INFO] = "============ 主堆栈信息 ============",
[PRINT_THREAD_STACK_OVERFLOW] = "错误:线程栈(%08x)发生溢出",
[PRINT_MAIN_STACK_OVERFLOW] = "错误:主栈(%08x)发生溢出",
[PRINT_CALL_STACK_INFO] =
"查看更多函数调用栈信息,请运行:addr2line -e %s%s -afpiC %.*s",
[PRINT_CALL_STACK_ERR] = "获取函数调用栈失败",
[PRINT_FAULT_ON_THREAD] = "在线程(%s)中发生错误异常",
[PRINT_FAULT_ON_HANDLER] = "在中断或裸机环境下发生错误异常",
[PRINT_REGS_TITLE] =
"========================= 寄存器信息 =========================",
[PRINT_HFSR_VECTBL] = "发生硬错误,原因:取中断向量时出错",
[PRINT_MFSR_IACCVIOL] =
"发生存储器管理错误,原因:企图从不允许访问的区域取指令",
[PRINT_MFSR_DACCVIOL] =
"发生存储器管理错误,原因:企图从不允许访问的区域读、写数据",
[PRINT_MFSR_MUNSTKERR] =
"发生存储器管理错误,原因:出栈时企图访问不被允许的区域",
[PRINT_MFSR_MSTKERR] =
"发生存储器管理错误,原因:入栈时企图访问不被允许的区域",
[PRINT_MFSR_MLSPERR] =
"发生存储器管理错误,原因:惰性保存浮点状态时发生错误",
[PRINT_BFSR_IBUSERR] = "发生总线错误,原因:指令总线错误",
[PRINT_BFSR_PRECISERR] = "发生总线错误,原因:精确的数据总线错误",
[PRINT_BFSR_IMPREISERR] = "发生总线错误,原因:不精确的数据总线错误",
[PRINT_BFSR_UNSTKERR] = "发生总线错误,原因:出栈时发生错误",
[PRINT_BFSR_STKERR] = "发生总线错误,原因:入栈时发生错误",
[PRINT_BFSR_LSPERR] = "发生总线错误,原因:惰性保存浮点状态时发生错误",
[PRINT_UFSR_UNDEFINSTR] = "发生用法错误,原因:企图执行未定义指令",
[PRINT_UFSR_INVSTATE] = "发生用法错误,原因:试图切换到 ARM 状态",
[PRINT_UFSR_INVPC] = "发生用法错误,原因:无效的异常返回码",
[PRINT_UFSR_NOCP] = "发生用法错误,原因:企图执行协处理器指令",
#if (CMB_CPU_PLATFORM_TYPE == CMB_CPU_ARM_CORTEX_M33)
[PRINT_UFSR_STKOF] = "发生用法错误,原因:硬件检测到栈溢出",
#endif
[PRINT_UFSR_UNALIGNED] = "发生用法错误,原因:企图执行非对齐访问",
[PRINT_UFSR_DIVBYZERO0] = "发生用法错误,原因:企图执行除 0 操作",
[PRINT_DFSR_HALTED] = "发生调试错误,原因:NVIC 停机请求",
[PRINT_DFSR_BKPT] = "发生调试错误,原因:执行 BKPT 指令",
[PRINT_DFSR_DWTTRAP] = "发生调试错误,原因:数据监测点匹配",
[PRINT_DFSR_VCATCH] = "发生调试错误,原因:发生向量捕获",
[PRINT_DFSR_EXTERNAL] = "发生调试错误,原因:外部调试请求",
[PRINT_MMAR] = "发生存储器管理错误的地址:%08x",
[PRINT_BFAR] = "发生总线错误的地址:%08x",
78 changes: 78 additions & 0 deletions core/embed/cm_backtrace/Languages/zh-CN/cmb_zh_CN_UTF8.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* This file is part of the CmBacktrace Library.
*
* Copyright (c) 2020, Armink, <armink.ztl@gmail.com>
* Chenxuan, <chenxuan.zhao@icloud.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* 'Software'), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* NOTE: DO NOT include this file on the header file.
* Encoding: UTF-8
* Created on: 2020-09-06
*/

[PRINT_MAIN_STACK_CFG_ERROR] = "閿欒锛氭棤娉曡幏鍙栦富鏍堜俊鎭紝璇锋鏌ヤ富鏍堢殑鐩稿叧閰嶇疆",
[PRINT_FIRMWARE_INFO] = "鍥轰欢鍚嶇О锛�%s锛岀‖浠剁増鏈彿锛�%s锛岃蒋浠剁増鏈彿锛�%s",
[PRINT_ASSERT_ON_THREAD] = "鍦ㄧ嚎绋�(%s)涓彂鐢熸柇瑷�",
[PRINT_ASSERT_ON_HANDLER] = "鍦ㄤ腑鏂垨瑁告満鐜涓嬪彂鐢熸柇瑷�",
[PRINT_THREAD_STACK_INFO] = "=========== 绾跨▼鍫嗘爤淇℃伅 ===========",
[PRINT_MAIN_STACK_INFO] = "============ 涓诲爢鏍堜俊鎭� ============",
[PRINT_THREAD_STACK_OVERFLOW] = "閿欒锛氱嚎绋嬫爤(%08x)鍙戠敓婧㈠嚭",
[PRINT_MAIN_STACK_OVERFLOW] = "閿欒锛氫富鏍�(%08x)鍙戠敓婧㈠嚭",
[PRINT_CALL_STACK_INFO] =
"鏌ョ湅鏇村鍑芥暟璋冪敤鏍堜俊鎭紝璇疯繍琛岋細addr2line -e %s%s -afpiC %.*s",
[PRINT_CALL_STACK_ERR] = "鑾峰彇鍑芥暟璋冪敤鏍堝け璐�",
[PRINT_FAULT_ON_THREAD] = "鍦ㄧ嚎绋�(%s)涓彂鐢熼敊璇紓甯�",
[PRINT_FAULT_ON_HANDLER] = "鍦ㄤ腑鏂垨瑁告満鐜涓嬪彂鐢熼敊璇紓甯�",
[PRINT_REGS_TITLE] =
"========================= 瀵勫瓨鍣ㄤ俊鎭� =========================",
[PRINT_HFSR_VECTBL] = "鍙戠敓纭敊璇紝鍘熷洜锛氬彇涓柇鍚戦噺鏃跺嚭閿�",
[PRINT_MFSR_IACCVIOL] =
"鍙戠敓瀛樺偍鍣ㄧ鐞嗛敊璇紝鍘熷洜锛氫紒鍥句粠涓嶅厑璁歌闂殑鍖哄煙鍙栨寚浠�",
[PRINT_MFSR_DACCVIOL] =
"鍙戠敓瀛樺偍鍣ㄧ鐞嗛敊璇紝鍘熷洜锛氫紒鍥句粠涓嶅厑璁歌闂殑鍖哄煙璇汇�佸啓鏁版嵁",
[PRINT_MFSR_MUNSTKERR] =
"鍙戠敓瀛樺偍鍣ㄧ鐞嗛敊璇紝鍘熷洜锛氬嚭鏍堟椂浼佸浘璁块棶涓嶈鍏佽鐨勫尯鍩�",
[PRINT_MFSR_MSTKERR] =
"鍙戠敓瀛樺偍鍣ㄧ鐞嗛敊璇紝鍘熷洜锛氬叆鏍堟椂浼佸浘璁块棶涓嶈鍏佽鐨勫尯鍩�",
[PRINT_MFSR_MLSPERR] =
"鍙戠敓瀛樺偍鍣ㄧ鐞嗛敊璇紝鍘熷洜锛氭儼鎬т繚瀛樻诞鐐圭姸鎬佹椂鍙戠敓閿欒",
[PRINT_BFSR_IBUSERR] = "鍙戠敓鎬荤嚎閿欒锛屽師鍥狅細鎸囦护鎬荤嚎閿欒",
[PRINT_BFSR_PRECISERR] = "鍙戠敓鎬荤嚎閿欒锛屽師鍥狅細绮剧‘鐨勬暟鎹�荤嚎閿欒",
[PRINT_BFSR_IMPREISERR] = "鍙戠敓鎬荤嚎閿欒锛屽師鍥狅細涓嶇簿纭殑鏁版嵁鎬荤嚎閿欒",
[PRINT_BFSR_UNSTKERR] = "鍙戠敓鎬荤嚎閿欒锛屽師鍥狅細鍑烘爤鏃跺彂鐢熼敊璇�",
[PRINT_BFSR_STKERR] = "鍙戠敓鎬荤嚎閿欒锛屽師鍥狅細鍏ユ爤鏃跺彂鐢熼敊璇�",
[PRINT_BFSR_LSPERR] = "鍙戠敓鎬荤嚎閿欒锛屽師鍥狅細鎯版�т繚瀛樻诞鐐圭姸鎬佹椂鍙戠敓閿欒",
[PRINT_UFSR_UNDEFINSTR] = "鍙戠敓鐢ㄦ硶閿欒锛屽師鍥狅細浼佸浘鎵ц鏈畾涔夋寚浠�",
[PRINT_UFSR_INVSTATE] = "鍙戠敓鐢ㄦ硶閿欒锛屽師鍥狅細璇曞浘鍒囨崲鍒� ARM 鐘舵��",
[PRINT_UFSR_INVPC] = "鍙戠敓鐢ㄦ硶閿欒锛屽師鍥狅細鏃犳晥鐨勫紓甯歌繑鍥炵爜",
[PRINT_UFSR_NOCP] = "鍙戠敓鐢ㄦ硶閿欒锛屽師鍥狅細浼佸浘鎵ц鍗忓鐞嗗櫒鎸囦护",
#if (CMB_CPU_PLATFORM_TYPE == CMB_CPU_ARM_CORTEX_M33)
[PRINT_UFSR_STKOF] = "鍙戠敓鐢ㄦ硶閿欒锛屽師鍥狅細纭欢妫�娴嬪埌鏍堟孩鍑�",
#endif
[PRINT_UFSR_UNALIGNED] = "鍙戠敓鐢ㄦ硶閿欒锛屽師鍥狅細浼佸浘鎵ц闈炲榻愯闂�",
[PRINT_UFSR_DIVBYZERO0] = "鍙戠敓鐢ㄦ硶閿欒锛屽師鍥狅細浼佸浘鎵ц闄� 0 鎿嶄綔",
[PRINT_DFSR_HALTED] = "鍙戠敓璋冭瘯閿欒锛屽師鍥狅細NVIC 鍋滄満璇锋眰",
[PRINT_DFSR_BKPT] = "鍙戠敓璋冭瘯閿欒锛屽師鍥狅細鎵ц BKPT 鎸囦护",
[PRINT_DFSR_DWTTRAP] = "鍙戠敓璋冭瘯閿欒锛屽師鍥狅細鏁版嵁鐩戞祴鐐瑰尮閰�",
[PRINT_DFSR_VCATCH] = "鍙戠敓璋冭瘯閿欒锛屽師鍥狅細鍙戠敓鍚戦噺鎹曡幏",
[PRINT_DFSR_EXTERNAL] = "鍙戠敓璋冭瘯閿欒锛屽師鍥狅細澶栭儴璋冭瘯璇锋眰",
[PRINT_MMAR] = "鍙戠敓瀛樺偍鍣ㄧ鐞嗛敊璇殑鍦板潃锛�%08x",
[PRINT_BFAR] = "鍙戠敓鎬荤嚎閿欒鐨勫湴鍧�锛�%08x",
Loading
Loading