AnsweredAssumed Answered

Understanding the STM32F4 Linker Script for GCC?

Question asked by Terence D on Jan 18, 2018
Latest reply on Jan 18, 2018 by Clive One

I have an STM32F429 dev board.  I've been playing around with the GCC version of the STemWin example that comes with the STM32CubeF4 package.  I've tweaked the Hello World example to do something entirely different - making some animated graphics appear on the STM32F429 LCD screen. 


I'm now trying to use the GUI_MEMDEV_ functions.  In order to create a MEMDEV of the entire LCD screen I need to increase the size of the GUI_NUMBYTES #define in GUIConf.c.  When doing so, I get the following GCC linker error:


STM32F429I_DISCO_MB1075.elf section `.bss' will not fit in region `RAM'


So, I understand I need to increase the size of the BSS section.  This is where I run into problems.  I understand bits and pieces of the linker script but I'm far from being an expert.


For example, the linker script has the following at the top:


RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192K
CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 2048K


It's my understanding I need to increase the size of the RAM section.  However, I'm not sure if this is possible.  My understanding is the STM32F429 has 256K of RAM.  However, I'm guessing that the 64K of CCMRAM plus the 192K of regular RAM equals all 256K of the RAM available???


Does the CCMRAM section contribute to the BSS?  Can I get rid of the CCMRAM section and just make the RAM section 256K?  If I do lengthen the RAM memory section to 256K do I need to change the origin value?  I'm guessing the RAM ranges up from the origin, right?  Meaning that it ranges from 0x20000000 to 0x20030000, right?


What a lot of this seems to come down to is my lack of understanding the GCC linker script specification.  Googling is not turning up much helpful info.  Anyone know where I can find documentation on this?