Reserve and use RAM region to store application data on K60

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

Reserve and use RAM region to store application data on K60

1,264件の閲覧回数
nikhilsarnaik
Contributor III

Hi,

I am using K60DN512 with MQX 3.8.1 for a project. I want to log runtime errors of my code and send the logfile over when requested or at the startup of application.I want to store the logs in the RAM reserved section, and read it at runtime of the application. Has anyone tried that before. Any pointers how to modify the linker file to reserve RAM space would be really helpful.

PS:  I know MQX has the log module but do not want to use the log module because I presume the logs wont be persistent after power cycle.

Thanks Nikhil

ラベル(1)
0 件の賞賛
返信
1 返信

1,088件の閲覧回数
nikhilsarnaik
Contributor III

Hello all,

I found the answer in the IAR documentation. Hope it would be helpful to someone in future

RESERVING SPACE IN RAM

Often, an application must have an empty uninitialized memory area to be used for

temporary storage, for example a heap or a stack. It is easiest to achieve this at link time.

You must create a block with a specified size and then place it in a memory.

In the linker configuration file, it can look like this:

define block TempStorage with size = 0x1000, alignment = 4 { };

place in RAM { block TempStorage };

To retrieve the start of the allocated memory from the application, the source code could

look like this:

/* Define a section for temporary storage. */

#pragma section = "TEMPSTORAGE"

char *GetTempStorageStartAddress()

{

/* Return start address of section TEMPSTORAGE. */

return __section_begin("TEMPSTORAGE");

}

0 件の賞賛
返信