Skip to content

Compiling problem - Is 3.0.0.alpha2 more fussy about the source code configuration? #8765

Closed
@dagnall53

Description

@dagnall53

Board

ESP32 dev module

Device Description

Problem is Compilation errors seen in Programming using Arduino 2.2.1
Using 3.0.0 Alpha2
** NOTE- Code was compiling with 2.0.13 and 2.0.14**

"Arduino ESP32 Boards 2.0.13 and M5Stack2.0.7 were simultaneously installed - but removing these "boards" from the Arduino IDE made no difference to the compilation errors.*

Code is for a code complex, but physically simple, data multiplexer with optocouplers.
The code is written as multiple (historical) .ino to separate "functions".. and not as a single ino with libraries + / .h/.cpp.
I am concerned that this may be compounding the problems. But rewriting in .cpp/.h format is impractical for now.

Hardware Configuration

Optocouplers on inputs - but I think that is irrelevant to this issue.

Version

latest master (checkout manually)

IDE Name

2.2.1

Operating System

win10

Flash frequency

80Mhz

PSRAM enabled

no

Upload speed

115200

Description

**Code that originally compiled now presents (A LOT) of NEW compile errors.

I can probably sort out what is happening if I can initially solve the two first compilation errors-

  • First is an invalid conversion - that used to work! - the referenced "OnDataRecv" is a void defined in another ino that is part of the overall sketch..
  • Second is a declaration that also used to work..**

C:\Users\admin\Documents\Arduino\NMEA3\NMEA3.ino: In function 'void Start_ESP_EXT()': C:\Users\admin\Documents\Arduino\NMEA3\NMEA3.ino:506:28: error: invalid conversion from 'void (*)(const uint8_t*, const uint8_t*, int)' {aka 'void (*)(const unsigned char*, const unsigned char*, int)'} to 'esp_now_recv_cb_t' {aka 'void (*)(const esp_now_recv_info*, const unsigned char*, int)'} [-fpermissive] 506 | esp_now_register_recv_cb(OnDataRecv); | ^~~~~~~~~~ | | | void (*)(const uint8_t*, const uint8_t*, int) {aka void (*)(const unsigned char*, const unsigned char*, int)} In file included from C:\Users\admin\Documents\Arduino\NMEA3\NMEA3.ino:74: C:\Users\admin\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-6b1f40b9bf/esp32/include/esp_wifi/include/esp_now.h:156:54: note: initializing argument 1 of 'esp_err_t esp_now_register_recv_cb(esp_now_recv_cb_t)' 156 | esp_err_t esp_now_register_recv_cb(esp_now_recv_cb_t cb); | ~~~~~~~~~~~~~~~~~~^~ C:\Users\admin\Documents\Arduino\NMEA3\NMEA3.ino: In function 'void Self_Test()': C:\Users\admin\Documents\Arduino\NMEA3\NMEA3.ino:2021:3: error: 'gpio_matrix_out' was not declared in this scope 2021 | gpio_matrix_out(TX_PIN_3, 0x100, false, false); | ^~~~~~~~~~~~~~~

To me this indicates some change in naming between 2.0.14 and 3.0.0alpha2 ?

Sketch

Relevant part of the code for the first compile error: 
**In NMEA3.ino** 
void Start_ESP_EXT() {
  Serial2.println("Setting ESP-NOW");
  memcpy(peerInfo.peer_addr, peerAddress, 6);
  peerInfo.encrypt = false;  
  peerInfo.channel = 0;     // why the comment?
  if (esp_now_init() == ESP_OK) {
    EspNowIsRunning = true;
    Serial2.println("   ESP-NOW Init Success");
  } else {
    EspNowIsRunning = false;
    Serial2.println("   ESP-NOW Init Failed");
  }
  esp_now_register_recv_cb(OnDataRecv);
  if (esp_now_add_peer(&peerInfo) == ESP_OK) {
    Serial2.println("   Success to add peer");
  } else {
    Serial2.println("   Failed to add peer");
  }
  Serial2.print("   Mac Address: "); Serial2.println(WiFi.macAddress());
  Serial2.flush();
}

**in Multiplexer.ino**
void OnDataRecv(const uint8_t* mac, const uint8_t* incomingData, int len) {
  EspNowIsRunning = true;
  memcpy(&nmea_X, incomingData, sizeof(nmea_X));
  line_X = true;  // or 1 ?
}

Debug Message

***FULL COMPILER ERROR MESSAGE:*** 
C:\Users\admin\Documents\Arduino\NMEA3\NMEA3.ino: In function 'void Start_ESP_EXT()':
C:\Users\admin\Documents\Arduino\NMEA3\NMEA3.ino:506:28: error: invalid conversion from 'void (*)(const uint8_t*, const uint8_t*, int)' {aka 'void (*)(const unsigned char*, const unsigned char*, int)'} to 'esp_now_recv_cb_t' {aka 'void (*)(const esp_now_recv_info*, const unsigned char*, int)'} [-fpermissive]
  506 |   esp_now_register_recv_cb(OnDataRecv);
      |                            ^~~~~~~~~~
      |                            |
      |                            void (*)(const uint8_t*, const uint8_t*, int) {aka void (*)(const unsigned char*, const unsigned char*, int)}
In file included from C:\Users\admin\Documents\Arduino\NMEA3\NMEA3.ino:74:
C:\Users\admin\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-6b1f40b9bf/esp32/include/esp_wifi/include/esp_now.h:156:54: note:   initializing argument 1 of 'esp_err_t esp_now_register_recv_cb(esp_now_recv_cb_t)'
  156 | esp_err_t esp_now_register_recv_cb(esp_now_recv_cb_t cb);
      |                                    ~~~~~~~~~~~~~~~~~~^~
C:\Users\admin\Documents\Arduino\NMEA3\NMEA3.ino: In function 'void Self_Test()':
C:\Users\admin\Documents\Arduino\NMEA3\NMEA3.ino:2021:3: error: 'gpio_matrix_out' was not declared in this scope
 2021 |   gpio_matrix_out(TX_PIN_3, 0x100, false, false);
      |   ^~~~~~~~~~~~~~~
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino: In function 'void Serial_ST_begin()':
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino:23:18: warning: using value of simple assignment with 'volatile'-qualified left operand is deprecated [-Wvolatile]
   23 |   inPos = outPos = 0;
      |           ~~~~~~~^~~
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino:34:25: error: too many arguments to function 'hw_timer_t* timerBegin(uint32_t)'
   34 |     timer_1 = timerBegin(1, 8, true);
      |               ~~~~~~~~~~^~~~~~~~~~~~
In file included from C:\Users\admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0-alpha2\cores\esp32/esp32-hal.h:84,
                 from C:\Users\admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0-alpha2\cores\esp32/Arduino.h:36,
                 from C:\Users\admin\AppData\Local\Temp\arduino\sketches\52A51A574AD31FD882089F12854ACBA3\sketch\NMEA3.ino.cpp:1:
C:\Users\admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0-alpha2\cores\esp32/esp32-hal-timer.h:35:14: note: declared here
   35 | hw_timer_t * timerBegin(uint32_t frequency);
      |              ^~~~~~~~~~
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino:36:25: error: too many arguments to function 'void timerAttachInterrupt(hw_timer_t*, void (*)())'
   36 |     timerAttachInterrupt(timer_1, &onRxTimer, true);
      |     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0-alpha2\cores\esp32/esp32-hal-timer.h:50:6: note: declared here
   50 | void timerAttachInterrupt(hw_timer_t * timer, void (*userFunc)(void));
      |      ^~~~~~~~~~~~~~~~~~~~
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino:39:3: error: 'timerAlarmWrite' was not declared in this scope; did you mean 'timerWrite'?
   39 |   timerAlarmWrite(timer_1, ini_time, true);
      |   ^~~~~~~~~~~~~~~
      |   timerWrite
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino:40:3: error: 'timerAlarmEnable' was not declared in this scope; did you mean 'timerAlarm'?
   40 |   timerAlarmEnable(timer_1);
      |   ^~~~~~~~~~~~~~~~
      |   timerAlarm
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino: At global scope:
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino:44:21: warning: ignoring attribute 'section (".iram1.2")' because it conflicts with previous 'section (".iram1.0")' [-Wattributes]
   44 | void IRAM_ATTR onRx() {
      |                     ^
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino:14:16: note: previous declaration here
   14 | void IRAM_ATTR onRx();
      |                ^~~~
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino: In function 'void onRx()':
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino:49:3: error: 'timerAlarmWrite' was not declared in this scope; did you mean 'timerWrite'?
   49 |   timerAlarmWrite(timer_1, ini_time, true);  // set delay to miss start bit and get half way into first bit
      |   ^~~~~~~~~~~~~~~
      |   timerWrite
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino:50:3: error: 'timerAlarmEnable' was not declared in this scope; did you mean 'timerAlarm'?
   50 |   timerAlarmEnable(timer_1);
      |   ^~~~~~~~~~~~~~~~
      |   timerAlarm
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino: At global scope:
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino:54:26: warning: ignoring attribute 'section (".iram1.3")' because it conflicts with previous 'section (".iram1.1")' [-Wattributes]
   54 | void IRAM_ATTR onRxTimer() {
      |                          ^
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino:15:16: note: previous declaration here
   15 | void IRAM_ATTR onRxTimer();
      |                ^~~~~~~~~
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino: In function 'void onRxTimer()':
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino:58:5: error: 'timerAlarmWrite' was not declared in this scope; did you mean 'timerWrite'?
   58 |     timerAlarmWrite(timer_1, bit_time, true);
      |     ^~~~~~~~~~~~~~~
      |     timerWrite
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino:65:5: error: 'timerAlarmWrite' was not declared in this scope; did you mean 'timerWrite'?
   65 |     timerAlarmWrite(timer_1, end_time, true);
      |     ^~~~~~~~~~~~~~~
      |     timerWrite
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino:79:5: error: 'timerAlarmWrite' was not declared in this scope; did you mean 'timerWrite'?
   79 |     timerAlarmWrite(timer_1, ini_time, true);
      |     ^~~~~~~~~~~~~~~
      |     timerWrite
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino:86:10: warning: compound assignment with 'volatile'-qualified left operand is deprecated [-Wvolatile]
   86 |   rxByte >>= 1;
      |   ~~~~~~~^~~~~
C:\Users\admin\Documents\Arduino\NMEA3\RX_UART_ST.ino:87:24: warning: compound assignment with 'volatile'-qualified left operand is deprecated [-Wvolatile]
   87 |   if (SignIn) { rxByte |= 0x80; }
      |                 ~~~~~~~^~~~~~~
C:\Users\admin\Documents\Arduino\NMEA3\TX_UART_ST.ino: In function 'void Output_ST_begin()':
C:\Users\admin\Documents\Arduino\NMEA3\TX_UART_ST.ino:30:20: warning: using value of simple assignment with 'volatile'-qualified left operand is deprecated [-Wvolatile]
   30 |     inBuf = outBuf = 0;
      |             ~~~~~~~^~~
C:\Users\admin\Documents\Arduino\NMEA3\TX_UART_ST.ino:32:25: error: too many arguments to function 'hw_timer_t* timerBegin(uint32_t)'
   32 |     timer_0 = timerBegin(0, 8, true);
      |               ~~~~~~~~~~^~~~~~~~~~~~
C:\Users\admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0-alpha2\cores\esp32/esp32-hal-timer.h:35:14: note: declared here
   35 | hw_timer_t * timerBegin(uint32_t frequency);
      |              ^~~~~~~~~~
C:\Users\admin\Documents\Arduino\NMEA3\TX_UART_ST.ino:33:25: error: too many arguments to function 'void timerAttachInterrupt(hw_timer_t*, void (*)())'
   33 |     timerAttachInterrupt(timer_0, &onTimer_0, true);
      |     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0-alpha2\cores\esp32/esp32-hal-timer.h:50:6: note: declared here
   50 | void timerAttachInterrupt(hw_timer_t * timer, void (*userFunc)(void));
      |      ^~~~~~~~~~~~~~~~~~~~
C:\Users\admin\Documents\Arduino\NMEA3\TX_UART_ST.ino:34:5: error: 'timerAlarmWrite' was not declared in this scope; did you mean 'timerWrite'?
   34 |     timerAlarmWrite(timer_0, 10000000.0 / 4800, true);   // does not change so can be set at Setup
      |     ^~~~~~~~~~~~~~~
      |     timerWrite
C:\Users\admin\Documents\Arduino\NMEA3\TX_UART_ST.ino:41:3: error: 'timerAlarmEnable' was not declared in this scope; did you mean 'timerAlarm'?
   41 |   timerAlarmEnable(timer_0);
      |   ^~~~~~~~~~~~~~~~
      |   timerAlarm
C:\Users\admin\Documents\Arduino\NMEA3\TX_UART_ST.ino: At global scope:
C:\Users\admin\Documents\Arduino\NMEA3\TX_UART_ST.ino:45:26: warning: ignoring attribute 'section (".iram1.5")' because it conflicts with previous 'section (".iram1.4")' [-Wattributes]
   45 | void IRAM_ATTR onTimer_0() {
      |                          ^
C:\Users\admin\Documents\Arduino\NMEA3\TX_UART_ST.ino:21:16: note: previous declaration here
   21 | void IRAM_ATTR onTimer_0();        // this obliges the onTimer_0() to be placed on RAM by the compiler
      |                ^~~~~~~~~

exit status 1

Compilation error: invalid conversion from 'void (*)(const uint8_t*, const uint8_t*, int)' {aka 'void (*)(const unsigned char*, const unsigned char*, int)'} to 'esp_now_recv_cb_t' {aka 'void (*)(const esp_now_recv_info*, const unsigned char*, int)'} [-fpermissive]

      |                                    ~~~~~~~~~~~~~~~~~~^~

Other Steps to Reproduce

Compiles OK with 2.0.13 and 2.0.14.
But presents these errors with 3.0.0.alpha2 (alpha1 not tested)
I suspected perhaps that the compiler could not find OnDataRecv, which is defined in a secondary .ino in the same folder,
So I added
extern void OnDataRecv(const uint8_t* mac, const uint8_t* incomingData, int len);
before the void Start_ESP_EXT() definition.. but the compile error remains.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.0 migrationissue relates to migration from 2.X to 3.X versionType: QuestionOnly question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions