Replies: 2 comments
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Aha - was not aware of that limitation!
Thank-you!
…On Thu, Sep 19, 2024 at 3:13 PM Earle F. Philhower, III < ***@***.***> wrote:
memcpy is illegal/undefined when the source and destination overlap. Use
memmove.
https://man7.org/linux/man-pages/man3/memcpy.3.html
—
Reply to this email directly, view it on GitHub
<#2482 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APD3HIJG6BYSAHVETMHZOHDZXMO4FAVCNFSM6AAAAABOQR5JDOVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANRZG4YTGOA>
.
You are receiving this because you authored the thread.Message ID:
<earlephilhower/arduino-pico/repo-discussions/2482/comments/10697138@
github.com>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Having an issue with memcpy on a Pico W in Arduino with Earl's core that is most puzzling (Arduino 1.8...)
memcpy appears to put the array value at the end of the segement to copy into ALL the memory locations
Code to reproduce:
uint8_t test[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 0};
// Shift the last nine bytes one byte left.
memcpy(test, test + 1, 9);
// memcpy is putting the last value in all the array elements ??? !!!
for ( uint8_t i = 0; i < (11); i++)
{
Serial.print(test[i]);
Serial.print(" ");
}
Serial.println();
I'm anything but an expert and may be overlooking something totally basic, but the same code runs fine on a Teensy and does what you'd expect.
Any insights would be most appreciated!
Beta Was this translation helpful? Give feedback.
All reactions