mpc5744 facing a memmove function bug

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

mpc5744 facing a memmove function bug

跳至解决方案
1,239 次查看
zhaoning
Contributor II

Hi NXP experts,

Recently we are using mpc5744 with S32 Design Studio for Power Architecture Version 2017.R1 to compile the project. Now we are facing a memmove function problem.

The project in the attachment is modified based on "hello world" and can reproduce the issue we encountered. We defined a 40-byte array of type U8 as the data source, used 0x4001268e as the data destination, called the memmove function to copy data, but found that the last 6 bytes of the destination data were not copied correctly. Upon analyzing the standard C code, we discovered that the issue might be related to the macro replacement of deref_auto_inc in __copy_long_mem.c. The memmove.o included in libc99.a should have enabled #define deref_auto_inc(p) *++(p), but it was incorrectly enabled as #define deref_auto_inc(p) *(p)++. We want to confirm if this issue is caused by a bug in the default lib library provided by s32DS or an default method we have usd.

zhaoning_0-1712998982707.png

zhaoning_1-1712998990493.png

zhaoning_2-1712999027531.png

zhaoning_3-1712999034247.pngzhaoning_4-1712999116916.png

zhaoning_5-1712999183536.png

 

 

Thanks!

0 项奖励
回复
1 解答
1,029 次查看
jiri_kral
NXP Employee
NXP Employee

Hi, 

right click on project name -> Properties -> C/C++ Build -> Settings:


jiri_kral_0-1713760849005.png

 

在原帖中查看解决方案

0 项奖励
回复
8 回复数
1,108 次查看
jiri_kral
NXP Employee
NXP Employee

Hi, 

I can reproduce the issue and can confirm that it is a bug in EWL C standard C library. Thanks for report! 

 

Unfortunately S32DS for PA v2017.R1 is no more maintained and the bug will not be fixed for this S32DS version. 

This bug is already fixed in S32DS for PA v2.1 and you can use this S32DS version.  

 

If you need to use S32DS PA v2017 - you have couple options. You can Switch STD C library from EWL C to NewLIB in project properties. 

Other possibility is use memcpy instead of memmove, memcpy works as expected.  

0 项奖励
回复
1,041 次查看
zhaoning
Contributor II

Hi,

Can you tell me how can I switch STD C library from EWL C to NewLIB in project properties? Can you show me the process? Maybe some screenshots can be showed.

0 项奖励
回复
1,030 次查看
jiri_kral
NXP Employee
NXP Employee

Hi, 

right click on project name -> Properties -> C/C++ Build -> Settings:


jiri_kral_0-1713760849005.png

 

0 项奖励
回复
1,154 次查看
zhaoning
Contributor II

Can someone reply my problem?  It's really urgent.

0 项奖励
回复
1,186 次查看
zhaoning
Contributor II

We also found in the map file that the memmove function is not compiled from the C source code but rather uses library functions from libc99.a. This means that we cannot solve this problem by modifying the C source code, is that correct? How should we go about resolving this issue then?

We are in urgent need of your help.

Thanks!!! 

zhaoning_0-1713145143097.png

 

0 项奖励
回复
1,232 次查看
zhaoning
Contributor II

Project is attached, the problem is very urgent, please reply soon. 

0 项奖励
回复
1,134 次查看
zhaoning
Contributor II

Can someone test this project? We would like to know if the issue is due to our incorrect usage or if memmove function itself has a bug in S32DS?

We are eagerly awaiting your response.

0 项奖励
回复
1,110 次查看
jiri_kral
NXP Employee
NXP Employee

Hi, 

I'm looking at you project right now, I'll be back later today with more info. 

0 项奖励
回复