AnsweredAssumed Answered

K22: Hard Fault (exception #3) after floating point instruction

Question asked by Thomas Kintzel on Mar 27, 2017
Latest reply on Mar 30, 2017 by Thomas Kintzel

I do have a project based on ProcessorExpert where I now start with some calculation. 

 

I'm using

  • MK22FX512VMC12
  • ProcessorExpert 10.4.0 b140319
  • winIDEA 9.12.157
  • GCC arm-2013q3
  • No RTOS

 

Up to now everything worked fine so far. Now I'm trying to scale some measurement values and with the first math instruction I enter hardware fault exception (vector #3).

 

screenshot of source code which is failing

 

I guess that I doing something wrong in software but I don't know what.

 

My settings may be wrong - but floating point settings seems to be OK.

 

Compiler:

-c $(EDNAME) -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard 
-gdwarf-2  -Wall -ffast-math -fomit-frame-pointer
-I$(IRFDIR)\Generated_Code -I$(IRFDIR)\Sources
-I"%PROCESSOR_EXPERT_PATH%\lib\Kinetis\iofiles"
-I"%PROCESSOR_EXPERT_PATH%\lib\Kinetis\pdd\inc"
-D__GNU__ -D__PE__

 

Linker:

-mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard 
-Wl,-T,$(INDPATH) -Wl,-Map,$(OUTPUTDIR)\kernel.map,
--gc-sections -o $(OUTPUTPATH)

 

I do not understand why an instruction 

vldr.32 s14,[r3]

causes the hardware fault excpetion. The CPU has an FPU, so it should work. 

 

It would be great if anybody can help me with that.

  • Do I have to ENABLE the FPU? (If so where do I find it in PE?)
  • Is there an error in the command line of compiler or linker?

 

Thank you very much

Thomas

Outcomes