Data corruption in MC56F84763

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

Data corruption in MC56F84763

1,578件の閲覧回数
sumanbhandari
Contributor II

Hi All,

 

I m using MC56F84763 with CodeWarrior for MCU,  Version: 10.6,  Build Id:140329.

The code is written in C.

I observe simple checks failing erroneously and when i verify it in debug mode it show checks like if(3 != 3) returning true !!

For example

if(Value != CONSTANT)

{

     Statement1;

}

else

{

     Statement2;

}

where Value and CONSTANT will show same value in debug mode watch window but still the if check with return true and execute Statement1.

Is there any specific compiler settings to fix this?

 

Regards,

Suman

ラベル(1)
4 返答(返信)

1,284件の閲覧回数
sumanbhandari
Contributor II

Hi All,

I have further update.

I referred to the linker file generated by the PE tool and copied the RAM and flash mapping to my linker file. The if check then started passing correctly.

I m still observing data corruption but at random places on runtime.

Attached is the linker file that i used earlier when if check was incorrectly failing.

I m still not sure if the linker file generated is correct. Is there any documentation available on code and data segment and mapping them in the linker file?

0 件の賞賛
返信

1,284件の閲覧回数
ankur_kala
NXP Employee
NXP Employee

Hi Suman,

the thing that needs to be taken care of is that the RAM must be used in such a manner that the initial section of the RAM is preferably used for copying the data section from the ROM and remaining memory be used for runtime. In this case the runtime changes do not change/overwrite the constants. If required you can also create two different sections of RAM, one for constant data and the other for runtime. however the disadvantage of such a approach would be that if data section is not fully utilised we would be losing out on the RAM allocated for data as it cant be used at runtime. similarly if the data section grows beyond the defined boundaries, again the approach would fail. Hence a dynamic allocation is always useful.

Regards,

Ankur

0 件の賞賛
返信

1,284件の閲覧回数
TICS_Fiona
NXP Employee
NXP Employee

I use the attached simple project to test , but cannot reproduce the problem.  What are the data type of ‘Value’ and ‘CONSTANT’? Please use the same data type for them, or use type cast so convert the data type of one operand.

If this does not help, please attach a simple project to help us reproduce the problem. Thanks!

Fiona Kuang

Technical Information & Commercial Support

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

1,284件の閲覧回数
sumanbhandari
Contributor II

Thanks for the reply.

The datatype of both Value and CONSTANT is unsigned char.


What I have observed is when my project was small such errors did not occur.

When the project size increased such errors in if loops started occuring especially in the ISRs.

Please let me know if there is any other data I can provide.

I am not using PE. Could that give memory issues??

0 件の賞賛
返信