FreeRTOS 过多的堆栈溢出
我正在尝试使用 FreeRTOS 在 ATMega323_WinAVR 上实现生产者-消费者算法。我在 AVR Studio 4 调试时遇到此错误:
AVR Simulator: Excessive stack Overflow, stop sim
堆栈指针停在这一行:
static void prvCopyDataToQueue (
xQUEUE *pxQueue, const void *pvItemToQueue, portBASE_TYPE xPosition){
为什么会出现此错误?
谢谢!
I'm trying to implement the producer-consumer algorithm on ATMega323_WinAVR using FreeRTOS. I get this error in AVR Studio 4 when debugging:
AVR Simulator: Excessive stack overflow, stop sim
The stack pointer stops at this line:
static void prvCopyDataToQueue (
xQUEUE *pxQueue, const void *pvItemToQueue, portBASE_TYPE xPosition){
Why does this error appears?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您构建程序时,链接器定义堆栈将位于 RAM 中的位置,调试器将期望在那里找到它。当 FreeRTOS 调度程序运行时,堆栈将来自 FreeRTOS 堆,因为每个任务在创建时都会分配一个堆栈。调试器无法知道任务是否溢出其堆栈,因为它不知道堆栈在哪里,也不了解 FreeRTOS。
我建议关闭调试器中的检查,然后在 FreeRTOS 中打开堆栈检查(如果您想检查堆栈溢出,建议仅在开发期间进行)。
问候。
When you build a program, the linker defines where in RAM the stack will go, and the debugger will expect to find it there. When you have the FreeRTOS scheduler running, the stacks will come from the FreeRTOS heap, as each task is allocated a stack when it is created. The debugger will have no way of knowing if a task has overflowed its stack or not, because it does not know where the stack is, and has no knowledge of FreeRTOS.
I recommend turning that check in the debugger off, then turning the stack checking on in FreeRTOS (if you want to check for stack overflows at all, recommended during development only).
Regards.
看看此帖子。模拟器的堆栈观察程序可能存在问题。
Have a look at this thread. There may be an issue with the simulator's stack watcher.