cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4Discovery DSP

peppea82
Associate II
Posted on November 11, 2013 at 09:21

Hi

I have a STM32F4Discovery evaluation board. I use CooCox CoIDE and GNU Tools ARM Embedded. While everything works fine if I use standard peripheral library and code, I cannot run anything that is dsp related (like cfft): program fails to run when this functions are called.

CooCox CoIDE is configured correctly with GNU ARM Compiler, libm and cortex math are linked, includes from dsplib are correctly seen. What am I missing? 
4 REPLIES 4
Posted on November 11, 2013 at 10:42

And how exactly does it fail? That might tell you something, does it Hard Fault, if so where? Make sure the FPU is enabled, and you stacks are sufficiently big.

Normally the FPU is enabled in SystemInit(), systems other than CooCox typically call this prior to main(). There are also some defines that the compiler normally sets up.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
peppea82
Associate II
Posted on November 11, 2013 at 11:58

STACK_SIZE       0x00004000

__FPU_USED

__FPU_PRESENT

ARM_MATH_CM4

Code jumps to Default_handler after executing some functions composing arm_cfft (fft 16 on a float32_t array). SystemInit runs SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2));

I've also commented the conditional execution of this instruction so it's always executed. fpu mode hard is enabled in compiler. Stepping into/through seems that last instuction is a MOV but i'm not sure and i don't know how to write an handler to identify faults.

Thanks in advance

[Compiler control string]

-mcpu=cortex-m4; -mfpu=fpv4-sp-d16; -mfloat-abi=hard; -mthumb; -Wall; -ffunction-sections; -g; -O0; -DSTM32F407VG; -DSTM32F4XX; -DUSE_STDPERIPH_DRIVER; -D__ASSEMBLY__; -D__FPU_USED; -DARM_MATH_CM4; -I.; 

frankmeyer9
Associate II
Posted on November 11, 2013 at 15:32

How did you include the DSP lib functions ?

Last time I tried, I did not manage to use the precompiled libs, so I pulled the required sources into the project.

It would be helpful if you could pin down the fault location in the source code, possibly with the generated machine instructions.

I've also commented the conditional execution of this instruction so it's always executed. fpu mode hard is enabled in compiler.

 

Floating point initialization seem not to be the culprit, otherwise the code would fault on the first FPU instruction.

And normally, the gcc linker refuses to mix code with different float ABIs. Not having any experience with Coocox here.

Posted on November 11, 2013 at 16:41

Most example I've seen/built use softfp

-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -fno-strict-aliasing -ffunction-sections

ARM_MATH_CM4, ARM_MATH_MATRIX_CHECK, ARM_MATH_ROUNDING, __FPU_PRESENT = 1

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..