apache / nuttx-apps

Apache NuttX Apps is a collection of tools, shells, network utilities, libraries, interpreters and can be used with the NuttX RTOS
https://nuttx.apache.org/
Apache License 2.0
268 stars 504 forks source link

Derive MAC Address from board unique_id #2332

Closed Novators closed 5 months ago

Novators commented 5 months ago

Summary

Adds an option to derive a MAC Address from the board's unique_id. Essentially just retrieves the unique_id and performs bit manipulation to ensure it is a valid unicast, locally administered MAC address. This is useful for Ethernet hardware that does not have a built-in MAC address.

Requires BOARDCTL_UNIQUEID. Adds the NETINIT_UIDMAC Kconfig option.

Impact

Allows use of multiple boards on the same network without having to manually configure different MAC addresses for each.

Testing

Enable NETINIT_NOMAC and NETINIT_UIDMAC. Your Ethernet interface should initialize with a unique MAC address based on the board's ID.

Tested on a RP2040 based W5500-EVB-Pico evaluation board and a custom board.