getting started with Core2 and stuck.

  • Hi

    I just got my hands on a couple Core 2 which I plan to use on my Mac (Intel Core I9, Monterey 12.6.7) with the Arduino environment - both the IDE Version: 2.1.1 and 1.8.19

    I followed the guidelines I found at to configure my Arduino environment

    When trying to compile a very simple code that does nothing

    void setup() {}
    void loop() {}

    there is no issue, the process works

    but when I try to just add the include for the M5Core2

    #include <M5Core2.h>
    void setup() {}
    void loop() {}

    and try to compile again

    • it first starts OK
    • then I get tons of warnings related to
      missing initializer for member 'GFXfont::smooth_bpp
      warning: missing initializer for member 'GFXfont::range'
    • then it continues
    • then I get more warnings in the RTC code or other modules like
      M5Core2/src/RTC.cpp:221:30: warning: comparison is always true due to limited range of data type
    • then I get a bunch of warning for the fonts such as
      warning: missing initializer for member 'GFXfont::smooth_bpp'
    • and a last one about
      .../M5Core2/src/Fonts/glcdfont.c:10:28: error: 'font' defined but not used [-Werror=unused-const-variable=] static const unsigned char font[] PROGMEM = { ^~~~
      cc1: some warnings being treated as errors

    and then the compilation process ends with
    exit status 1
    Erreur de compilation pour la carte M5Stack-Core2

    I suspect the issue is due to compiler flags as I've seen that report
    cc1: some warnings being treated as errors

    How to solve that ?

    Anyone using Core2 in the Arduino environment should be affected if this is the root cause but I could not find specific complaints about this.

    What did I miss?


  • answering to myself :

    the issue comes from setting the warnings to max level in the IDE's preferences
    short term fix = drop down the level of warnings to default
    long term fix : fix all the files with a warning. most of them are in the font area.

    I find it surprising the libraries were not tested with all warnings on...

  • @jmarduino save yourself trouble of converting your code later and use the M5Unified library, not M5Core2.

  • @notinthemafia thanks for the hint

  • actually just tried and it has similar issues. If you compile some of the examples with all warnings turned on in the IDE, the compiler stops

    error: unused variable 'names' [-Werror=unused-variable]
       static constexpr const char* const names[] = { "none", "wasHold", "wasClicked", "wasPressed", "wasReleased", "wasDeciedCount" };
    cc1plus: some warnings being treated as errors