2012-01-11 02:08 AM
I've spent (too many) hours trying to figure out how to use the CCM for something useful.
And with useful I mean easy access from my code written in C. I use GNU GCC, etc (the Yagarto toolchain). At first I thought that putting some variable, array into a specified section, let's call it .ccm, (and of course the appropriate lines in the linker script) would be the solution. For example: uint8_t test[1024] __attribute__ ((section(''.cmm''))); Well, it works... Kind of... :\ I compiles and links nicely. Checking the memory map/dump of the generated ELF-file I see that the array is located @0x1000 0000 However, producing a binary image produces a LARGE 100+MB file. Doing a hex-file makes it smaller but will not load into ST-Link Utility (file too large to fit, it says) Now... That's probably due to the gap between 0x1000 FFFF and 0x2000 0000 The part in the linker script is something like (under the SECTIONS part) .ccm : { .= ALING(4); *(.ccm) .= ALIGN(4); } >CCMRAM And CCM is defined under MEMORY as CCRAM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K Also tried to use NOLOAD to make it NOBITS instead of PROGBITS but it still takes up space in the binary or hex-file. Removing the section with objcopy and --remove-section .ccm does nothing to help either. Isn't there anyway of makeing your own section behave like the .bss section and not taking space in the image? I hope I make sense with my problem/question. Best regards // J�rgen #stm32-stm32f4-ccm-linker-section #gcc-linker-ccm2016-02-04 10:39 AM
He is saying a completely different story. He says that the assign instruction doesn't change the content of CCM[0] location. Initialization doesn't play a role here. It's obviously that he also needs init routines for .data and .bss somewhere, but if the memory location doesn't change when he does an assign, then the linker is placing that variable elsewhere in SRAM.
2016-02-04 10:43 AM
So what? Linker is do anything what he want? NOT POSSIBLE.
This variable is propably removed by linker so value in CCRAM will not changed.2016-02-05 01:33 AM
I don't have semihosting on, but following your thoughts, I did a read after assigning the value, and it read back the value I had written. So it looks like is actually working, and that it's the memory browser/debugger that can't read CCM or something. Thanks for the idea!
2016-02-05 02:07 AM
Just to be sure that it's placed in CCM, you can also declare a pointer fixed to 0x10000000 location and check if the content matches.
2016-02-05 03:21 AM
Wow. Better solution is to creater pointer to this variable and check it is fits to CCRAM region.