Determining Free RAM on K60 programmatically

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Determining Free RAM on K60 programmatically

1,034 次查看
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)

标签 (1)
0 项奖励
回复
1 回复

847 次查看
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 项奖励
回复