Skip to content

Compilation fails with recent Wire.h changes #5287

Closed
@mcspr

Description

@mcspr

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: Any
  • Core Version: cb05b86
  • Development Env: Arduino IDE / Makefile
  • Operating System: Linux

Settings in IDE

  • Module: Generic ESP8266 Module
  • Flash Mode: dio
  • Flash Size: 4MB
  • lwip Variant: v2 Lower Memory
  • Reset Method: nodemcu
  • Flash Frequency: 40Mhz
  • CPU Frequency: 80Mhz
  • Upload Using: SERIAL
  • Upload Speed: 115200

Problem Description

Commit bfcbd71 from #5226 changed twi_attachSlaveRxEvent argument signature from ..., int to ..., size_t and now when Wire.h is included compilation fails.

Looking at arduino-avr variant, cores/esp8266/twi.h and cores/esp866/core_esp8266_si2c.c seems to be in the wrong here and 'numBytes' should be int instead of size_t

void TwoWire::onReceiveService(uint8_t* inBytes, int numBytes)

void twi_attachSlaveRxEvent( void (*)(uint8_t*, size_t) );

twi_attachSlaveRxEvent(onReceiveService);

MCVE Sketch

#include <Arduino.h>
#include <Wire.h> // <---

void setup() {}

void loop() {}

Debug Messages

/home/builder/arduino-1.8.7/hardware/esp8266com/esp8266/libraries/Wire/Wire.cpp: In member function 'void TwoWire::begin(uint8_t)':
/home/builder/arduino-1.8.7/hardware/esp8266com/esp8266/libraries/Wire/Wire.cpp:84:42: error: invalid conversion from 'void (*)(uint8_t*, int) {aka void (*)(unsigned char*, int)}' to 'void (*)(uint8_t*, size_t) {aka void (*)(unsigned char*, unsigned int)}' [-fpermissive]
   twi_attachSlaveRxEvent(onReceiveService);
                                          ^
In file included from /home/builder/arduino-1.8.7/hardware/esp8266com/esp8266/libraries/Wire/Wire.cpp:31:0:
/home/builder/arduino-1.8.7/hardware/esp8266com/esp8266/cores/esp8266/twi.h:51:6: error:   initializing argument 1 of 'void twi_attachSlaveRxEvent(void (*)(uint8_t*, size_t))' [-fpermissive]
 void twi_attachSlaveRxEvent( void (*)(uint8_t*, size_t) );
      ^
===info ||| Using library {0} at version {1} in folder: {2} {3} ||| [Wire 1.0 %2Fhome%2Fbuilder%2Farduino-1.8.7%2Fhardware%2Fesp8266com%2Fesp8266%2Flibraries%2FWire ]
exit status 1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions