cancel
Showing results for 
Search instead for 
Did you mean: 

Library File - Hard Fault

fraser
Associate
Posted on January 28, 2013 at 18:58

Hello All, 

I have recently started working with the STM32F0, and am trying to implement a PDM Microphone. In order to do this, I am using a library file provided by ST which has some functions for filtering PDM data. 

I am currently using IAR for development, and I have found that when I include the library and use one of the functions from it, when I go into debugging mode, the processor immediately goes into the HardFault_Handler. Normally, debugging would stop at the first instruction and you have to press play to start the program, but this jumps to the hardfault before ever reaching that first instruction. 

This occurs only when my program uses a function from the library; if I have the library added but no functions are called, it goes into debugging mode normally and runs fine. 

I have seen references to this maybe relating to the fact the library could be using ARM instructions. I am unsure if this is the issue, and if it is, I am unsure how to fix the problem, specifically in IAR. If anyone knows what might be going on, or how to fix this, any help would be appreciated. Thanks in advance. 

The library I am using is libPDMFilter_IAR.a, with pdm_filter.h, which are files provided directly from ST.

Specs:

Windows 7, 64 bit.

IAR Embedded Workbench for ARM v6.40.4.4221

#stm32f0-pdm-filter-library
2 REPLIES 2
Posted on January 28, 2013 at 19:28

One might assume it hard faults because you are trying to execute an instruction that is outside the subset supported by the Cortex-M0. You could examine the processor state and determine the instruction which is faulting.

But isn't the library you're trying to use for the Cortex-M4 with a FPU? That definitely isn't going to work on an M0.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
GHITH.Abdelhamid
Associate II
Posted on January 29, 2013 at 16:31

libPDMFilter_IAR.a is compiled for M3 you can dump it there is no FPU instructions. but I agree with clive1 the core goes to hardfault handler after executing an instruction that is outside the subset supported by the Cortex-M0. You can take a look at the core Flags to determine the root cause