Determining Free RAM on K60 programmatically

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

Determining Free RAM on K60 programmatically

670 Views
mon3al
Contributor I

I'm using the K60. How to I programmatically determine the amount of free ram? (on ColdFire processors I used __RAM_BARSIZE, __RAMBAR)

Labels (1)
0 Kudos
Reply
1 Reply

483 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Scot,

You can add those label to a Kinetis linker file (.ld).

In the linker file you will see the RAM memory segments

m_data     (rwx) : ORIGIN = 0x1FFF0000, LENGTH = 64K    /* Lower SRAM */

m_data2    (rwx) : ORIGIN = 0x20000000, LENGTH = 64K    /* Upper SRAM */

Then you can declare the labels:

_LOWER_RAMBAR = 0x1FFF0000;

_UPPER_RAMBAR = 0x20000000;

_LOWER_RAMSIZE = 64K;

_UPPER_RAMSIZE = 64K;

After this you can substract the size of the RAM from the size to get the amount of free RAM:

_FREE_LOWER_RAM_SIZE = _LOWER_RAMSIZE - SIZEOF(.data)

_FREE_UPPER_RAM_SIZE = _UPPER_RAMSIZE - SIZEOF(.user_data2);

Finally to get the address where the free RAM starts.

_LOWER_FREE_RAM_START = _LOWER_RAMBAR + _FREE_LOWER_RAM_SIZE;

_UPPER_FREE_RAM_START = _UPPER_RAMBAR + _FREE_UPPER_RAM_SIZE;

Hope this helps!

Carlos

0 Kudos
Reply