Page 1 of 1

ESP32 on 1.8.5

Posted: Mon Oct 09, 2017 10:32 am
by IngmarGuillaume
The MegunolinkPro library does not compile on the ESP32 with latest Arduino version 1.8.5.
It is related to uninitialized pointers and variables, something the ESP32 compiler does not really like. Attached is the bottom part of the log file. Errors are at the bottom (as always, ;-) ).

I tried to post this is a bug, but I did not get confirmation it was sent. So trying again via the forum.


=================================================================
Arduino: 1.8.5 (Windows 10), Board: "SparkFun ESP32 Thing, 80MHz, 921600"

"C:\Users\ingma\AppData\Local\Temp\arduino_build_326767\libraries\MegunoLinkPro\utility\CommandDispatcherBase.cpp.o"
In file included from C:\Program Files (x86)\Arduino\libraries\MegunoLinkPro\utility\CommandDispatcherBase.cpp:1:0:

C:\Program Files (x86)\Arduino\libraries\MegunoLinkPro\utility\CommandDispatcherBase.h: In constructor 'MLP::CommandDispatcherBase::CommandDispatcherBase(MLP::CommandCallback*, uint8_t, MLP::VariableMap*, uint8_t)':

C:\Program Files (x86)\Arduino\libraries\MegunoLinkPro\utility\CommandDispatcherBase.h:26:19: error: 'MLP::CommandDispatcherBase::m_uMaxCommands' will be initialized after [-Werror=reorder]

const uint8_t m_uMaxCommands;

^

C:\Program Files (x86)\Arduino\libraries\MegunoLinkPro\utility\CommandDispatcherBase.h:25:28: error: 'MLP::CommandCallback* const MLP::CommandDispatcherBase::m_pCommands' [-Werror=reorder]

CommandCallback *const m_pCommands;

^

C:\Program Files (x86)\Arduino\libraries\MegunoLinkPro\utility\CommandDispatcherBase.cpp:7:1: error: when initialized here [-Werror=reorder]

CommandDispatcherBase::CommandDispatcherBase( CommandCallback *pCallbackBuffer, uint8_t uCallbackBufferLength, VariableMap *pVariableMapBuffer, uint8_t uVariableMapLength)

^

In file included from C:\Program Files (x86)\Arduino\libraries\MegunoLinkPro\utility\CommandDispatcherBase.cpp:1:0:

C:\Program Files (x86)\Arduino\libraries\MegunoLinkPro\utility\CommandDispatcherBase.h:30:19: error: 'MLP::CommandDispatcherBase::m_uMaxVariables' will be initialized after [-Werror=reorder]

const uint8_t m_uMaxVariables;

^

C:\Program Files (x86)\Arduino\libraries\MegunoLinkPro\utility\CommandDispatcherBase.h:29:24: error: 'MLP::VariableMap* const MLP::CommandDispatcherBase::m_pVariableMap' [-Werror=reorder]

VariableMap *const m_pVariableMap;

^

C:\Program Files (x86)\Arduino\libraries\MegunoLinkPro\utility\CommandDispatcherBase.cpp:7:1: error: when initialized here [-Werror=reorder]

CommandDispatcherBase::CommandDispatcherBase( CommandCallback *pCallbackBuffer, uint8_t uCallbackBufferLength, VariableMap *pVariableMapBuffer, uint8_t uVariableMapLength)

^

cc1plus.exe: some warnings being treated as errors

Using library arduinoFFT at version 1.2.3 in folder: C:\Program Files (x86)\Arduino\libraries\arduinoFFT
Using library MegunoLinkPro at version 1.9 in folder: C:\Program Files (x86)\Arduino\libraries\MegunoLinkPro
exit status 1
Error compiling for board SparkFun ESP32 Thing.

Re: ESP32 on 1.8.5

Posted: Tue Oct 10, 2017 12:52 am
by philr
Hi, I have been playing with the esp32 lately and it seems to be working for me. I am using the latest files from github and 1.8.2 of the IDE (although I dont expect it to change with 1.8.5 (ill download now and test)). How did you go about installing the esp32 library files?

Cheers
Phil

Re: ESP32 on 1.8.5

Posted: Tue Oct 10, 2017 12:59 am
by philr
Yep seems fine with 1.8.5 when compiling this example
https://github.com/Megunolink/MLP/blob/ ... meters.ino

Does that one build for you? I followed these instructions to get the ESP32 library files
https://github.com/espressif/arduino-es ... windows.md

Cheers
Phil

Re: ESP32 on 1.8.5

Posted: Tue Oct 10, 2017 1:04 pm
by IngmarGuillaume
Thx for coming back on this, philr,

but nope, it does not compile (same type of errors). My version of the Expressif compiler is exactly the same one as yours. I will try an uninstall and re-install in a bit. Post the results here.

Re: ESP32 on 1.8.5

Posted: Tue Oct 10, 2017 1:36 pm
by IngmarGuillaume
Reinstalled the entire ESP32 git repository. ESP32 examples compile OK, only the Megunolink does not compile (see previous errors).
Errors remain the same.

Re: ESP32 on 1.8.5

Posted: Wed Oct 11, 2017 1:18 am
by philr
Hmm its a bit of a mystery. Can you turn on verbose compiler output and we can compare the compilation steps. Preferences->show verbose output during->compilation.

In the attachment there is a text file with my output. Maybe you can do the same and we try to identify what's different.
ESP32 Compiler Output - SetParameters Example.zip
(6.25 KiB) Downloaded 581 times

Re: ESP32 on 1.8.5

Posted: Wed Oct 11, 2017 8:00 am
by IngmarGuillaume
Found the solution last night. It has actually little to do with the Megunolink (albeit that is has everything to do with it, riddles, riddles).

If you set "Compiler warnings" to "All in the Arduino preferences, certain errors (among which those concerning order of variable initialization), cause an actual error, because it is bad coding practice to not declare the variables in order of usage.

I never have had this problem with any library, but apparently this one does cause this error.

The solution was to set the "compiler warnings" to "default".

Thx for the help.

Re: ESP32 on 1.8.5

Posted: Wed Oct 25, 2017 2:17 am
by philr
Nice catch!