These days , we are using s32k148, and encountering some problems in FPU module.
The development environment is the MDK5.0 of Keil, debugger uses J-Link, and is configured to use 'Single Precision'.
After the completion of the project initialization, the FPU module is not activated under the debugging environment:
S32_SCB->CPACR = 0；
S32_SCB->FPCCR = 0；
Program reset when using the defined float variable in the main program.
In addition, try the following test:
Instead of using the hardware debugger, use keil 'Use Simulator' for Debug:
In the debugging environment, the program runs normally, the floating point variable is normal, and the FPU module is activated：
S32_SCB->CPACR = 0x00F00000；
S32_SCB->FPCCR = 0x80000000；
In view of the above floating-point operation, we hope to get the guidance of the experts as soon as possible
In the Keil S32K-148 tutorial, there is a DSP example that uses the FPU.
I am not sure this will work on the Keil simulator - I used a evaluation board. This simulator does not include S32 peripherals. It is an instruction set simulator.
This project has a setup for a J-Link. See screen below. ULINKplus is next to configure.
In this example ARM_MATH_CM4 __FPU_PRESENT is defined. See the screen below in the C/C++ tab.
In DirtyFilter.c there is also:: #include "arm_math.h"
Give this a try and let us know how you make out.
This program works slower with the FPU disabled.
The current version of MDK is 5.24a and 5.25 will be released soon. 5,25 adds ULINKplus support (Power measurement) www.keil.com/ulinkplus.
San Jose, California
You didn't specify what problems you had with the example programs.
I tried the two DSP examples and when using a J-Link - something has changed. It now gives me a Cannot Access Memory when attempting to enter Debug mode.
It still works fine with OpenSDA CMSIS-DAPmode (I didn't try P&E mode) and ULINK2.
The solution is to unselect Verify Code Download. This is easy to do.
When not in debug mode
Ought to work now.
For some reason, the Logic Analyzer with J-Link is not preloaded with the four variables with J-Link.
When you run the program, the Watch window variables will update showing it is working.
I will update these example files Monday..
I don't think you have to setup specific FPU registers - CMSIS file such as core_cm4.h will do this. This is what CMSIS is for - takes care of all these things for you.