AnsweredAssumed Answered

Always display program size

Question asked by Remi Beges Employee on Aug 18, 2015
Latest reply on Aug 20, 2015 by Remi Beges

My program size will it seems overflow heap memory (KL26Z128)

 

c:/freescale/kds_3.0.0/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld.exe: FSFK_KL26Z.elf section `._user_heap_stack' will not fit in region `m_data' c:/freescale/kds_3.0.0/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld.exe: region `m_data' overflowed by 508 bytes

 

I tried modifying in DebugConfiguration the target platform to KL26Z256 to trick the linker in order to print size, but this does not seem to have any impact. I looked at the linker file, and it is still the one for KL26Z128, not 256

 

/* ################################################################### */

/*##

/*##     This component module is generated by Processor Expert. Do not modify it. */

/*##                                   */

/*##     Filename  : ProcessorExpert.ld */

/*##                                   */

/*##     Project   : FSFK_KL26Z        */

/*##                                   */

/*##     Processor : MKL26Z128VLH4     */

/*##                                   */

/*##     Compiler  : GNU C Compiler    */

/*##                                   */

/*##     Date/Time : 2015-08-18, 14:51, # CodeGen: 41 */

/*##                                   */

/*##     Abstract  :                   */

/*##                                   */

/*##     This file is used by the linker. It describes files to be linked, */

/*##     memory ranges, stack size, etc. For detailed description about linker */

/*##     command files see compiler documentation. This file is generated by default. */

/*##     You can switch off generation by setting the property "Generate linker file = no" */

/*##     in the "Build options" tab of the CPU component and then modify this file as needed. */

/*##

/*##                                   */

/*## ###################################################################*/

 

 

 

 

/* Entry Point */

ENTRY(__boot)

 

 

/* Highest address of the user mode stack */

_estack = 0x20003000;    /* end of m_data */

__SP_INIT = _estack;

__stack = _estack;

 

 

/* Generate a link error if heap and stack don't fit into RAM */

__heap_size = 0x00;                    /* required amount of heap  */

__stack_size = 0x0400;                 /* required amount of stack */

 

 

MEMORY {

  m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x000000C0

  m_text      (RX) : ORIGIN = 0x00000410, LENGTH = 0x0001FBF0

  m_data      (RW) : ORIGIN = 0x1FFFF000, LENGTH = 0x00004000

  m_cfmprotrom  (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010

}

How can I change the linker configuration so it can complete the linking and size of the program can then be printed ?

Then, which optimizations can I make to reduce heap memory consumption ?

 

Thanks

Outcomes