Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 task done
dagnall53 opened this issue Oct 14, 2023 · 12 comments
Closed
1 task done
Labels
3.0 migration issue relates to migration from 2.X to 3.X version Type: Question Only question

Comments

@dagnall53
Copy link

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.
@dagnall53 dagnall53 added the Status: Awaiting triage Issue is waiting for triage label Oct 14, 2023
@Jason2866
Copy link
Collaborator

Arduino core 3.0.0 is a major release change. So there are (breaking) changes.

@Jason2866 Jason2866 added Type: Question Only question and removed Status: Awaiting triage Issue is waiting for triage labels Oct 15, 2023
@dagnall53
Copy link
Author

dagnall53 commented Oct 15, 2023 via email

@Jason2866
Copy link
Collaborator

@dagnall53 Not the compiler. Code changes needed since some APIs has changed.

@lbernstone
Copy link
Contributor

There are breaking changes, and there are likely still bugs where upstream APIs have changed. This is why it is marked as an alpha release. There will be a migration document for 3.0.0 in the release.

@dagnall53
Copy link
Author

dagnall53 commented Oct 15, 2023

@Jason2866 and @lbernstone Thanks.. !!
SO, should I assume that (e.g.) the API concerned with the esp_now_register_recv_cb (and a whole load of ohers?) will need to be updated for V3.xx. ?? _
I will leave that for better programers and just stick to V2 for now!

@lbernstone
Copy link
Contributor

Depends on whether you want to be a guinea pig. It all needs testing, and noting that espnow has an issue will help the developers pin that down. Change the issue title to reflect that so it can get tagged properly.

@dagnall53
Copy link
Author

dagnall53 commented Oct 15, 2023 via email

@me-no-dev
Copy link
Member

Not only Arduino APIs have changed, but many of the ESP-IDF ones too (like ESP-NOW in your case). As @lbernstone said, 3.0.0 is coming with many changes in the APIs facing the users and also internally under the hood.

@dagnall53
Copy link
Author

@me-no-dev Thank your for looking at my comment!.
In response to @lbernstone and @Jason2866 , I will note that the Alpha2 version appears to have exposed issues with the following: I will attempt to be more precise in a future Issue post, but will close this now..
esp_now.h, (esp_now_register_recv_cb possibly defined in a different way to how V3 expects it?)
gpio.h ( issue with void gpio_matrix_in(uint32_t gpio, uint32_t signal_idx, bool inv); ?)
esp32-hal-timer.h (Seems to have different definitions of timerBegin , timerAlarmWrite timerAlarmEnable ?)

@NGL3324
Copy link

NGL3324 commented Dec 22, 2023

Latest Arduino Version: 2.2.1 / Date: 2023-08-31T14:35:44.802Z / CLI Version: 0.34.0 updated boards like I have done dozens of times before, but this time automatically installed the V3.0.0 alpha3 rather than the stable release V2 - 14. The preferences file Additional Boards Manager URL had been updated to the dev_index.json version NOT by me (the index.json has been there for years). Weird? This thread shows V3 has issues with esp_now.h, - see dagnall53 who mentioned this issue on Oct 16 (esp_now_register_recv_cb possibly defined in a different way to how V3 expects it?). Confirming the V3 update broke all code written calling ESP_NOW.h specifically at the esp_now_register_recv_cb parameter point with the 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]
492 | esp_now_register_recv_cb(OnDataRecv);

About 3,000 lines so cannot provide code. Went to uninstall V3, but Arduino Version: 2.2.1 only provided visibility to updates up to 2.0.11, not the latest stable release .14 - code resumed working on .11 anyway so leaving it be.
version

@me-no-dev
Copy link
Member

@NLoebel the problem is that you did not add the proper board manager json. Check our docs and you will get to see the versions. You are currently installing the core from Arduino.cc which works only with Arduino nano32 board

@NGL3324
Copy link

NGL3324 commented Dec 22, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.0 migration issue relates to migration from 2.X to 3.X version Type: Question Only question
Projects
None yet
Development

No branches or pull requests

6 participants