I’ve now moved to the K66 processor and now I get the error:
Error: Symbol mbed_mac_address multiply defined (by …/…/build/mbed-os/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/TARGET_FRDM/mbed_overrides.K66F.o and …/…/build/main.K66F.o).
// Hidden callback from mbed
// https://os.mbed.com/questions/87591/How-to-change-MAC-address-of-non-LPC1768/
// To make things worst it's not even the same call for all platforms.
uint8_t mbed_otp_mac_address(char *mac) {
memcpy(mac, Settings::get_eth_mac_address(), 6);
return 1;
}
I had to look into the target hal code to figure it out. Try to look for weak symbols. EthernetInterface::set_mac_address simply doesn’t work for STM32. It might work on your platform.
They really should fix this mac address issue, having different ways to set your mac address is quite anoying.
As far as I can tell from grep mbed_otp_mac_address is used by STM and NXP targets I couldn’t find it in TARGET_Freescale folder. It might be something similar but named differently.
Looking into mbed-os/connectivity/drivers/emac/TARGET_Freescale_EMAC/kinetis_emac.cpp I think that this platform has the EthernetInterface::set_mac_address implemented (unlike mine which doesn’t work). Could you try this and see if it works?
Ah, i’m using OS 6.5, have never used 5 before. Might want to check the *_emac.cpp file in your os folder and see if there are references to mac or macaddress to give a clue.