Arm Mbed and Pelion Device Management support forum

K64f mac address

Dear People.

on the k64f board (online compiler) I used to be able to set the MAC address
this way:

extern “C” void mbed_mac_address(char *mac){

mac[0] = 0x01;
mac[1] = 0x02;
mac[2] = 0xF7;
mac[3] = 0xF1;
mac[4] = 0x91;
mac[5] = MODULE_ID;
};

this doesn’t work anymore

compiler gives error:
Error: Symbol mbed_mac_address multiply defined (by …/…/build/mbed-os/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/TARGET_FRDM/mbed_overrides.K64F.o and …/…/build/main.K64F.o).

what to do?

Hello Andries,

The following might work. But because I don’t have a K64F I didn’t test it.

#include "mbed.h"
#include "EthernetInterface.h"
#include "fsl_phy.h"
#include "kinetis_emac_config.h"
#include "kinetis_emac.h"

#define MODULE_ID   1    // modify as needed

uint8_t my_macaddr[] = { 0x01, 0x02, 0xF7, 0xF1, 0x91, MODULE_ID };

// Network interface
NetworkInterface *net;

...

int main() {

...

//    net = NetworkInterface::get_default_instance();  // replaced by the following three lines
    static Kinetis_EMAC emac;
    emac.set_hwaddr(my_macaddr);
    net = new  EthernetInterface(emac, OnboardNetworkStack::get_default_instance());

...

Best regards, Zoltan

Hi Zoltan,

thank you for your answer.

I get
Error: Cannot open source input file “kinetis_emac_config.h”: No such file or directory in “main.cpp”, Line: 15, Col: 34

I will try to find it. But maybe you have an idea?

have a nice day, Andries

It compiles smoothly when building with the online compiler and using the latest mbed-os. So I guess you have an older version in your project. Try to update the mbed-os library (right click on the mbed-os gear and select Update ...).

after updating I get now Error: L6636E: Pre-processor step failed for ‘/build/.link_script.sct’

As I remember such error is usually reported when the online compiler is busy. Retry several times. If it still doesn’t work please let me know I can publish the modified tcpsocket-example which compiled fine for me.

Best regards, Zoltan

That would be great.

I found out that updating the mbed-os library gives me headache. I get all kinds of problems all the time.
When I use existing code and update the mbed-os I get all errors by the change from 5.15 to 5.3 etc.
It makes me hate the online enviriment.

OK Andries,

You can find it here. But as I said I has not been tested on a real K64F.

Best regards, Zoltan

Thank you,

the code compiles good. But the real k64f gives error codes on the terminal.
But this helps a lot.

I can continue now I guess.