SAM7 IAR demo fails at restart
I have the sam7s-ek evaluation board, and I run the freeRTOS demo for this. I can build it and load it into flash and run: runs OK. I can stop it using the debugger, and run again: OK. But, if I reset it with the debugger it will crash on restart, shortly after line "AT91C_BASE_AIC->AIC_EOICR = 0;"
Any explanations and solutions?
Thanks in advance
SAM7 IAR demo fails at restart
Try removing the line. It might not be needed with later IAR releases.
Also check what your JTAG startup script is doing. Does it disable interrupts before the code starts. It could be that the timer interrupt is still running when you reset the code.
SAM7 IAR demo fails at restart
I tried to remove the line, and nothing worked. I have also made the guess that some interrupt is pending. I will have a special look at timer.
SAM7 IAR demo fails at restart
Now I tried to add things to IAR:s startup code:
Adding
*AT91C_AIC_IDCR = 0xffffffff; // disable all irq
*AT91C_AIC_ICCR = 0xffffffff; // clear all pending irq:s
last in the function "AT91F_LowLevelInit", in CStartup_SAM7.c.
This disables all interrupts, and resets any pending ones. And it helps!
Regards
Jokke
SAM7 IAR demo fails at restart
It appears that the macro file used with the J-Link has a function missing. Add the following lines to the file SAM7.mac (if using the SAM7X demo, or equiv for the S demo – just search for a .mac file in the FreeRTOS directory to find the right one).
-- start of code to add
// Reset the AIC upon a software reset.
execUserReset()
{
AIC();
Watchdog();
}
-- end of code to add
This will then do what is required automatically when you click the reset button on the IDE.