I am attempting to run a DSP algorithm on a TM4C123GXL board using CCS and I have a couple of questions:
1. In the TM4C123G documentation regarding the FPU single-precision support is mentioned, without mentioning double-precision support. Nevertheless, when I try to define a variable of the type "double" and run a code with it, I don't get any noticeable errors or warnings. Also, when I check the code via debug I see that the values received do indeed behave like "double" does (greater precision).
What is the extent of the board's support regarding "double"-type variables? Are double-precision calculations supported?
2. In the same context, when I try to use the "log()" function (which is recognized as a funcion and documented in CCS as getting "double" argument and returning "double" value), I get a fault ISR and I don't understand why (assuming there is support for "double" variables). What could be the problem?
The code I'm testing this with is a small variation on the Lab 9 code in the TM4C123G workshop:
#include <stdint.h> #include <stdbool.h> #include <math.h> #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/fpu.h" #include "driverlib/sysctl.h" #include "driverlib/rom.h" #ifndef M_PI #define M_PI 3.14159265358979323846 #endif #define SERIES_LENGTH 100 double gSeriesData[SERIES_LENGTH]; int32_t i32DataCount = 0; int main(void) { double fRadians; FPULazyStackingEnable(); FPUEnable(); SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); fRadians = ((2 * M_PI) / SERIES_LENGTH); while(i32DataCount < SERIES_LENGTH) { gSeriesData[i32DataCount] = log(10.0 * fRadians); i32DataCount++; } while(1) { } }
Thanks in advance,
Avner.