machine: read a factory MAC from flash via mac_flash_offset

Adds an optional per-board mac_flash_offset. When non-zero, RTLPlayground
reads a 6-byte MAC from that flash address and uses it if it is a valid
globally-administered unicast address; otherwise it falls back to the
generated locally-administered MAC. Offset 0 (default for every board)
preserves current behaviour.

Enable it for the SWTGW218AS, whose stock firmware keeps the factory MAC
in nvcfg at 0x1FC000. RTLPlayground images and web upgrades only touch
flash below that region, so the factory MAC survives flashing.
This commit is contained in:
bloqaudio
2026-08-11 02:32:31 -05:00
parent 52692d05b1
commit 3853a2701d
3 changed files with 24 additions and 14 deletions
+1
View File
@@ -415,6 +415,7 @@ void machine_custom_init(void) { }
__code const struct machine machine = {
.machine_name = "SWTGW218AS 8+1 Managed Switch",
.isRTL8373 = 1,
.mac_flash_offset = 0x1FC000,
.min_port = 0,
.max_port = 8,
.n_sfp = 1,