maxgerhardt / platform-raspberrypi

Raspberry Pi: development platform for PlatformIO
Apache License 2.0
94 stars 46 forks source link

Error: undefined reference to - wrap_cyw43_cb_process_ethernet #40

Closed gmrock closed 9 months ago

gmrock commented 9 months ago

I'm trying out platformio with raspberry picow. With simple example, everything works fine.

However, when I start importing external libraries (defined above), I run into compilation error.

Below is the platformio.ini file:

[env:stable]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = pico
framework = arduino
board_build.core = earlephilhower
lib_deps = 
    knolleary/PubSubClient@^2.8
    arcao/Syslog@^2.0.0
    fu-hsi/PMS Library@^1.1.0

includes are:

#include <Arduino.h>

// put function declarations here:
#include "PMS.h"
#include <WiFi.h>
#include <PubSubClient.h>
#include <Syslog.h>
//#include <WiFiClientSecure.h> //thought this was the problem so commented it, but didn't make any difference

Error when compiling:

Processing stable (platform: https://github.com/maxgerhardt/platform-raspberrypi.git; board: pico; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/raspberrypi/pico.html
PLATFORM: Raspberry Pi RP2040 (1.9.0+sha.ffb6889) > Raspberry Pi Pico
HARDWARE: RP2040 133MHz, 264KB RAM, 2MB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, picoprobe, raspberrypi-swd)
PACKAGES: 
 - framework-arduinopico @ 1.30600.0+sha.41b0686 
 - tool-rp2040tools @ 1.0.2 
 - toolchain-rp2040-earlephilhower @ 5.120300.230911 (12.3.0)
Flash size: 2.00MB
Sketch size: 2.00MB
Filesystem size: 0.00MB
Maximium Sketch size: 2093056 EEPROM start: 0x101ff000 Filesystem start: 0x101ff000 Filesystem end: 0x101ff000
...
.
.
/Users/user1/.platformio/packages/toolchain-rp2040-earlephilhower/bin/../lib/gcc/arm-none-eabi/12.3.0/../../../../arm-none-eabi/bin/ld: /Users/user1/.platformio/packages/framework-arduinopico/lib/libpicow-noipv6-nobtc-noble.a(cyw43_ll.c.obj): in function `cyw43_do_ioctl':
/home/earle/src/pico-quick-toolchain/arduino/pico-sdk/lib/cyw43-driver/src/cyw43_ll.c:1203: undefined reference to `__wrap_cyw43_cb_process_ethernet'
collect2: error: ld returned 1 exit status
*** [.pio/build/stable/firmware.elf] Error 1
===================================================================== [FAILED] Took 6.13 seconds =====================================================================

 *  The terminal process "platformio 'run'" terminated with exit code: 1. 
gmrock commented 9 months ago

Seems the issue is seen because of this method:

void establishWifi() {
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
     delay(500);
     Serial.print(".");
     delay(500);
  } 
}

If I comment this method out, the code compiles fine. Any clue what is wrong with wifi connection?

gmrock commented 9 months ago

Seems I have figured out the issue:

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = rpipicow
framework = arduino
board_build.core = earlephilhower
lib_deps = 
    fu-hsi/PMS Library@^1.1.0
    knolleary/PubSubClient@^2.8
    arcao/Syslog@^2.0.0

Had to use the board as board = rpipicow instead of board = pico. Will try and update the findings.

gmrock commented 9 months ago

Closing this issue. The issue was with me setting the board incorrectly (it had to be set as rpipicow). Working platformio.ini:

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = rpipicow
framework = arduino
board_build.core = earlephilhower
lib_deps = 
    fu-hsi/PMS Library@^1.1.0
    knolleary/PubSubClient@^2.8
    arcao/Syslog@^2.0.0

This helped - https://github.com/earlephilhower/arduino-pico/discussions/877