From e0ddbf7a09fdf8277a64f27b484c3642e32d7a99 Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 22 Jan 2025 20:50:16 +0100 Subject: fw: Implement print out of MAC address This validates that a hardware MAC address is available on the chip. Based on that it can be decided if a MAC EEPROM should be added to the PCB. --- fw/src/main.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'fw/src/main.c') diff --git a/fw/src/main.c b/fw/src/main.c index 31dbf45..a21e6d7 100644 --- a/fw/src/main.c +++ b/fw/src/main.c @@ -1,4 +1,35 @@ +#include +#include + +LOG_MODULE_REGISTER(main); + int main(void) { + LOG_INF("Function main was started."); + + struct net_if *iface = net_if_get_default(); + if (iface == NULL) { + LOG_ERR("Could not find default network interface."); + goto FINISH; + } + LOG_DBG("Got default network interface pointer 0x%p", (void *)iface); + + struct net_linkaddr *link_addr = net_if_get_link_addr(iface); + if (iface == NULL) { + LOG_ERR("Could not determine link address of default network interface."); + goto FINISH; + } + LOG_INF( + "Got link address of default network interface: %02x:%02x:%02x:%02x:%02x:%02x", + link_addr->addr[0], + link_addr->addr[1], + link_addr->addr[2], + link_addr->addr[3], + link_addr->addr[4], + link_addr->addr[5] + ); + +FINISH: + LOG_INF("Function main was finished."); return 0; } -- cgit v1.2.3-70-g09d2