|1.0.01|Sep 2020Jul 2021|First public release[[BELK/BXELK software components#BELK 4.1.4|4.1.4]]|BELK update 4.1.4
|}
== Introduction ==
Every network adapter has a Media Access Control address (usually shortened to MAC address). A MAC address is a six-byte identifying number permanently embedded in the firmware of the adapter, and is readable by the network and the operating system of the device on which the adapter is installed.
The address must follow the standards set by the [https://standards.ieee.org/products-services/regauth/index.html Institute of Electrical and Electronics Engineers (IEEE)], which sets computer networking standards.
The MAC address is a six-pair set of hexadecimal numbers, for example <code>a1-c2-e3-44-5f-6d</code>. The purpose of the MAC address is to uniquely identify every node; every adapter has a unique MAC address.
=== Permanent storage areas ===
Some SOCs provide programmable OTPs for security, MAC address, boot modes, etc. Usually, some of these are general-purpose registers and can be managed by the user.
In other cases, an external permanent storage device can be used for storing permanent settings like the MAC address: for the Bora/BoraX product family, DAVE proposes to use the OTP block on NOR SPI flash for storing permanently ConfigID, UniqueID and MAC address.
=== About this document ===
In this Application Note, we will describe how to use the Bora/BoraX NOR SPI for programming and using the MAC address programmed on its OTP block area.
== MAC address programming how-to ==
=== Accessing NOR SPI and u-boot update ===
Actual u-boot version <code>belk-4.1.1</code> has native macros for managing the u-boot update. Here below the messages using the boot from NOR QSPI:
Into the u-boot source code, a default value for the ethernet MAC address is set to the DAVE's default MAC value, i.e.:
Bora> pri ethaddr
ethaddr='''00:50:C2:1E:AF:E0'''
Bora>
==== random MAC address ====
If the <code>ethaddr</code> variable is deleted from the environment, a random value is generated by u-boot:
<pre>
Bora> setenv ethaddr
Bora> saveenv
Saving Environment to SPI Flash...
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
Erasing SPI flash...Writing to SPI flash...done
Valid environment: 2
Bora> reset
resetting ...
</pre>
Warning: ethernet@e000b000 (eth0) using '''random MAC address''' - ae:a4:d7:3c:57:ff
eth0: ethernet@e000b000
Hit ENTER within 3 seconds to stop autoboot
Bora>
=== Accessing the NOR SPI OTP area ===
For accessing the NOR OTP blocks area a special u-boot version should be used.
The proper <code>defconfig</code> should be used for compiling a ''development'' binary which allows to use the writing commands on this area:
For Bora SOM:
make bora_mmc_devel_defconfig
For BoraX SOM:
make borax_mmc_devel_defconfig
=== u-boot ''devel'' ===
The u-boot ''devel'' version can be used for the application purposes: in this application note we used the new u-boot release with the following files:
belk-4.1.4_borax_mmc_devel_boot.bin
belk-4.1.4_borax_mmc_devel_u-boot.img
The ''devel'' u-boot version provides a new command (hidden into standard relase) used for the MAC management:
<pre>
Bora> macprog
macprog - MAC address in SPI NOR OTP management
Usage:
macprog <cmd>
ethaddr - program ethaddr environment variable in OTP
eth1addr - program eth1addr environment variable in OTP
lock_ethaddr - lock OTP block where ethaddr is stored
lock_eth1addr - lock OTP block where eth1addr is stored
Bora>
</pre>
Simply properly copied into a FAT32 SD card with the default filename (for the bootrom readability) <code>boot.bin</code> and <code>u-boot.img</code>.
<pre>
Bora> fatls mmc 0:1
system volume information/
88892 boot.bin
688280 u-boot.img
2 file(s), 1 dir(s)
Bora>
</pre>
Once programmed, the devel u-boot version provides the command required:
It is possible to change (using an environment override) the MAC address simply assigning a new value; in this case, the reboot displays the incongruent value and uses the last one:
<pre>
Bora> pri ethaddr
ethaddr=00:50:c2:1e:af:ec
Bora> setenv ethaddr 00:50:c2:1e:af:aa
Bora> saveenv
Saving Environment to SPI Flash...
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
DAVE's Bora/BoraX git repositories have been updated with the latest development release which includes the routines for accessing the NOR OTP area and storing the MAC address.
The git repositories can be accessed, for DAVE's enabled Customers, at the following addresses:
git@git.dave.eu:dave/bora/u-boot-xlnx.git
The Bora [https://wiki.dave.eu/index.php/Building_U-Boot_(BELK/BXELK) Building_U-Boot] wiki page describes how to keep updated with DAVE's git repository and build the required u-boot version.
The binaries used in this AN can be found into our [[mirror:bora/belk-4.1.4/|mirror server]]