Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memcpy_P conflict with Arduino libraries #60

Open
n9wxu opened this issue Jul 7, 2020 · 1 comment
Open

memcpy_P conflict with Arduino libraries #60

n9wxu opened this issue Jul 7, 2020 · 1 comment

Comments

@n9wxu
Copy link

n9wxu commented Jul 7, 2020

The library is sensitive to the include sequence.

The following two errors are creating a problem with compiling on [email protected]

.platformio\packages\framework-arduinoststm32\cores\arduino/avr/pgmspace.h:48: warning: "memcpy_P" redefined
48 | #define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
|
In file included from .pio\libdeps\nucleo_l073rz\Crypto_ID1168\RNG.cpp:27:
.pio\libdeps\nucleo_l073rz\Crypto_ID1168\utility/ProgMemUtil.h:49: note: this is the location of the previous definition
49 | #define memcpy_P(d,s,l) memcpy((d), (s), (l))
|

I added a #undef in my header file that uses the crypto to remove the memcpy_P after the use of crypto is complete.

@n9wxu
Copy link
Author

n9wxu commented Jul 7, 2020

More information:

My "fix" does not fix anything. the real problem is found in RNG.cpp

The code below comes from line 23-31 of RNG.cpp.
The ProgMemUtil.h brings in an instance of memcpy_P and Arduino.h overrides it creating a conflict.

#include "RNG.h"
#include "NoiseSource.h"
#include "ChaCha.h"
#include "Crypto.h"
#include "utility/ProgMemUtil.h"
#include <Arduino.h>
#if defined (__arm__) && defined (__SAM3X8E__)
// The Arduino Due does not have any EEPROM natively on the main chip.
// However, it does have a TRNG and flash memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant