SAM7 IAR demo fails at restart

nobody wrote on Tuesday, August 23, 2005:

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

nobody wrote on Tuesday, August 23, 2005:

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.

jra01 wrote on Tuesday, August 23, 2005:

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.

jra01 wrote on Tuesday, September 20, 2005:

Now I tried to add things to IAR:s startup code:
    *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!


rtel wrote on Tuesday, September 20, 2005:

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.
– end of code to add

This will then do what is required automatically when you click the reset button on the IDE.