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

cancel
Showing results for 
Search instead for 
Did you mean: 

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

279 Views
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

Labels (1)
0 Kudos
2 Replies

105 Views
lunminliang
NXP Employee
NXP Employee

Hi,

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 Kudos

105 Views
peterzheng
Contributor II

Hi Lunmin,

Thank you for your reply. Actually when I created 8 projects in CodeWarrior, the program for each core in P4080DS write to their own LAW. Each core will automatically write to its LAW and hence its CPC ways. For example, the program in core0 wrote to the first LAW I created, the program in core1 wrote to the second LAW I created.

I am not sure how did this happened? Is this automatically set by CodeWarrior?

Regards,

Peter

0 Kudos