How to define an array of integers at a specific memory address?

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

How to define an array of integers at a specific memory address?

1,276件の閲覧回数
peterzheng
Contributor II

Hi,

 

Currently I am writing a program using CodeWarrior Bareboard project. I need to create an array of integers at a specific memory address in P4080DS.

 

For example. 0x12345678

 

I have tried pointer to array, but it seems not working. Is there a way I can do that?


Regards,

Peter

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

1,056件の閲覧回数
lunminliang
NXP Employee
NXP Employee

Hi,

How about below reply:

How to define an array of integers at a specific memory address in P4080DS?

You may define an array pointer which points to the address directly, but this looks not safe. The address and array length should be available and legal, not used by other code or data, otherwise exception/unexpected behavior.

So consider the way of placing your array into a memory section you define. Something like:

#pragma push

#pragma section [ objecttype | permission ][iname][uname][data_mode=datamode][code_mode=codemode]

__declspec(section <section_name>) definition

#pragma pop

For usage, please refer to Power Arch Build Tools Reference.pdf in CodeWarrior installation folder C:\Freescale\CW_PA_v10.4.0\PA\Help\PDF

24.2.6 __declspec(section name)  and 36.3.2 section


Have a great day,
Lunmin

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信