cancel
Showing results for 
Search instead for 
Did you mean: 

CCM section & ''section `.bss' will not fit in region `ram'''

arro239
Associate III
Posted on April 18, 2014 at 04:12

My fields do not fit in the primary RAM region so I am trying to put some of the fields into CCM but something is not going right.

My .ld file is

https://svn.code.sf.net/p/rusefi/code/trunk/firmware/config/system/STM32F407xG_CCM.ld

I am using CodeSourcery and I am declaring the field like

static char pendingBuffer[OUTPUT_BUFFER] __attribute__((section(''.ccm'')));

it works like that, but once I change it to

static char pendingBuffer[10000 + OUTPUT_BUFFER] __attribute__((section(''.ccm'')));

I get an error message

c:/program files (x86)/codesourcery/sourcery_codebench_lite_for_arm_eabi/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/bin/ld.exe: rusefi.elf section `.bss' will not fit in region `ram'
c:/program files (x86)/codesourcery/sourcery_codebench_lite_for_arm_eabi/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/bin/ld.exe: region `ram' overflowed by 6408 bytes

But why 'ram' and not 'ccmram'? Because 'bss' goes into 'ram'? I know that the attribute does something, because all the fields with ccm attribute are not appearing in my .map file.

https://svn.code.sf.net/p/rusefi/code/trunk/firmware_binary/rusefi.map

So, what do I do wrong, what should I be doing to get into the ccm memory region? Why the fields with ccm attribues are not in the .map file is a different question. My makefile and the code are available at

https://svn.code.sf.net/p/rusefi/code/trunk/firmware/

4 REPLIES 4
Posted on April 18, 2014 at 05:22

Put

        *(.ccm)

        *(.ccm.*)

In the .ccm section of the linker script

Are you using Ethernet/USB? If not why not describe the whole 128KB RAM area instead to breaking it into two?
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
arro239
Associate III
Posted on April 18, 2014 at 12:10

I've added these lines into the .ccm section and it now builds! Thank you for the advice

The fields with the ccm attribute are not appearing in the .map file, is that expected behavior - how do I get them in to the .map? Also I've got a message

ld.exe: warning: section `.ccm' type changed to PROGBITS

not sure if it's good or bad
Posted on April 18, 2014 at 13:51

You'd want to be careful about if the structures you put there are initialized, as then you'd need to put a copy in flash, and managing that.

Might want to consider

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Adding%20an%20uninitialized%20data%20section%20to%20a%20GCC%20build&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F...

or AT directives

I think there is a ''>CCM >FLASH'' method too, ie data goes to CCM but lives initially in FLASH and is copied out by the startup code. I'm more used to doing this in Keil than GNU/GCC, the latter typically having explicit code to clear/copy static data structures or ctors (constructors in C++)

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
arro239
Associate III
Posted on April 28, 2014 at 18:29

Thank you for the ''AT > flash'' hint, I will look into that.

I still have that issue that my  __attribute__((section(''.ccm''))) fields are not appearing in the .map file as the other fields are. Any idea what this is about? Unless it's related to the lack of ''AT > flash''