[英]AVR32 exception: Bus Data Error
Recently, I am facing a - to me - strange behavior in my embedded software. 最近,我在我的嵌入式软件中遇到了一种奇怪的行为。
What I got: Running a 32 bit AVR32 controller, starting the program from an external SDRAM, as the file size is too big to start it directly from the micro-controller flash. 我得到了:运行一个32位AVR32控制器,从外部SDRAM启动程序,因为文件太大,无法直接从微控制器闪存启动它。 Due to the physical memory map, the memory areas are split between:
由于物理内存映射,内存区域分为:
stack (start at 0x1000, length of 0xF000) ( < 0x1000 is protected by the MPU)
堆栈(从0x1000开始,长度为0xF000)(<0x1000受MPU保护)
EBI SDRAM (start at 0xD0000000, length of 0x00400000).
EBI SDRAM(从0xD0000000开始,长度为0x00400000)。
What happens: Unfortunately I got an exception, which is not reproducible. 会发生什么:不幸的是我得到了一个例外,这是不可重复的。 Looking at my given stack trace, the following event irregular occurs:
查看我给定的堆栈跟踪,发生以下事件不规则:
Name: Bus error data fetch - Event source: Data bus - Stored Return Address: First non-completed instruction
名称:总线错误数据获取 - 事件源:数据总线 - 存储的返回地址:第一个未完成的指令
Additionally, the stack pointer has a valid value, whereas the address where the exception occurs (last entry point for fetching instructions), points into the memory nirvana (eg 0x496e6372, something around 0x5..., 0x6....). 另外,堆栈指针具有有效值,而发生异常的地址(用于获取指令的最后入口点)指向存储器必杀技(例如0x496e6372,大约0x5 ...,0x6 ....)。 I guess, this has to be the "First non-completed instruction", the manual is talking about.
我想,这必须是“第一个未完成的指令”,手册正在谈论。 However, the line in my source code is always the same: accessing a member function from a data array via pointer.
但是,我的源代码中的行始终是相同的:通过指针从数据数组访问成员函数。
if(mSomeArray[i])
{
mSomeArray[i]->someFunction(); <-- Crash
}
The thing is: adding or deleting other source code makes the event disappear and return again. 问题是:添加或删除其他源代码会使事件消失并再次返回。
What I thought about: Something is corrupting my memory (mapping). 我的想法:有些东西正在腐蚀我的记忆(映射)。 What kinds of errors are possible for this?
这有什么样的错误?
How to solve this: More assert? 如何解决这个问题:更多断言? Unfortunately I cannot debug this with AVRStudio.
不幸的是我无法使用AVRStudio进行调试。 Anyone a hint or idea?
有人暗示或想法吗? Or am I missing something obvious?
还是我错过了一些明显的东西?
Mentioned approaches from users: 提到用户的方法:
i
at crash case i
检查阵列访问 snprintf
instead of sprintf
snprintf
而不是sprintf
Here are some ideas: 以下是一些想法:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.