Open PhilColbert opened 4 years ago
What would be the most straightforward way? I am trying to follow this with little luck so far. I could build arduino-esp32 as a component, but not FastLED so far.
https://github.com/espressif/arduino-esp32/blob/idf-release/v4.0/docs/esp-idf_component.md
After adding a add_definitions(-DESP32)
on the top CmakeLists.txt file and no other changes, here is where I'm at :
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In copy constructor 'CHSVPalette16::CHSVPalette16(const CHSVPalette16&)':
../components/arduino/libraries/FastLED/colorutils.h:455:69: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CHSV' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs.entries[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:23:8: note: 'struct CHSV' declared here
struct CHSV {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In member function 'CHSVPalette16& CHSVPalette16::operator=(const CHSVPalette16&)':
../components/arduino/libraries/FastLED/colorutils.h:459:69: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CHSV' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs.entries[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:23:8: note: 'struct CHSV' declared here
struct CHSV {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In copy constructor 'CHSVPalette256::CHSVPalette256(const CHSVPalette256&)':
../components/arduino/libraries/FastLED/colorutils.h:558:69: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CHSV' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs.entries[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:23:8: note: 'struct CHSV' declared here
struct CHSV {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In member function 'CHSVPalette256& CHSVPalette256::operator=(const CHSVPalette256&)':
../components/arduino/libraries/FastLED/colorutils.h:562:69: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CHSV' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs.entries[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:23:8: note: 'struct CHSV' declared here
struct CHSV {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In copy constructor 'CRGBPalette16::CRGBPalette16(const CRGBPalette16&)':
../components/arduino/libraries/FastLED/colorutils.h:663:69: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CRGB' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs.entries[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:102:8: note: 'struct CRGB' declared here
struct CRGB {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In constructor 'CRGBPalette16::CRGBPalette16(const CRGB*)':
../components/arduino/libraries/FastLED/colorutils.h:667:61: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CRGB' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:102:8: note: 'struct CRGB' declared here
struct CRGB {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In member function 'CRGBPalette16& CRGBPalette16::operator=(const CRGBPalette16&)':
../components/arduino/libraries/FastLED/colorutils.h:671:69: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CRGB' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs.entries[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:102:8: note: 'struct CRGB' declared here
struct CRGB {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In member function 'CRGBPalette16& CRGBPalette16::operator=(const CRGB*)':
../components/arduino/libraries/FastLED/colorutils.h:676:61: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CRGB' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:102:8: note: 'struct CRGB' declared here
struct CRGB {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In copy constructor 'CHSVPalette32::CHSVPalette32(const CHSVPalette32&)':
../components/arduino/libraries/FastLED/colorutils.h:931:69: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CHSV' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs.entries[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:23:8: note: 'struct CHSV' declared here
struct CHSV {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In member function 'CHSVPalette32& CHSVPalette32::operator=(const CHSVPalette32&)':
../components/arduino/libraries/FastLED/colorutils.h:935:69: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CHSV' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs.entries[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:23:8: note: 'struct CHSV' declared here
struct CHSV {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In copy constructor 'CRGBPalette32::CRGBPalette32(const CRGBPalette32&)':
../components/arduino/libraries/FastLED/colorutils.h:1037:69: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CRGB' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs.entries[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:102:8: note: 'struct CRGB' declared here
struct CRGB {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In constructor 'CRGBPalette32::CRGBPalette32(const CRGB*)':
../components/arduino/libraries/FastLED/colorutils.h:1041:61: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CRGB' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:102:8: note: 'struct CRGB' declared here
struct CRGB {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In member function 'CRGBPalette32& CRGBPalette32::operator=(const CRGBPalette32&)':
../components/arduino/libraries/FastLED/colorutils.h:1045:69: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CRGB' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs.entries[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:102:8: note: 'struct CRGB' declared here
struct CRGB {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In member function 'CRGBPalette32& CRGBPalette32::operator=(const CRGB*)':
../components/arduino/libraries/FastLED/colorutils.h:1050:61: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CRGB' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:102:8: note: 'struct CRGB' declared here
struct CRGB {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In copy constructor 'CRGBPalette256::CRGBPalette256(const CRGBPalette256&)':
../components/arduino/libraries/FastLED/colorutils.h:1325:69: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CRGB' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs.entries[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:102:8: note: 'struct CRGB' declared here
struct CRGB {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In constructor 'CRGBPalette256::CRGBPalette256(const CRGB*)':
../components/arduino/libraries/FastLED/colorutils.h:1329:61: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CRGB' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:102:8: note: 'struct CRGB' declared here
struct CRGB {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In member function 'CRGBPalette256& CRGBPalette256::operator=(const CRGBPalette256&)':
../components/arduino/libraries/FastLED/colorutils.h:1333:69: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CRGB' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs.entries[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:102:8: note: 'struct CRGB' declared here
struct CRGB {
^~~~
In file included from ../components/arduino/libraries/FastLED/FastLED.h:58,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/colorutils.h: In member function 'CRGBPalette256& CRGBPalette256::operator=(const CRGB*)':
../components/arduino/libraries/FastLED/colorutils.h:1338:61: error: 'void* memmove(void*, const void*, size_t)' writing to an object of type 'struct CRGB' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess]
memmove8( &(entries[0]), &(rhs[0]), sizeof( entries));
^
In file included from ../components/arduino/libraries/FastLED/controller.h:9,
from ../components/arduino/libraries/FastLED/FastLED.h:47,
from ../components/arduino/libraries/FastLED/FastLED.cpp:2:
../components/arduino/libraries/FastLED/pixeltypes.h:102:8: note: 'struct CRGB' declared here
struct CRGB {
^~~~
memmove signature from stdlib is
void * memmove ( void * destination, const void * source, size_t num );
So, casting all the pointers to (void*), I believe, is an appropriate, if not optimal solution to the problem, i.e.
memmove8( &(entries[0]), &(rhs.entries[0]), sizeof( entries));
to
memmove8( (void *) &(entries[0]), (void *) &(rhs.entries[0]), sizeof( entries));
etc.
This builds without complaints. I'd love to do a pull request but I have no way to test this with all the platforms, is there a recommended way to proceed?
Hey, I do, and it works, and I've published it. This is not using Arduino, but simply pulling the code over and defining things correctly.
There's a little hacking going on ( my platform defines aren't in the right places, and I haven't yet debugged to see if I'm using the RMT devices as planned ), but it blinks LEDs properly. This is with the rel4.0 version of esp-idf ( not master, although I think it would probably work ).
Please see my repo at: https://github.com/bbulkow/FastLED-idf
The compile issue with the memmove is actually best done by not using memmove in c++ to copy objects. It's better to do a loop and the object copies, IMHO. While the optimization of memmove was right for older compilers and older systems, I don't think it's appropriate for gcc8, which is why they "banned" it with warning that, with -Wall, turns into an error. I think that's a better solution than a type cast. I would say that checking the GCC version and doing a straight copy instead of a memmove might be the right choice. Once notices slightly later in the code that loops are used in a similar case instead of a memmove hack.
I'll be doing some performance tests, haven't yet. Expect it's pretty good.
Is there somewhere else I could announce my repo? I don't have a reddit account anymore.
There is an issue with the rmt driver. See https://github.com/espressif/esp-idf/issues/4583 and https://github.com/bbulkow/FastLED-idf/pull/2.
I've opened #990 which removes these warning from all uses of memmove in user code and other usage that requires CRGB
and CHSV
to be trivially copyable (other discussion was at #985). It removes the need to cast every memmove
in user code to void *
when you don't want to have the warnings.
As stated in the pr this could use some performance testing, I've done some testing but I don't know if my tests are any good.
I was able to get FastLED v3.3.1 running on esp-idf v4.0 using @5chmidti's 1550a94 commit. I did run into the rmt init issue on esp-idf v4.1 but v4.0 seems to be working great for this library, granted I'm only running noise plus palette. Thanks!
Anyone got fastled running on the latest esp32 code ?
Thanks