Quality RTOS & Embedded Software

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


Getting hardfault with a simple application on cortex m4

Posted by himanshup2 on March 21, 2017

I am using cortex m4 along with gcc. I have create 4 threads in freeRTOS, 3 of which are periodic with periods of 10ms, 100ms and 1000 ms. My application runs all 4 threads for 1 instance and then experiences a hardfault.

Here is a log report generated with respective register values


HARDFAULT:ERROR:R0 R1 R2 R3 R12 : 0x0 0x20001950 0x10000 0x200020c8 0xa5a5a5a5 HARDFAULT:ERROR:LR PC PSR BFSR : 0x8 0x8 0x6000000b 0x200 HARDFAULT:ERROR:CFSR HFSR DFSR AFSR MMAR BFAR : 0x20000 0x40000000 0x0 0x0 0xe000ed34 0xe000ed38


I have tried changing the stack size for threads but that hasnt helped in anyway. Here is a link to freeRTOS config file : https://drive.google.com/open?id=0B5lr6ikuuOsxWnBTNjgyNmRZeWc

And this is the main.c that I am using https://drive.google.com/open?id=0B5lr6ikuuOsxb01PbkZDNWkwcEE

Kindly help me out.

Getting hardfault with a simple application on cortex m4

Posted by rtel on March 21, 2017

What happens if you take out the calls to Task10ms(), Task100ms(), Task_1000ms()? Does the code continue to run then? You could replace the calls with simple incrementing variables to see if the tasks are still running.

If that does not help, what happens if you set configUSETICKLESSIDLE to 0?

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

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

Latest News

FreeRTOS v10.2.0 is available for immediate download. MIT licensed, and including RISC-V and ARMv8-M (Cortex-M33) demos.

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

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


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers





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