freertos data abort, GCC OPTIM > 0 at91sam7

hello, i am writing this to tell you a problem i am facing: when I turn on optimization with gcc, any level ranging from 1 to 3, my system won´t run, it crashes with undf or data abort. If I turn it off, my system runs without any problem. The system crashes if I use the -fomit option too. I am using yagarto gcc 4.2.2 and at91sam7xc256, freertos 4.7.1, lwip 1.2.0. does anyone have any idea what is going ? thanks in advance, danilo

freertos data abort, GCC OPTIM > 0 at91sam7

Two things to suggest you could try. First, stop the debugger after the crash to see where you are. I guess you will be in an abort handler. If so look at the abort link register to find the instruction that caused to exception. Second, remove most of your application code and definitely remove lwip. Then write a simple task that does nothing but flashes an LED. void vtask( void *v ) {     for(;;)     {         vTaskDelay(1000);         vParTestToggleLED(0);     } } See if this runs ok.

freertos data abort, GCC OPTIM > 0 at91sam7

I am still using GCC 4.2.1.  Are there any significant changes in the optimisation in 4.2.2?  Could you try your application with V4.2.1? Regards.

freertos data abort, GCC OPTIM > 0 at91sam7

I just downloaded the latest V4.2.2 Yagarto and tried it with the ARM7_AT91SAM7X256_Eclipse project at -O0, -O3 and -Os optimisation levels with no problems. Regards.

freertos data abort, GCC OPTIM > 0 at91sam7

hi, thanks for the replies, I made the led test and it worked too. So I investigated deeper into my code and disabled two interrupts I had, TC0 and SSC. Then everything worked. What is funny is that the code works without problems when I have no optimization. Either of them enabled, it does not work. moreover, there is no context switch from within these two ISRs. i will try to debug more. will post here the results.

freertos data abort, GCC OPTIM > 0 at91sam7

hi, i´ve made it work, i had to use the naked attribute and the port save context, the same thing other interrupts that cause a context switch does, but even when it is not the case. please, if possible, change the lwip rowley documentation to warn other users too. thanks, danilo

freertos data abort, GCC OPTIM > 0 at91sam7

You have probably experienced the __attribute__(IRQ) bug that is in the code sorcery version of GCC.

freertos data abort, GCC OPTIM > 0 at91sam7

as I said before, I was using yagarto gcc 4.2.2. i have just checked google, and found this, but it seems rather old, 2005. Weird that it hasn´t been fixed yet. thanks, danilo http://gcc.gnu.org/ml/gcc-bugs/2005-12/msg01563.html [Bug c/25428] New: arm-elf-gcc generating wrong code with -O flag at functions with __attribute__ ((interrupt ("IRQ")))     * From: "th dot r dot klein at web dot de" <gcc-bugzilla at gcc dot gnu dot org>     * To: gcc-bugs at gcc dot gnu dot org     * Date: 15 Dec 2005 14:57:21 -0000     * Subject: [Bug c/25428] New: arm-elf-gcc generating wrong code with -O flag at functions with __attribute__ ((interrupt ("IRQ")))     * Reply-to: gcc-bugzilla at gcc dot gnu dot org If a little bit more complex interrupt function is required the compiler genrates wrong code (olny with -O flag set).