Warning __vector_table symbol not found
Technical Note
Architectures:
All
Component:
debugger
Updated:
2023/8/4 5:48
问题
如果用户代码里面没有使用__vector_table作为中断向量表,在调试时,会报类似下面的错误:
Warning: __vector_table symbol not found. e_entry value: 0x40'14a0 does not match reset vector value: 0xcdcd'cdcc Initial SP_main value:0xcdcd'cdcd uncertain.
User error: Stack pointer is setup to incorrect alignment. Stack addr = 0xcdcd'cdcd
同时PC指针会指向地址0x00,MSP的初始值也是0x00(程序跑不起来):
原因
默认情况下,IAR调试器使用__vector_table作为中断向量表,如果程序里面没有使用__vector_table,IAR提示报错。
解决方法
如果程序里面没有使用__vector_table,需要在调试器选项中指定对应的中断向量表:
如下图所示:在调试器中通过 --drv_vector_table_base 命令指定对应的中断向量表的地址(根据生成的.map文件):
指定好对应的中断向量表的地址之后,调试器会将PC指向对应的Reset_Handler,而且MSP也从对应的地址复制到MSP寄存器中:
参考文献:
- C-SPY® Debugging Guide (--drv_vector_table_base)