K22 : Why the two 64kB RAMs are managed separately ?

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

K22 : Why the two 64kB RAMs are managed separately ?

688 Views
NicolasP
Contributor IV

Hi,

I use MCUXpresso V10.1.1_606.

I have created a project for a K22FN512 microcontroller.

I have a problem with the location of .bss and .data sections.

With default linker script file, SRAM_LOWER is never filled with any object since only .data_RAM2 and .bss_RAM2 refer to it (I don't use USB in this project).

I can modify this behaviour but I have a question : Can I declare both SRAMs (SRAM_LOWER and SRAM_UPPER) as a single memory area in the linker script file ?

I ask this because the .bss section of my project is more than 64kB.

Best regards,

Nicolas

0 Kudos
2 Replies

395 Views
BlackNight
NXP Employee
NXP Employee

Hi Nicolas,

the reason is that Kinetis K has two memory controllers, one for each memory area. That way the memories are really separate, even if just one after the other. So you cannot have objects crossing that memory boundary (you will get a hard fault), unless you known exactly what you are doing. There is a long discussion on that subject in this article: FreeRTOS Heap with Segmented Kinetis K SRAM | MCU on Eclipse 

In a nutshell: you really have two blocks of memory you have to keep separate, and not a single memory area. That's why it is separate in the linker file.

I hope this helps,

Erich

395 Views
NicolasP
Contributor IV

Hi Erich,

Thanks for your answer. The link you provide is interesting.

I'll modify my link scrip and my source code to suit my needs.

Best regards,

Nicolas

0 Kudos