Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamlibraries/PS3_Controller_Host/src/ps3.c:287:5: error: implicit declaration of function 'esp_base_mac_addr_set' [-Wimplicit-function-declaration]
287 | esp_base_mac_addr_set(base_mac);
esp_base_mac_addr_set()
because the function was deprecated in ESP-IDF v4.x and removed in ESP-IDF v5.x (Arduino-ESP32 core ≥ 2.0.x is based on ESP-IDF v5). PS3_Controller_Host
library was written for an older core (ESP-IDF ≤ v3.3). esp_read_mac()
, esp_efuse_mac_get_default()
, esp_iface_mac_addr_set()
), guarded with version checks, or esp_base_mac_addr_set()
.Key points
• Function removed in recent IDF → implicit declaration error.
• Replace the call or downgrade the core.
• Add the correct header (esp_mac.h
) if you stay on IDF v4.x where the function still exists.
API Evolution
• IDF ≤ v3.3 esp_base_mac_addr_set()
– fully supported.
• IDF v4.x kept but marked “legacy”; new helpers added (esp_efuse_mac_get_default()
).
• IDF v5.0 function deleted; unified MAC API introduced (esp_read_mac()
, esp_write_mac()
, esp_iface_mac_addr_set()
).
What happens in your build
• Arduino-ESP32 core 2.0.x/3.0.x (default for “DevKit V1” since 2023) is based on IDF v5.x.
• The header esp_mac.h
no longer declares the removed symbol, so the compiler reports an “implicit declaration”.
• When you select the older “ESP32 WROOM-32S” board package (likely core 1.0.6, IDF v3.3), the symbol exists and compilation succeeds, hence the observed difference.
Impact on PS3 Controller Host library
• Library uses the old call to load the factory MAC into RAM before creating a Bluetooth host stack.
• On IDF v5.x this must be replaced by a two-step sequence:
uint8_t base_mac[6];
esp_read_mac(base_mac, ESP_MAC_WIFI_STA); // read factory MAC
esp_iface_mac_addr_set(base_mac, ESP_MAC_BT); // re-apply for BT base
• ESP-IDF v5.2 (Q2-2024) continues to remove legacy APIs; new projects must migrate.
• Official Arduino-ESP32 core 3.0.0 (May 2024) is now built on top of IDF v5.2-release.
• Maintainers of game-controller libraries (Bluepad32, ESP32-PS3, NimBLE-Gamepad) have already merged patches that drop esp_base_mac_addr_set()
.
Version-conditional patch you can drop into ps3.c
(around line 287):
#include "esp_mac.h"
static esp_err_t set_bt_base_mac(void)
{
uint8_t base_mac[6];
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) // Arduino-core ≥2.0
ESP_ERROR_CHECK(esp_read_mac(base_mac, ESP_MAC_WIFI_STA));
return esp_iface_mac_addr_set(base_mac, ESP_MAC_BT);
#elif ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0) // legacy but still present
esp_efuse_mac_get_default(base_mac);
return esp_base_mac_addr_set(base_mac);
#else // IDF ≤3.3
return esp_base_mac_addr_set(base_mac);
#endif
}
• esp_read_mac()
fetches the factory-programmed MAC from eFuse.
• esp_iface_mac_addr_set()
(IDF v4.4+) sets the base MAC for a specific interface (ESP_MAC_BT
for Bluetooth).
• Changing MAC addresses can violate device certification or regulatory requirements if done improperly.
• Ensure that modified MACs remain globally unique—never ship devices with duplicate or random public MACs unless you use the locally-administered bit (bit 1 of the first octet).
idf.py --version
(PlatformIO: pio run -v
) to confirm the IDF version pulled in by the core.esptool.py chip_id
to ensure Bluetooth still reports a valid MAC.• Conditional compilation increases maintenance complexity; test on all targeted cores.
• Some PS3 libraries allocate MAC addresses manually for second controller instances—ensure those code paths are also migrated.
• Future IDF versions may deprecate esp_iface_mac_addr_set()
in favour of unified netif APIs; monitor release notes.
• Track Espressif’s “Breaking Changes” section in each IDF release note.
• Examine more modern controller stacks (Bluepad32) for reference MAC-handling patterns.
• Consider moving projects to PlatformIO with a fixed platform = espressif32@~6
entry to lock the IDF version for reproducible builds.
esp_base_mac_addr_set()
disappeared in the ESP-IDF used by the current Arduino-ESP32 core, so the PS3 library fails to compile. Replace the call with the new MAC APIs (esp_read_mac()
+ esp_iface_mac_addr_set()
) under a version guard, or compile with an older core that still carries the legacy function. The patch above restores compatibility across IDF v3.3 – v5.x while keeping your firmware forward-proof.