2014-10-02 09:15 AM
The strangest thing is happening.
I do some DSP computation on float arrays with the CMSIS library, especially arm_fir_decimate_f32 on an STM32F407VG. I use CooCox. As my need for RAM grew, I decided to relocate some arrays into the CCM. No big deal, I modified the linker script by adding:.ccm :
{ .= ALING(4); *(.ccm) .= ALIGN(4); } > CCMRAM And I placed a variablefloat32_t workspace_f32[4096];
in the Core Coupled Memory withfloat32_t workspace_f32[4096] __attribute__ ((section (''.ccm'')));
Everything compiles and links nicely, no problem. For the FIR decimation I got 3 float array in the RAM, the input signal, the output signal and the state buffer. I can move the arrays for the state buffer and the input signal to the CCM and everything works as before (except from cycles needed for the computation of course). But when I move output buffer array to the CCM, its contents are complete rubbish and entirely different from what they're supposed to be. How on earth is this possible? Regards, Julian #ccm-dsp-cmsis-m4-stm32f4-coocox2014-10-02 09:27 AM
How on earth is this possible?
With the info presented, I don't know, CCM however does not support DMA or BitBanding2014-10-02 10:37 AM
Where is the output buffer located, in absolute addresses? Don't you overflow the CCM?
JW2014-10-02 10:57 AM
Don't you overflow the CCM?
Probably not with 16KB of floats, but the core would Hard Fault if you went outside the 64KB, and the linker should stop ridiculous static allocations.Review .MAP, and be more specific about exactly what you're seeing, and demonstrate it in a fashion others might be able to replicate.2014-10-03 12:35 AM
Is the CCM memory clock enabled?
RCC AHB1 peripheral clock register (RCC_AHB1ENR) Bit 20 CCMDATARAMEN: CCM data RAM clock enable This bit is set and cleared by software. 0: CCM data RAM clock disabled 1: CCM data RAM clock enabled2014-10-07 01:57 AM
There's no overflow, the array is only 16kB (4096 floats), I also looked into the map file.
Thanks for the tip with the extra clock, totally overlooked that! Does not solve my problem however, but the rubbish I get is different depending on whether CCMDATARAMEN is set or not. I'll post some code here shortly, I just need some time to replicate the error in a small example outside of my entire project.2014-10-07 11:57 PM
> There's no overflow, the array is only 16kB (4096 floats),
Yes, but in your initial post you told us that you have moved two other arrays into the CCM. > I also looked into the map file. Can you please post the relevant portions of it (i.e. the .ccm)? Also, where is stack (and heap, if used) located? JW2014-11-11 08:11 AM
Hey guys, sorry for the delay. I had to work on other stuff.
Thanks for all your comments. When I was going to all of the code again to isolate the problem in a simple example I basicly found a really stupid bug of mine. Some of the memory was not written on, my algorithm just jumped and left a block of memory untouched. So naturally it contained some uninitialized values. It was never a problem in RAM, because apparently there were only zeros in the uninitialized block, but not so in CCM.2014-11-12 12:53 AM
Thanks for letting us know.
This may be a clue for others who tinker with the default linker script. JW