GCC 4.8 and TivaTM4C1231

simon–r wrote on Thursday, October 22, 2015:

Hi all
FreeRTOS: 7.2.0
MCU: TM4C1231
Memory alloc: heap_4

My application works when compiled with GCC 4.7. I’ve updated to GCC 4.8 and the same application is unstable, and reports unreasonably large numbers from xPortGetFreeHeapSize, e.g.:
GCC 4.7.1 7800 bytes
GCC 4.8.3 33537864 bytes

I’ve tried updating to FreeRTOS 8.2.3 but this makes no difference. I have a task StackOverflowHook installed but it is not being called.

I would appreciate any suggestions/ideas. Unfortunately the JTAG port on my hardware isn’t easily accessible for debugging.

rtel wrote on Thursday, October 22, 2015:

Did you look at the release notes for the compiler to see what was different? Could it be the libraries that are the biggest difference?

heinbali01 wrote on Thursday, October 22, 2015:

Is there a higher gcc version available ( >= 4.9.1 ? ) for the TM4C1231 ?
In 4.8, for the first time, the gcc compiler is compiled by a C++ compiler.
It is not unthinkable that some regression has taken place.

Did you try different levels of optimisation already? -O0, -O1, -O2 and (my favourite) -Os ?

It is a pity that embedded debugging is difficult. If not I would definitely check the value of ‘xFreeBytesRemaining’, see why and when it becomes extremely high.

Do you have a listing ( main.lss mixed with C-code ) of the functions in heap_4.c ?

void vPortFree( void *pv );
static void prvHeapInit( void );
static void prvInsertBlockIntoFreeList( BlockLink_t *pxBlockToInsert );
void *pvPortMalloc( size_t xWantedSize );

You write you have ‘StackOverflowHook’ installed, I assume that you also have this define?

    #define configCHECK_FOR_STACK_OVERFLOW			2

Please let us know your findings.


simon–r wrote on Thursday, October 29, 2015:

Thanks for your suggestions. I’m still investigating, but I think that my problem is a bug in our linker script, and changing the compiler has made the problem show up. So it’s not a FreeRTOS fault.