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.
Thanks!
已解决! 转到解答。
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.
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!!!