使用cm_backtrace在stm32cubeIDE上使用踩坑
使用之后宏定义会变为__GNUC__#elif defined(__GNUC__)
/* C stack block start address, defined on linker script file, default is _sstack */
#ifndef CMB_CSTACK_BLOCK_START
#define CMB_CSTACK_BLOCK_START _sstack
#endif
/* C stack block end address, defined on linker script file, default is _estack */
#ifndef CMB_CSTACK_BLOCK_END
#define CMB_CSTACK_BLOCK_END _estack
#endif
/* code section start address, defined on linker script file, default is _stext */
#ifndef CMB_CODE_SECTION_START
#define CMB_CODE_SECTION_START _stext
#endif
/* code section end address, defined on linker script file, default is _etext */
#ifndef CMB_CODE_SECTION_END
#define CMB_CODE_SECTION_END _etext
#endif
但是找不到_stext和_sstack的定义在哪里
由于代码使用stm32cubeMX直接生成
直接在依赖的.ld中直接找到大约67行加上_stext = .; 直接插入进去
/* The program code and other data into "FLASH" Rom type memory */
.text :
{
. = ALIGN(4);
_stext = .;
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
KEEP (*(.init))
KEEP (*(.fini))
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} >FLASH
还有大约174行加上 _sstack = .; 直接插入进去
/* User_heap_stack section, used to check that there is enough "RAM" Ramtype memory left */
._user_heap_stack :
{
. = ALIGN(8);
PROVIDE ( end = . );
PROVIDE ( _end = . );
. = . + _Min_Heap_Size;
_sstack = .;
. = . + _Min_Stack_Size;
. = ALIGN(8);
} >RAM
这样就可以直接使用编译不会错报了
————————————————
版权声明:本文为CSDN博主「风停了123」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/2301_79036162/article/details/148861305
页:
[1]