HI,
My code works fine in optimzation for time level . But in level - 0 optimzation it goes to hardfault before entering main.
I am using LPC1317, here is reset handler for this.
Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 -- STAT whre problem ENDP
After "BX R0" code goes into hardfault with level0 however works fine in level3+cross+time optimztion.
In both optimzation value of R0 is 0x000000C1.
I guess its due to R/W data 248 bytes. However watchdog is off by deafult. I don't initialize any var during declaration. However even due to level 0 optimzation ZI data goes to R/W data.
Ok I wil check it. Also someone tell me that code posted by me above is right for debugging hardfault ot not.& how to find reason for hardfault now.
If it's repeatable, then I tend to simply see where the hardfault is generated and backtrack from there.
HI, I checked it & strange thing happening:
I have part of code code:
if (x < 2) { temp = 2 ; } if (!temp) { ........do_something }
I have checkecd it at first as x=0, in my case. Debugger also accepts thius condition & go inside the variable temp=2 line. But it ius not assigning value to temp. Don't know why.
I have checked it many times.