fixed address about MPC5604 platform

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

fixed address about MPC5604 platform

424 Views
朱先生
Contributor III

Hi, expert:

I have two questions about using MPC5604 platform.

Question 1(about volatile):

I  used keyword "volatile" to define a const. The code is shown below:

#pragma push
#pragma section code_type ".user_data"
volatile const uint8 COMBINE_FLAG = 0x1;

#pragma pop

If I only define this const and don't use it. The const will be optimized. The size of the section ".user_data" is 0.

If I use the const, For example:

uint8 read_flag;
read_flag = COMBINE_FLAG;

The const will have address. The size of the section "user_data" is greater than 0.

The Global optimizations is:

pastedImage_1.png

Why the keyword "volatile" and "const" have no effect?

Question 2(about fixed address):

In 9S12 platform, I can figure the fixed address in coding:

const uint8 COMBINE_FLAG @0xEF00;

But the "@" can't be used in MPC5604 platform. When I compile the code with codewarrior, the compiler tell me:

pastedImage_11.png

Besides using "pragma" keyword,  How can I allocate a const in a fixed address?

Thanks.

                                                                                                                           Bryce

                                                                                                                           2017-12-12

Labels (1)
0 Kudos
Reply
0 Replies