Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: new SmartMatrix warnings with Arduino 2.0 or 2.1

  1. #1
    Senior Member
    Join Date
    Jan 2014
    Posts
    223

    new SmartMatrix warnings with Arduino 2.0 or 2.1

    Does anyone have an idea as to how to fix these warnings with latest SmartMatrix and Arduino 2.1.0 ? The code runs fine but the warnings are irritating.

    Warnings are valuable and even with Warning set to "none" they still show up.

    Warnings say: use copy-assignment or copy-initialization but I don't know how to do that

    thanks



    In file included from c:\Arduino2\sketch\libraries\SmartMatrix\src/Layer_Background.h:124,
    from c:\Arduino2\sketch\libraries\SmartMatrix\src/SmartMatrix.h:55,
    from C:\Glo\EvoTrip\Include.h:5,
    from C:\Glo\EvoTrip\EvoTrip.ino:1:
    c:\Arduino2\sketch\libraries\SmartMatrix\src/Layer_Background_Impl.h: In instantiation of 'void SMLayerBackground<RGB, optionFlags>::swapBuffers(bool) [with RGB = rgb24; unsigned int optionFlags = 0]':
    C:\Glo\EvoTrip\platform.h:75:32: required from here
    c:\Arduino2\sketch\libraries\SmartMatrix\src/Layer_Background_Impl.h:974:19: warning: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'struct rgb24' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
    974 | memcpy(backgroundBuffers[1], backgroundBuffers[0], sizeof(RGB) * (this->matrixWidth * this->matrixHeight));
    | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
    In file included from c:\Arduino2\sketch\libraries\SmartMatrix\src/SmartMatrix.h:50,
    from C:\Glo\EvoTrip\Include.h:5,
    from C:\Glo\EvoTrip\EvoTrip.ino:1:
    c:\Arduino2\sketch\libraries\SmartMatrix\src/MatrixCommon.h:139:16: note: 'struct rgb24' declared here
    139 | typedef struct rgb24 {
    | ^~~~~
    In file included from c:\Arduino2\sketch\libraries\SmartMatrix\src/Layer_Background.h:124,
    from c:\Arduino2\sketch\libraries\SmartMatrix\src/SmartMatrix.h:55,
    from C:\Glo\EvoTrip\Include.h:5,
    from C:\Glo\EvoTrip\EvoTrip.ino:1:
    c:\Arduino2\sketch\libraries\SmartMatrix\src/Layer_Background_Impl.h:976:19: warning: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'struct rgb24' with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
    976 | memcpy(backgroundBuffers[0], backgroundBuffers[1], sizeof(RGB) * (this->matrixWidth * this->matrixHeight));
    | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
    In file included from c:\Arduino2\sketch\libraries\SmartMatrix\src/SmartMatrix.h:50,
    from C:\Glo\EvoTrip\Include.h:5,
    from C:\Glo\EvoTrip\EvoTrip.ino:1:
    c:\Arduino2\sketch\libraries\SmartMatrix\src/MatrixCommon.h:139:16: note: 'struct rgb24' declared here
    139 | typedef struct rgb24 {
    | ^~~~~
    In file included from c:\Arduino2\sketch\libraries\SmartMatrix\src/SmartMatrix.h:218,
    from C:\Glo\EvoTrip\Include.h:5,
    from C:\Glo\EvoTrip\EvoTrip.ino:1:
    c:\Arduino2\sketch\libraries\SmartMatrix\src/MatrixTeensy4Hub75Refresh_Impl.h: In instantiation of 'static void SmartMatrixRefreshT4<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::hardwareSetup() [with int refreshDepth = 36; int matrixWidth = 192; int matrixHeight = 64; unsigned char panelType = 2; long unsigned int optionFlags = 0]':
    c:\Arduino2\sketch\libraries\SmartMatrix\src/MatrixTeensy4Hub75Refresh_Impl.h:389:18: required from 'static void SmartMatrixRefreshT4<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::begin() [with int refreshDepth = 36; int matrixWidth = 192; int matrixHeight = 64; unsigned char panelType = 2; long unsigned int optionFlags = 0]'
    c:\Arduino2\sketch\libraries\SmartMatrix\src/MatrixTeensy4Hub75Calc_Impl.h:272:97: required from 'void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::begin() [with int refreshDepth = 36; int matrixWidth = 192; int matrixHeight = 64; unsigned char panelType = 2; long unsigned int optionFlags = 0]'
    C:\Glo\EvoTrip\platform.h:10:17: required from here
    c:\Arduino2\sketch\libraries\SmartMatrix\src/MatrixTeensy4Hub75Refresh_Impl.h:680:88: warning: taking address of packed member of 'SmartMatrixRefreshT4<36, 192, 64, 2, 0>::timerpair' may result in an unaligned pointer value [-Waddress-of-packed-member]
    680 | sourceAddress = (volatile uint32_t*) & (matrixUpdateRows[0].rowbits[0].timerValues.timer_oe);
    | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ ~~~
    In file included from c:\Arduino2\sketch\libraries\SmartMatrix\src/SmartMatrix.h:219,
    from C:\Glo\EvoTrip\Include.h:5,
    from C:\Glo\EvoTrip\EvoTrip.ino:1:
    c:\Arduino2\sketch\libraries\SmartMatrix\src/MatrixTeensy4Hub75Calc_Impl.h: In instantiation of 'static void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::loadMatrixBuffers48(volatile rowDataStruct*, unsigned int) [with int refreshDepth = 36; int matrixWidth = 192; int matrixHeight = 64; unsigned char panelType = 2; long unsigned int optionFlags = 0; SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::rowDataStruct = SmartMatrixRefreshT4<36, 192, 64, 2, 0>::rowDataStruct]':
    c:\Arduino2\sketch\libraries\SmartMatrix\src/MatrixTeensy4Hub75Calc_Impl.h:551:24: required from 'static void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::loadMatrixBuffers(unsigned int) [with int refreshDepth = 36; int matrixWidth = 192; int matrixHeight = 64; unsigned char panelType = 2; long unsigned int optionFlags = 0]'
    c:\Arduino2\sketch\libraries\SmartMatrix\src/MatrixTeensy4Hub75Calc_Impl.h:168:113: required from 'static void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::matrixCalculations(bool) [with int refreshDepth = 36; int matrixWidth = 192; int matrixHeight = 64; unsigned char panelType = 2; long unsigned int optionFlags = 0]'
    c:\Arduino2\sketch\libraries\SmartMatrix\src/MatrixTeensy4Hub75Calc_Impl.h:270:121: required from 'void SmartMatrixHub75Calc<refreshDepth, matrixWidth, matrixHeight, panelType, optionFlags>::begin() [with int refreshDepth = 36; int matrixWidth = 192; int matrixHeight = 64; unsigned char panelType = 2; long unsigned int optionFlags = 0]'
    C:\Glo\EvoTrip\platform.h:10:17: required from here
    c:\Arduino2\sketch\libraries\SmartMatrix\src/MatrixTeensy4Hub75Calc_Impl.h:384:15: warning: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'rgb48' {aka 'struct rgb48'}; use assignment or value-initialization instead [-Wclass-memaccess]
    384 | memset(tempRow0, 0, sizeof(tempRow0));
    | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from c:\Arduino2\sketch\libraries\SmartMatrix\src/SmartMatrix.h:50,
    from C:\Glo\EvoTrip\Include.h:5,
    from C:\Glo\EvoTrip\EvoTrip.ino:1:
    c:\Arduino2\sketch\libraries\SmartMatrix\src/MatrixCommon.h:159:16: note: 'rgb48' {aka 'struct rgb48'} declared here
    159 | typedef struct rgb48 {
    | ^~~~~
    In file included from c:\Arduino2\sketch\libraries\SmartMatrix\src/SmartMatrix.h:219,
    from C:\Glo\EvoTrip\Include.h:5,
    from C:\Glo\EvoTrip\EvoTrip.ino:1:
    c:\Arduino2\sketch\libraries\SmartMatrix\src/MatrixTeensy4Hub75Calc_Impl.h:385:15: warning: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'rgb48' {aka 'struct rgb48'}; use assignment or value-initialization instead [-Wclass-memaccess]
    385 | memset(tempRow1, 0, sizeof(tempRow1));
    | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from c:\Arduino2\sketch\libraries\SmartMatrix\src/SmartMatrix.h:50,
    from C:\Glo\EvoTrip\Include.h:5,
    from C:\Glo\EvoTrip\EvoTrip.ino:1:
    c:\Arduino2\sketch\libraries\SmartMatrix\src/MatrixCommon.h:159:16: note: 'rgb48' {aka 'struct rgb48'} declared here
    159 | typedef struct rgb48 {

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,457
    You get similar warnings using the Arduino 1,8,19 libraries. I posted this over at the smart matrix forum, and I did not get a reply to the thread:

  3. #3
    I just updated the library to fix these compiler warnings. Please download the latest version of the library here and see if it fixes the issue.
    https://github.com/pixelmatix/SmartMatrix

  4. #4
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,457

    Cool

    Quote Originally Posted by easone View Post
    I just updated the library to fix these compiler warnings. Please download the latest version of the library here and see if it fixes the issue.
    https://github.com/pixelmatix/SmartMatrix
    Yes it fixes the issue. I rebuilt my animated 64x64 display on the Teensy 4.1, and it runs fine. You mentioned in an email to me (or posting on the smartmatrix forum):

    However when you install the library through the Arduino library manager, I don't think it is using the latest version.
    And that is indeed true. I did an update of the libraries and it did not show up. I needed to do a git clone to get the sources and copy them to the ~/Arduino/libraries/SmartMatrix directory.

    Thanks for fixing this.

  5. #5
    Thanks for the fix @easone! I’ll do my best to get this merged and released next week.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •