Cortex-M4 Hard Fault. Tmr Svc thread stack corruption.

arcolight wrote on Thursday, December 19, 2013:

Hi, I’m using cortex-m4 cpu and freertos. I’m using latest stable version - 7.5.2. For some time everything were fine, but at one moment my cpu begans to fail with HardFault at different points, such as calling printf(…), taskYIELD(), calling some local functions, allocations, etc.

Hours of horrible debug shows me, that problem in stack corruption of process “Tmr Svc”. Hardware breakpoint triggered at task allocation and, next, at context switch, that normal, but stack have been already corrupted.

Now I’m using freertos-7.4.2 with the same code of my program, and everything works fine. I can suppose, that problem in freertos.

And this bug appears when .bss section becomes large.
I’m using heap_3.c and all allocations works fine, i’ve modified linker script so, that memory for heap is after .stack section.

This bug appears also, if I’m using any other heap, that uses .bss section memory and if I create my own tasks restricted. I supposу cause of this bug is a dense memory organization, but i can’t tell exactly.

davedoors wrote on Thursday, December 19, 2013:

I’m using latest stable version - 7.5.2.

The latest version if 7.6.0. Try that with configASSERT() defined and look through all the points on FreeRTOS - Open Source RTOS Kernel for small embedded systems

dumarjo wrote on Thursday, December 19, 2013:

Hi,

Have you set the stackoverflowcheck ?

This can help debugging this kind of problem.

Jonathan
Le 2013-12-19 06:51, Dmitriy a écrit :

Hi, I’m using cortex-m4 cpu and freertos. I’m using latest stable
version - 7.5.2. For some time everything were fine, but at one moment
my cpu begans to fail with HardFault at different points, such as
calling printf(…), taskYIELD(), calling some local functions,
allocations, etc.

Hours of horrible debug shows me, that problem in stack corruption of
process “Tmr Svc”. Hardware breakpoint triggered at task allocation
and, next, at context switch, that normal, but stack have been already
corrupted.

Now I’m using freertos-7.4.2 with the same code of my program, and
everything works fine. I can suppose, that problem in freertos.

And this bug appears when .bss section becomes large.
I’m using heap_3.c and all allocations works fine, i’ve modified
linker script so, that memory for heap is after .stack section.

This bug appears also, if I’m using any other heap, that uses .bss
section memory and if I create my own tasks restricted. I supposу
cause of this bug is a dense memory organization, but i can’t tell
exactly.


Cortex-M4 Hard Fault. Tmr Svc thread stack corruption.
https://sourceforge.net/p/freertos/discussion/382005/thread/f9b1bb09/?limit=25#7bc0


Sent from sourceforge.net because you indicated interest in
SourceForge.net: Log In to SourceForge.net

To unsubscribe from further messages, please visit
SourceForge.net: Log In to SourceForge.net


This message has been scanned for viruses and
dangerous content by MailScanner http://www.mailscanner.info/, and is
believed to be clean.