diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index da9229a..0000000 --- a/docs/README.md +++ /dev/null @@ -1,4 +0,0 @@ -|File or folder name |Description| -|:----- |:----| -|en |English documents| -|zh |中文文档(简体)| \ No newline at end of file diff --git a/docs/zh/enable_c99_for_keil_iar_gcc.md b/docs/zh/enable_c99_for_keil_iar_gcc.md deleted file mode 100644 index a2947ba..0000000 --- a/docs/zh/enable_c99_for_keil_iar_gcc.md +++ /dev/null @@ -1,51 +0,0 @@ -# 一步开启 Keil/IAR/GCC 的 C99 支持 - -## 背景 - -C99 标准于 1999 年发布,至今(2016-12-28)将近 20 年的时间,相比早期的 C89 ,C99 有如下新特性(摘自 [维基百科](https://zh.wikipedia.org/wiki/C%E8%AF%AD%E8%A8%80#C99)): - -- 增加了对编译器的限制,比如源程序每行要求至少支持到 4095 字节,变量名函数名的要求支持到 63 字节(extern 要求支持到 31)。 -- 增强了预处理功能。例如: - - 宏支持取可变参数 #define Macro(...) `__VA_ARGS__` - - 使用宏的时候,允许省略参数,被省略的参数会被扩展成空串。 - - 支持 // 开头的单行注释(这个特性实际上在C89的很多编译器上已经被支持了) -- 增加了新关键字 restrict, inline, _Complex, _Imaginary, _Bool - - 支持 long long, long double _Complex, float _Complex 等类型 -- 支持不定长的数组,即数组长度可以在运行时决定,比如利用变量作为数组长度。声明时使用 int a[var] 的形式。不过考虑到效率和实现,不定长数组不能用在全局,或 struct 与 union 里。 -- 变量声明不必放在语句块的开头,for 语句提倡写成 for(int i=0;i<100;++i) 的形式,即i 只在 for 语句块内部有效。 -- 允许采用(type_name){xx,xx,xx} 类似于 C++ 的构造函数的形式构造匿名的结构体。 -- 初始化结构的时候允许对特定的元素赋值,形式为: - - `struct test{int a[3],b;} foo[] = { [0].a = {1}, [1].a = 2 };` - - `struct test{int a, b, c, d;} foo = { .a = 1, .c = 3, 4, .b = 5 }; // 3,4 是对 .c,.d 赋值的` -- 格式化字符串中,利用 \u 支持 unicode 的字符。 -- 支持 16 进制的浮点数的描述。 -- printf scanf 的格式化串增加了对 long long int 类型的支持。 -- 浮点数的内部数据描述支持了新标准,可以使用 #pragma 编译器指令指定。 -- 除了已有的 `__line__` `__file__` 以外,增加了 `__func__` 得到当前的函数名。 -- 允许编译器化简非常数的表达式。 -- 修改了 / % 处理负数时的定义,这样可以给出明确的结果,例如在C89中-22 / 7 = -3, -22 % 7 = -1,也可以-22 / 7= -4, -22 % 7 = 6。 而C99中明确为 -22 / 7 = -3, -22 % 7 = -1,只有一种结果。 -- 取消了函数返回类型默认为 int 的规定。 -- 允许在 struct 的最后定义的数组不指定其长度,写做 [](flexible array member)。 -- const const int i 将被当作 const int i 处理。 -- 增加和修改了一些标准头文件,比如定义 bool 的 ,定义一些标准长度的 int 的 ,定义复数的 ,定义宽字符的 ,类似于泛型的数学函数 , 浮点数相关的 。 在 增加了 va_copy 用于复制 ... 的参数。 里增加了 struct tmx ,对 struct tm 做了扩展。 -- 输入输出对宽字符以及长整数等做了相应的支持。 - -> C99 提供了众多的便利,也提高了程序开发的效率,但是一些嵌入式工具链并不是默认开启 C99,接下来将会针对不同的工具链,介绍如何开启 C99 模式。 - -## Keil 4 - -![keil4_enable_c99](https://raw.githubusercontent.com/armink/CmBacktrace/master/docs/zh/images/keil4_enable_c99.jpg) - -## Keil 5 - -![keil5_enable_c99](https://raw.githubusercontent.com/armink/CmBacktrace/master/docs/zh/images/keil5_enable_c99.jpg) - -## IAR - -IAR 新建完的工程,默认开启 C99 ,如果工程没有开启,请使用下面的方法 - -![iar_enable_c99](https://raw.githubusercontent.com/armink/CmBacktrace/master/docs/zh/images/iar_enable_c99.png) - -## GCC - -在编译配置中增加 `-std=c99` 即可 \ No newline at end of file diff --git a/docs/zh/how_to_use_addr2line_for_call_stack.md b/docs/zh/how_to_use_addr2line_for_call_stack.md deleted file mode 100644 index f4dc627..0000000 --- a/docs/zh/how_to_use_addr2line_for_call_stack.md +++ /dev/null @@ -1,59 +0,0 @@ -# 如何使用 addr2line 工具获取函数调用栈详细信息 - -## addr2line 是什么 - -addr2line (它是标准的 [GNU Binutils](https://www.gnu.org/software/binutils/) 中的一部分)是一个可以将指令的地址和可执行映像转换成文件名、函数名和源代码行数的工具。 - -## 如何获得 addr2line - -Linux 系统一般会集成这个工具,本文重点介绍 Windows 系统下如何获取该工具。方法很多,我这里仅介绍两种方式 - -- 第一种:安装 MinGW(网上教程很多,自行搜索),安装后在其安装目录的 `bin` 文件夹里会包含 `addr2line.exe` ,此时只用保证环境变量 `path` 中包含该路径即可; -- 第二种(XP 平台除外):在本项目的 `tools` 文件夹中已存放 `addr2line.exe` ,可以将其直接拷贝至 `C:\Windows` 下,或者将 CmBacktrace 仓库的 `tools` 文件夹路径添加至到环境变量 `path` 中,这样都能保证命令行工具能正常使用 `addr2line` 命令。 - -## addr2line 如何使用 - -使用 `addr2line --help` 可以看到如下介绍: - -``` -$addr2line --help -Usage: addr2line [option(s)] [addr(s)] - Convert addresses into line number/file name pairs. - If no addresses are specified on the command line, they will be read from stdin - The options are: - @ Read options from - -a --addresses Show addresses - -b --target= Set the binary file format - -e --exe= Set the input file name (default is a.out) - -i --inlines Unwind inlined functions - -j --section= Read section-relative offsets instead of addresses - -p --pretty-print Make the output easier to read for humans - -s --basenames Strip directory names - -f --functions Show function names - -C --demangle[=style] Demangle function names - -h --help Display this information - -v --version Display the program's version - -addr2line: supported targets: pe-x86-64 pei-x86-64 pe-bigobj-x86-64 elf64-x86-64 elf64-l1om elf64-k1om pe-i386 pei-i386 elf32-i386 elf64-little elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex -Report bugs to -``` - -这里常用的是以下参数 - -- `-e` :指定可执行映像名称 -- `-a` :显示函数地址 -- `-f` :显示函数名称 - -例如命令 `addr2line -e CmBacktrace.out -f 08000a60 08000141 0800313f` 将会显示名称为 `CmBacktrace.out` 的可执行映像,在地址为 `08000a60` `08000141` `0800313f` 对应的函数名称及源代码信息。执行结果如下: - -``` -$addr2line -e CmBacktrace.out -a -f 08000a60 08000141 0800313f -fault_test_by_div0 -D:\Program\STM32\CmBacktrace\demo\non_os\stm32f10x\app\src/fault_test.c:38 -main -D:\Program\STM32\CmBacktrace\demo\non_os\stm32f10x\app\src/app.c:20 -_call_main -??:? -``` - -> 更多使用指南,请 [参考官方说明文档](https://sourceware.org/binutils/docs-2.27/binutils/addr2line.html#addr2line) 。 diff --git a/docs/zh/images/cm_backtrace_demo.gif b/docs/zh/images/cm_backtrace_demo.gif deleted file mode 100644 index 16936eb..0000000 Binary files a/docs/zh/images/cm_backtrace_demo.gif and /dev/null differ diff --git a/docs/zh/images/demo/CmBacktrace.uga b/docs/zh/images/demo/CmBacktrace.uga deleted file mode 100644 index d69afc3..0000000 Binary files a/docs/zh/images/demo/CmBacktrace.uga and /dev/null differ diff --git a/docs/zh/images/demo/call_stack_basic_info.png b/docs/zh/images/demo/call_stack_basic_info.png deleted file mode 100644 index cd591ec..0000000 Binary files a/docs/zh/images/demo/call_stack_basic_info.png and /dev/null differ diff --git a/docs/zh/images/demo/call_stack_details.png b/docs/zh/images/demo/call_stack_details.png deleted file mode 100644 index 76a7916..0000000 Binary files a/docs/zh/images/demo/call_stack_details.png and /dev/null differ diff --git a/docs/zh/images/demo/cd_exe_dir.png b/docs/zh/images/demo/cd_exe_dir.png deleted file mode 100644 index 9ad9071..0000000 Binary files a/docs/zh/images/demo/cd_exe_dir.png and /dev/null differ diff --git a/docs/zh/images/demo/demo_code.png b/docs/zh/images/demo/demo_code.png deleted file mode 100644 index d77a513..0000000 Binary files a/docs/zh/images/demo/demo_code.png and /dev/null differ diff --git a/docs/zh/images/demo/fault_diagnosis.png b/docs/zh/images/demo/fault_diagnosis.png deleted file mode 100644 index 68258df..0000000 Binary files a/docs/zh/images/demo/fault_diagnosis.png and /dev/null differ diff --git a/docs/zh/images/demo/paste_cmd.png b/docs/zh/images/demo/paste_cmd.png deleted file mode 100644 index 2b982e7..0000000 Binary files a/docs/zh/images/demo/paste_cmd.png and /dev/null differ diff --git a/docs/zh/images/iar_enable_c99.png b/docs/zh/images/iar_enable_c99.png deleted file mode 100644 index ae9b527..0000000 Binary files a/docs/zh/images/iar_enable_c99.png and /dev/null differ diff --git a/docs/zh/images/keil4_enable_c99.jpg b/docs/zh/images/keil4_enable_c99.jpg deleted file mode 100644 index 02bfc3c..0000000 Binary files a/docs/zh/images/keil4_enable_c99.jpg and /dev/null differ diff --git a/docs/zh/images/keil5_enable_c99.jpg b/docs/zh/images/keil5_enable_c99.jpg deleted file mode 100644 index 380cc9e..0000000 Binary files a/docs/zh/images/keil5_enable_c99.jpg and /dev/null differ