AnsweredAssumed Answered

How to increase stack size on MK22FX512AVLQ12

Question asked by Alexander Farley on May 29, 2017
Latest reply on Jul 10, 2017 by Alexander Farley

Environment: KDS 3.2.0, MK22FX512AVLQ12 MCU, using Processor Expert


I'm hitting a stack overflow using a MK22FX512AVLQ12 device. I'm having trouble using the full amount of SRAM indicated in the datasheet.


From the datasheet for MK22FX512AVLQ12, this device should have 128kb SRAM but I'm getting linker errors when I attempt to set stack and heap to 0x0800 each:

c:/freescale/kds_v3/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld.exe: [xxxx].elf section `._user_heap_stack' will not fit in region `m_data'
c:/freescale/kds_v3/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld.exe: region `m_data' overflowed by 1844 bytes


Any idea why this would be? 0x0800 = 2048 = 2kb so there should be plenty of room to spare. 


My linker file is attached for reference. 



Update: I was able to fix the issue by disabling the "generate linker file" option and setting the start of m_data to 0x1FFF0000. I'm interested to know why PE won't let me adjust this variable in the options for the Cpu component. It gives an error: "ERROR: There is no access to memory from 0x1FFF0000 to 0x1FFF7FFF". This seems to be wrong since the program executes correctly using this configuration. 

Original Attachment has been moved to: