Determining Free RAM on K60 programmatically

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Determining Free RAM on K60 programmatically

1,026件の閲覧回数
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 返信

839件の閲覧回数
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 件の賞賛
返信