I am new in C embedded. Debugging an embedded system for image camera tracking I get the following HardFaultHandler:
The Atollic Debug stops it at this point without apparently indications of specific errors.
__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"
);
I dont have bunch of memory locations, however, how can I make conclusions on which line of code caused the issue according to these locations? This is part of the code, please help me:
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;