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()
no longer exists in the ESP-IDF version that ships with the current Arduino-ESP32 core (≥ v2.x, based on ESP-IDF v5). esp_read_mac()
, esp_iface_mac_addr_set()
, etc.). Key points
esp_base_mac_addr_set()
is deprecated (v4) and removed (v5).esp_read_mac()
or esp_efuse_mac_get_default()
, then set per-interface MACs with esp_iface_mac_addr_set()
.Error mechanics
The C compiler emits “implicit declaration …” when it does not find a prototype. In current ESP-IDF headers (v5.x) the symbol simply is not defined.
API evolution
• ≤ ESP-IDF v3.3:
esp_err_t esp_base_mac_addr_set(const uint8_t *mac);
set a 48-bit “base MAC”; Wi-Fi, BT, Ethernet derived interface MACs were calculated from it.
• ESP-IDF v4.x: Function kept but tagged LEGACY; header moved to esp_mac.h
.
• ESP-IDF v5.x: Function removed. MAC management redesigned; each interface gets its MAC explicitly (or from eFuse) via
esp_err_t esp_read_mac(uint8_t *mac, esp_mac_type_t type);
esp_err_t esp_iface_mac_addr_set(const uint8_t *mac, esp_mac_type_t type);
Library behaviour
PS3_Controller_Host needs to spoof the Bluetooth MAC so a Sixaxis/DS3 recognises the host as a real PS3. In old code this was done with esp_base_mac_addr_set()
. With modern IDF you must set the BT interface MAC before the BT controller is started, using the new API sequence.
Environment mismatch
• Older board (“ESP32-32S”) compiled with Arduino-ESP32 1.0.x → ESP-IDF 3.3 → OK.
• New DevKit V1 compiled with Arduino-ESP32 2.0/3.0 → ESP-IDF 5 → symbol gone → build fails.
ps3-esp32
fork by mbs38) are being updated to remove esp_base_mac_addr_set()
; watch the relevant GitHub issues/PRs.Example patch for ps3.c
(minimal, keeps spoofing logic):
#include "esp_mac.h" // new header for MAC functions
#include "esp_bt.h" // BT controller API
static void ps3_custom_mac_init(void)
{
uint8_t base_mac[6] = {0x00, 0x19, 0xC1, 0xA0, 0x00, 0x01}; // example PS3 MAC
#if ESP_IDF_VERSION_MAJOR >= 5
// --- new IDF path ---
// Must be called before esp_bt_controller_init()
esp_err_t err = esp_iface_mac_addr_set(base_mac, ESP_MAC_BT);
if (err != ESP_OK) {
ESP_LOGE("PS3", "Failed to set BT MAC (err 0x%x)", err);
}
#else
// --- legacy path ---
esp_base_mac_addr_set(base_mac);
#endif
}
Usage: call ps3_custom_mac_init()
before esp_bt_controller_init()
or btStart()
inside the library.
Downgrading core (Arduino IDE):
Implementation checklist for the modern API:
esp_mac.h
.ESP_MAC_BT
for PS3). esp_iface_mac_addr_set()
before any BT stack initialisation. ESP_LOG
for BT MAC
confirmation.Potential challenges & mitigations:
esp_bt_controller_disable()
first. esp_iface_mac_addr_set()
again; always check release notes. esp_hidh
for PS4/PS5 controller support. Your build fails because the PS3 controller library still calls the legacy esp_base_mac_addr_set()
, removed from the ESP-IDF version bundled with today’s Arduino-ESP32 boards.
Either (A) modernise the library with the new per-interface MAC APIs (esp_read_mac()
, esp_iface_mac_addr_set()
), or (B) roll back to Arduino-ESP32 1.0.6 / ESP-IDF 3.3. Updating the library is strongly recommended for long-term maintenance and security.