platformio / platform-espressif8266

Espressif 8266: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/espressif8266
Apache License 2.0
332 stars 219 forks source link

ESP-Now library is never included (although present in tools/sdk) #66

Closed PuceBaboon closed 6 years ago

PuceBaboon commented 6 years ago

New, clean installation of 3.4.1 on Ubuntu-Mate 16.04, with espressif8266 1.4.0 and framework-arduinoespressif8266 1.20300.1. Attempting to compile a program with ESP-Now (#include ) fails with:-

Linking .pioenvs/nodemcuv2/firmware.elf
.pioenvs/nodemcuv2/src/espnow-sensor-bme280.ino.o:(.text.setup+0x1c): undefined reference to `esp_now_init()'
.pioenvs/nodemcuv2/src/espnow-sensor-bme280.ino.o:(.text.setup+0x20): undefined reference to `esp_now_set_self_role(unsigned char)'
.pioenvs/nodemcuv2/src/espnow-sensor-bme280.ino.o:(.text.setup+0x24): undefined reference to `esp_now_add_peer(unsigned char*, unsigned char, unsigned char, unsigned char*, unsigned char)'
.pioenvs/nodemcuv2/src/espnow-sensor-bme280.ino.o:(.text.setup+0x28): undefined reference to `esp_now_register_send_cb(void (*)(unsigned char*, unsigned char))'
.pioenvs/nodemcuv2/src/espnow-sensor-bme280.ino.o:(.text.setup+0x2c): undefined reference to `esp_now_send(unsigned char*, unsigned char*, int)'
.pioenvs/nodemcuv2/src/espnow-sensor-bme280.ino.o: In function `setup':
espnow-sensor-bme280.ino.cpp:(.text.setup+0xa6): undefined reference to `esp_now_init()'
espnow-sensor-bme280.ino.cpp:(.text.setup+0xbc): undefined reference to `esp_now_set_self_role(unsigned char)'
espnow-sensor-bme280.ino.cpp:(.text.setup+0xce): undefined reference to `esp_now_add_peer(unsigned char*, unsigned char, unsigned char, unsigned char*, unsigned char)'
espnow-sensor-bme280.ino.cpp:(.text.setup+0xd7): undefined reference to `esp_now_register_send_cb(void (*)(unsigned char*, unsigned char))'
espnow-sensor-bme280.ino.cpp:(.text.setup+0xff): undefined reference to `esp_now_send(unsigned char*, unsigned char*, int)'
collect2: error: ld returned 1 exit status
*** [.pioenvs/nodemcuv2/firmware.elf] Error 1

The libespnow.a library is never referenced or compiled and doesn't appear in the .pioenvs/nodemcu

~/PlatformIO/ESP-Now_Node$ ls .pioenvs/nodemcuv2/FrameworkArduino

abi.o                         core_esp8266_i2s.o         core_esp8266_wiring_analog.o   Esp.o                MD5Builder.o  spiffs_hal.o    Updater.o
base64.o                      core_esp8266_main.o        core_esp8266_wiring_digital.o  FS.o                 pgmspace.o    Stream.o        WMath.o
cbuf.o                        core_esp8266_noniso.o      core_esp8266_wiring.o          HardwareSerial.o     Print.o       StreamString.o  WString.o
cont.o                        core_esp8266_phy.o         core_esp8266_wiring_pulse.o    heap.o               Schedule.o    time.o
cont_util.o                   core_esp8266_postmortem.o  core_esp8266_wiring_pwm.o      IPAddress.o          setjmp.o      Tone.o
core_esp8266_eboot_command.o  core_esp8266_si2c.o        core_esp8266_wiring_shift.o    libb64               spiffs        uart.o
core_esp8266_flash_utils.o    core_esp8266_timer.o       debug.o                        libc_replacements.o  spiffs_api.o  umm_malloc

I've tried (among other things) adding "-lespnow" to the compiler.c.elf.libs line in my ~/.platformio/packages/framework-arduinoespressif8266/platform.txt file, but that didn't make any difference.
PuceBaboon commented 6 years ago

But adding:-

build_flags = -lespnow

...into my platformio.ini -does- work.

Should this not be an automatic linker function for a built-in library??