Skip to content

Commit 742cfc0

Browse files
committed
Merge branch 'backtrace'
Former-commit-id: 3c72558
2 parents d467bb5 + f4e51c7 commit 742cfc0

File tree

13 files changed

+1338
-12
lines changed

13 files changed

+1338
-12
lines changed

boards.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ composta.build.fpu=-mfpu=fpv5-sp-d16
108108
composta.build.float-abi=-mfloat-abi=hard
109109

110110
composta.build.board=SANTIAGO_COMPOSTA
111-
composta.build.defines=-DF_CPU=48000000 -DNO_USB
111+
composta.build.defines=-DF_CPU=48000000 -DNO_USB -DBACKTRACE_SUPPORT
112112
composta.vid.0=0x2341
113113
composta.pid.0=0x0069
114114
composta.vid.1=0x2341

cores/arduino/Serial.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,4 +314,16 @@ int UART::read() {
314314
void UART::flush() {
315315
/* -------------------------------------------------------------------------- */
316316
while(txBuffer.available());
317+
}
318+
319+
/* -------------------------------------------------------------------------- */
320+
size_t UART::write_raw(uint8_t* c, size_t len) {
321+
/* -------------------------------------------------------------------------- */
322+
size_t i = 0;
323+
while (i < len) {
324+
uart_ctrl.p_reg->TDR = *(c+i);
325+
// TODO: replace me with a check that the register is empty
326+
R_BSP_SoftwareDelay(1, BSP_DELAY_UNITS_MILLISECONDS);
327+
i++;
328+
}
317329
}

cores/arduino/Serial.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class UART : public arduino::HardwareSerial {
6363
void flush(void);
6464
size_t write(uint8_t c);
6565
size_t write(uint8_t* c, size_t len);
66+
size_t write_raw(uint8_t* c, size_t len);
6667
using Print::write;
6768
operator bool(); // { return true; }
6869

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# CmBacktrace: ARM Cortex-M 系列 MCU 错误追踪库
2+
3+
## 多语言支持
4+
5+
| Language | Location (or type) | Language tag |
6+
|----------------------|----------------------------|--------------|
7+
| English | United States | en-US |
8+
| Chinese (Simplified) | People's Republic of China | zh-CN |
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* This file is part of the CmBacktrace Library.
3+
*
4+
* Copyright (c) 2020, Armink, <armink.ztl@gmail.com>
5+
* Chenxuan, <chenxuan.zhao@icloud.com>
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining
8+
* a copy of this software and associated documentation files (the
9+
* 'Software'), to deal in the Software without restriction, including
10+
* without limitation the rights to use, copy, modify, merge, publish,
11+
* distribute, sublicense, and/or sell copies of the Software, and to
12+
* permit persons to whom the Software is furnished to do so, subject to
13+
* the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be
16+
* included in all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
19+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25+
*
26+
* NOTE: DO NOT include this file on the header file.
27+
* Encoding: UTF-8
28+
* Created on: 2020-09-06
29+
*/
30+
31+
[PRINT_MAIN_STACK_CFG_ERROR] = "ERROR: Unable to get the main stack information, please check the configuration of the main stack",
32+
[PRINT_FIRMWARE_INFO] = "Firmware name: %s, hardware version: %s, software version: %s",
33+
[PRINT_ASSERT_ON_THREAD] = "Assert on thread %s",
34+
[PRINT_ASSERT_ON_HANDLER] = "Assert on interrupt or bare metal(no OS) environment",
35+
[PRINT_THREAD_STACK_INFO] = "===== Thread stack information =====",
36+
[PRINT_MAIN_STACK_INFO] = "====== Main stack information ======",
37+
[PRINT_THREAD_STACK_OVERFLOW] = "Error: Thread stack(%08x) was overflow",
38+
[PRINT_MAIN_STACK_OVERFLOW] = "Error: Main stack(%08x) was overflow",
39+
[PRINT_CALL_STACK_INFO] = "Show more call stack info by run: addr2line -e %s%s -a -f %s",
40+
[PRINT_CALL_STACK_ERR] = "Dump call stack has an error",
41+
[PRINT_FAULT_ON_THREAD] = "Fault on thread %s",
42+
[PRINT_FAULT_ON_HANDLER] = "Fault on interrupt or bare metal(no OS) environment",
43+
[PRINT_REGS_TITLE] = "=================== Registers information ====================",
44+
[PRINT_HFSR_VECTBL] = "Hard fault is caused by failed vector fetch",
45+
[PRINT_MFSR_IACCVIOL] = "Memory management fault is caused by instruction access violation",
46+
[PRINT_MFSR_DACCVIOL] = "Memory management fault is caused by data access violation",
47+
[PRINT_MFSR_MUNSTKERR] = "Memory management fault is caused by unstacking error",
48+
[PRINT_MFSR_MSTKERR] = "Memory management fault is caused by stacking error",
49+
[PRINT_MFSR_MLSPERR] = "Memory management fault is caused by floating-point lazy state preservation",
50+
[PRINT_BFSR_IBUSERR] = "Bus fault is caused by instruction access violation",
51+
[PRINT_BFSR_PRECISERR] = "Bus fault is caused by precise data access violation",
52+
[PRINT_BFSR_IMPREISERR] = "Bus fault is caused by imprecise data access violation",
53+
[PRINT_BFSR_UNSTKERR] = "Bus fault is caused by unstacking error",
54+
[PRINT_BFSR_STKERR] = "Bus fault is caused by stacking error",
55+
[PRINT_BFSR_LSPERR] = "Bus fault is caused by floating-point lazy state preservation",
56+
[PRINT_UFSR_UNDEFINSTR] = "Usage fault is caused by attempts to execute an undefined instruction",
57+
[PRINT_UFSR_INVSTATE] = "Usage fault is caused by attempts to switch to an invalid state (e.g., ARM)",
58+
[PRINT_UFSR_INVPC] = "Usage fault is caused by attempts to do an exception with a bad value in the EXC_RETURN number",
59+
[PRINT_UFSR_NOCP] = "Usage fault is caused by attempts to execute a coprocessor instruction",
60+
#if (CMB_CPU_PLATFORM_TYPE == CMB_CPU_ARM_CORTEX_M33)
61+
[PRINT_UFSR_STKOF] = "Usage fault is caused by indicates that a stack overflow (hardware check) has taken place",
62+
#endif
63+
[PRINT_UFSR_UNALIGNED] = "Usage fault is caused by indicates that an unaligned access fault has taken place",
64+
[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)",
65+
[PRINT_DFSR_HALTED] = "Debug fault is caused by halt requested in NVIC",
66+
[PRINT_DFSR_BKPT] = "Debug fault is caused by BKPT instruction executed",
67+
[PRINT_DFSR_DWTTRAP] = "Debug fault is caused by DWT match occurred",
68+
[PRINT_DFSR_VCATCH] = "Debug fault is caused by Vector fetch occurred",
69+
[PRINT_DFSR_EXTERNAL] = "Debug fault is caused by EDBGRQ signal asserted",
70+
[PRINT_MMAR] = "The memory management fault occurred address is %08x",
71+
[PRINT_BFAR] = "The bus fault occurred address is %08x",

0 commit comments

Comments
 (0)