Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

freertos data abort, GCC OPTIM > 0 at91sam7

Posted by danilo vendruscolo on March 5, 2008
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


RE: freertos data abort, GCC OPTIM > 0 at91sam7

Posted by Dave on March 5, 2008
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.

RE: freertos data abort, GCC OPTIM > 0 at91sam7

Posted by Richard on March 5, 2008
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.

RE: freertos data abort, GCC OPTIM > 0 at91sam7

Posted by Richard on March 5, 2008
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.

RE: freertos data abort, GCC OPTIM > 0 at91sa

Posted by danilo vendruscolo on March 5, 2008
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.


RE: freertos data abort, GCC OPTIM > 0 at91sa

Posted by danilo vendruscolo on March 6, 2008
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

RE: freertos data abort, GCC OPTIM > 0 at91sa

Posted by woops_ on March 6, 2008
You have probably experienced the __attribute__(IRQ) bug that is in the code sorcery version of GCC.

RE: freertos data abort, GCC OPTIM > 0 at91sa

Posted by danilo vendruscolo on March 6, 2008
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).


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner