【发布时间】:2019-09-22 05:49:45
【问题描述】:
我是嵌入式 C 的新手。调试用于图像相机跟踪的嵌入式系统我得到以下 HardFaultHandler:
Atollic Debug 在此时停止它,而没有明显的特定错误迹象。
__weak void DefaultHardFaultHandle ( void ){
asm volatile(
" tst lr,#4 \n"
" ite eq \n"
" mrseq r0,msp \n"
" mrsne r0,psp \n"
" mov r1,lr \n"
" ldr r2,=HardwareFaultHandler_GetSP \n"
" bx r2"
);
我没有一堆内存位置,但是,我如何根据这些位置得出是哪一行代码导致问题的结论? 这是代码的一部分,请帮助我:
uint8_t CameraImageTracker(uint8_t **edgeImage){
......
for (y = xRight.yStart; (y < height) && (exit == false); y++)
{
xRight.yStart = y;
int x = 0;
for (x = 0; (x < width) && (exit == false); x++)
{
if (edgeImage[y][x] == grayScale)
{
xRight.xStart = x;
xRight.yStart = y;
CountPixelX(width, height, &xRight, edgeImage, grayScale);
if (xRight.count > WhiteLinesPixMin)
{
exit = true;
}
}
}
WhiteLinesPixMin = xRight.count;
WhiteLinesPixMax = (WhiteLinesPixMin + 5);
if (exit == true)
{
exit = false;
xLeft.xStart = xRight.xStart;
xLeft.yStart = xRight.yStart;
CountPixelXleft(width, height, &xLeft, edgeImage, WhiteLinesPixMax, grayScale);
yLeft.xStart = xLeft.xEnd;
yLeft.yStart = xLeft.yEnd;
CountPixelY(width, height, &yLeft, edgeImage, grayScale);
yRight.xStart = xRight.xEnd;
yRight.yStart = xRight.yEnd;
CountPixelY(width, height, &yRight, edgeImage, grayScale);
ellipseCenter(&xRight, &yRight, &xLeft, &yLeft);
exit = true;
}
}
return 0;
【问题讨论】:
-
为什么要标记eclipse?
-
可能是 OP 正在使用的 IDE。
-
所以当您注释掉这段代码或使用其他调试技术来缩小违规行时,您看到了什么?这段代码减少了多少,仍然会中断?
标签: c eclipse arm embedded cortex-m