Can _user_heap_stack be moved to m_data_20000000 section?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can _user_heap_stack be moved to m_data_20000000 section?

Jump to solution
2,243 Views
mike1974
Contributor III

I'm using MK22 with 128k of RAM.  As noted in the reference manual, the memory is split into two 64k sections, SRAM upper and SRAM lower, with middle boundary at 0x20000000.

 

I have  _user_heap_stack set to 32k... but it's too big to fit in the m_data section (SRAM lower).  So I would like it to move to m_data_20000000 (SRAM upper).

 

I don't see an option for this in Processor Expert's component inspector (CPU --> Build Options --> Generate Linker).  It only allows me to change the size of the heap, not which section in RAM.

 

Another option someone suggested, is to disable m_data_20000000 section entirely, and bump up the size of m_data to use the full 128k (instead of half).  But the reference manual says you cannot do burst reads across that boundary, and others have posted saying misaligned reads/writes don't work across the boundary either.  I don't know if this would cause problems for me, but I'd rather not risk it.

 

Any help would be appreciated,

 

Thanks

 

Mike

Labels (1)
1 Solution
1,552 Views
TICS_Fiona
NXP Employee
NXP Employee

You can use the upper SRAM for .bss only and lower SRAM the others data. But this needs user to modify the link command file manually, and disable the option ‘Generate linker file’ in CPUcomponent’s build option. 

Fiona Kuang

Technical Information & Commercial Support

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
4 Replies
1,552 Views
mike1974
Contributor III

By the way here is the linker error...

c:/freescale/kds_2.0.0/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.0/../../../../arm-none-eabi/bin/ld.exe: M2.elf section `._user_heap_stack' will not fit in region `m_data'

c:/freescale/kds_2.0.0/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.0/../../../../arm-none-eabi/bin/ld.exe: region `m_data' overflowed by 10872 bytes

0 Kudos
1,553 Views
TICS_Fiona
NXP Employee
NXP Employee

You can use the upper SRAM for .bss only and lower SRAM the others data. But this needs user to modify the link command file manually, and disable the option ‘Generate linker file’ in CPUcomponent’s build option. 

Fiona Kuang

Technical Information & Commercial Support

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,552 Views
davidtietz
Contributor III

Can you all provide more detail on how this is manually done in the linker file?

0 Kudos
1,552 Views
davidtietz
Contributor III

I think I got it figured out.

This document helped a lot:

http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4367.pdf

0 Kudos