Difference between revisions of "BELK-TN-010: MAC address programming on OTP"

From DAVE Developer's Wiki
Jump to: navigation, search
(u-boot devel)
(8 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
{{Applies To BoraX}}
 
{{Applies To BoraX}}
 
{{Applies To BoraLite}}
 
{{Applies To BoraLite}}
 +
{{AppliesToBORA Lite TN}}
 
{{InfoBoxBottom}}
 
{{InfoBoxBottom}}
 
__FORCETOC__
 
__FORCETOC__
Line 12: Line 13:
 
!Version
 
!Version
 
!Date
 
!Date
 +
!BELK/BXELK version
 
!Notes
 
!Notes
 
|-
 
|-
|1.0.0
+
|1.0.1
|Sep 2020
+
|Jul 2021
|First public release
+
|[[BELK/BXELK software components#BELK 4.1.4|4.1.4]]
 +
|BELK update 4.1.4
 
|}
 
|}
  
Line 32: Line 35:
 
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.
 
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 ==
+
=== 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.
 
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:
 +
 +
<pre>
 +
U-Boot SPL 2017.01-belk-4.1.1 (Jan 08 2020 - 16:44:36)
 +
qspi boot
 +
Trying to boot from SPI
 +
 +
 +
U-Boot 2017.01-belk-4.1.1 (Jan 08 2020 - 16:44:36 +0100), Build: belk-4.1.1
 +
 +
Model: Bora
 +
Board: Xilinx Zynq
 +
I2C:  ready
 +
DRAM:  ECC disabled 1 GiB
 +
Relocating to 3ff14000, new gd at 3ead3ee8, sp at 3ead3ec0
 +
NAND:  1024 MiB
 +
MMC:  Card did not respond to voltage select!
 +
Card did not respond to voltage select!
 +
sdhci@e0100000 - probe failed: -95
 +
Card did not respond to voltage select!
 +
 +
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
 +
*** Warning - bad CRC, using default environment
 +
 +
In:    serial@e0001000
 +
Out:  serial@e0001000
 +
Err:  serial@e0001000
 +
Model: Bora
 +
Board: Xilinx Zynq
 +
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
 +
WARNING: ConfigID on block 0 is UNLOCKED
 +
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
 +
SOM ConfigID#: 00000006
 +
SOM UniqueID#: 3a12db08:32291263
 +
ds2431_readmem(): error in chip reset
 +
ds2431_readmem(): error in reading buffer
 +
ds2431_readmem(): error in chip reset
 +
ds2431_readmem(): error in reading buffer
 +
CB ConfigID CRC mismatch for 0x00000000 (was 0x00000000, expected 0x2144df1c) at block 3 (offset 96): using default
 +
CB ConfigID#: ffffffff
 +
CB UniqueID#: 00000000:00000000
 +
Net:  ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id
 +
eth0: ethernet@e000b000
 +
Hit ENTER within 3 seconds to stop autoboot
 +
Bora>
 +
</pre>
 +
 +
The following macros can be used for '''u-boot''' re-programming:
 +
<pre>
 +
load_spl=tftpboot ${loadaddr} bora/boot.bin
 +
update_spl=sf probe 0 0 0;sf erase ${SPL_base} +${filesize};sf write ${loadaddr} ${SPL_base} ${filesize}
 +
load=tftpboot ${loadaddr} bora/u-boot.img
 +
update=sf probe 0 0 0;sf erase ${u-boot_base} +${filesize};sf write ${loadaddr} ${u-boot_base} ${filesize}
 +
</pre>
 +
with proper settings (i.e. binary filenames)
 +
 +
==== ethaddr ====
 +
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:
 +
 +
<pre>
 +
U-Boot SPL 2017.01-belk-4.1.4 (Jul 30 2021 - 10:13:19)
 +
mmc boot
 +
Trying to boot from MMC1
 +
reading fpga.bit
 +
reading fpga.bit
 +
  design filename = "bora_wrapper;UserID=0XFFFFFFFF;Version=2017.1"
 +
  part number = "7z020clg400"
 +
  date = "2020/01/08"
 +
  time = "15:46:46"
 +
  bytes in bitstream = 4045564
 +
zynq_align_dma_buffer: Align buffer at 400006c to 3ffff80(swap 1)
 +
reading u-boot.img
 +
reading u-boot.img
 +
 +
 +
U-Boot 2017.01-belk-4.1.4 (Jul 30 2021 - 10:13:19 +0200)
 +
 +
Model: Bora
 +
Board: Xilinx Zynq
 +
I2C:  ready
 +
DRAM:  ECC disabled 1 GiB
 +
Relocating to 3ff13000, new gd at 3ead2ee8, sp at 3ead2ec0
 +
NAND:  1024 MiB
 +
MMC:  sdhci@e0100000: 0 (SD)
 +
reading bora.env
 +
In:    serial@e0001000
 +
Out:  serial@e0001000
 +
Err:  serial@e0001000
 +
Model: Bora
 +
Board: Xilinx Zynq
 +
SF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
 +
SF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
 +
SOM ConfigID#: 00000001
 +
SOM UniqueID#: 01234567:89abcdef
 +
ds2431_readmem(): error in chip reset
 +
ds2431_readmem(): error in reading buffer
 +
ds2431_readmem(): error in chip reset
 +
ds2431_readmem(): error in reading buffer
 +
CB ConfigID CRC mismatch for 0x00000000 (was 0x00000000, expected 0x2144df1c) at block 3 (offset 96): using default
 +
CB ConfigID#: ffffffff
 +
CB UniqueID#: 00000000:00000000
 +
SF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
 +
ethaddr in SPI NOR: CRC mismatch for 0x0000000000000000 (was 0x00000000, expected 0x6522df69) at block 8
 +
Net:  ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id
 +
 +
Warning: ethernet@e000b000 (eth0) using random MAC address - ae:6d:59:6e:aa:87
 +
eth0: ethernet@e000b000
 +
Hit ENTER within 3 seconds to stop autoboot
 +
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>
 +
 +
The MAC not programmed is shown by the two debug messages:
 +
 +
'''ethaddr in SPI NOR: CRC mismatch for 0x0000000000000000 (was 0x00000000, expected 0x6522df69) at block 8'''
 +
 +
Warning: ethernet@e000b000 (eth0) using random MAC address - ae:6d:59:6e:aa:87
 +
 +
==== Programming the required MAC address ====
 +
For programming the MAC address the following steps can be used:
 +
 +
* set the <code>ethaddr</code> ethernet address value
 +
Bora> setenv ethaddr '''00:50:C2:1E:AF:EC'''
 +
Bora> printenv ethaddr
 +
ethaddr=00:50:C2:1E:AF:EC
 +
Bora>
 +
 +
* programming the MAC and '''lock''' the OTP register
 +
<pre>
 +
Bora> macprog ethaddr
 +
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
 +
Your're about to program this MAC address: 00:50:C2:1E:AF:EC for ethaddr (block 8). Continue? (y/N)
 +
y
 +
Block 8 NOT locked. Use 'macprog lock_ethaddr' to lock it
 +
Bora> macprog lock_ethaddr
 +
You're about to lock block 8. Continue (y/N)?
 +
y
 +
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
 +
Bora>
 +
</pre>
 +
 +
==== incorrect ethaddr ====
 +
If <code>ethaddr</code> is empty the ''macprog'' command will report an error:
 +
 +
<pre>
 +
Bora> setenv ethaddr
 +
Bora> macprog ethaddr
 +
Error: "ethaddr" not defined
 +
Bora>
 +
</pre>
 +
 +
=== u-boot ===
 +
 +
Once the MAC address has been programmed, the standard u-boot version can be used in the field.
 +
 +
Typically, the NOR SPI is used as boot storage device, so the <code>defconfig</code> used for the binary version is:
 +
 +
* for Bora SOM: bora_qspi_defconfig  (i.e. u-boot has to compiled with <code> make bora_qspi_defconfig</code>)
 +
* for BoraX SOM: borax_qspi_defconfig  (i.e. u-boot has to compiled with <code> make borax_qspi_defconfig</code>)
 +
 +
==== Verify the programmed MAC address ====
 +
The MAC address can be checked using the ''on the field'' u-boot version:
 +
 +
* install the u-boot ''field'' version using the u-boot binaries
 +
 +
<pre>
 +
belk-4.1.4_bora_qspi_boot.bin
 +
belk-4.1.4_bora_qspi_u-boot.img
 +
</pre>
 +
 +
and reset the board.
 +
 +
* the configured MAC address is available in the variable <code>ethaddr</code>
 +
 +
<pre>
 +
U-Boot SPL 2017.01-belk-4.1.4 (Jul 30 2021 - 10:24:26)
 +
qspi boot
 +
Trying to boot from SPI
 +
 +
 +
U-Boot 2017.01-belk-4.1.4 (Jul 30 2021 - 10:24:26 +0200)
 +
 +
Model: Bora
 +
Board: Xilinx Zynq
 +
I2C:  ready
 +
DRAM:  ECC disabled 1 GiB
 +
Relocating to 3ff14000, new gd at 3ead3ee8, sp at 3ead3ec0
 +
NAND:  1024 MiB
 +
MMC:  Card did not respond to voltage select!
 +
Card did not respond to voltage select!
 +
sdhci@e0100000 - probe failed: -95
 +
Card did not respond to voltage select!
 +
 +
SF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
 +
In:    serial@e0001000
 +
Out:  serial@e0001000
 +
Err:  serial@e0001000
 +
Model: Bora
 +
Board: Xilinx Zynq
 +
SF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
 +
SF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
 +
SOM ConfigID#: 00000001
 +
SOM UniqueID#: 01234567:89abcdef
 +
ds2431_readmem(): error in chip reset
 +
ds2431_readmem(): error in reading buffer
 +
ds2431_readmem(): error in chip reset
 +
ds2431_readmem(): error in reading buffer
 +
CB ConfigID CRC mismatch for 0x00000000 (was 0x00000000, expected 0x2144df1c) at block 3 (offset 96): using default
 +
CB ConfigID#: ffffffff
 +
CB UniqueID#: 00000000:00000000
 +
SF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
 +
Net:  ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id
 +
eth0: ethernet@e000b000
 +
Hit ENTER within 0 seconds to stop autoboot
 +
Bora>
 +
</pre>
 +
 +
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
 +
Erasing SPI flash...Writing to SPI flash...done
 +
Valid environment: 2
 +
Bora> reset
 +
resetting ...
 +
...
 +
...
 +
Warning: ethaddr MAC addresses don't match:
 +
Address in SROM is        00:50:c2:1e:af:ec
 +
Address in environment is  00:50:c2:1e:af:aa
 +
Net:  ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id
 +
eth0: ethernet@e000b000
 +
Hit ENTER within 3 seconds to stop autoboot
 +
</pre>
 +
 +
For using the OTP MAC, simply delete the ''ethaddr'' and save the environment:
 +
 +
<pre>
 +
Bora> pri ethaddr
 +
ethaddr=00:50:c2:1e:af:aa
 +
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: 1
 +
Bora> reset
 +
resetting ...
 +
...
 +
...
 +
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
 +
Net:  ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id
 +
eth0: ethernet@e000b000
 +
Hit ENTER within 3 seconds to stop autoboot
 +
Bora> pri ethaddr
 +
ethaddr=00:50:c2:1e:af:ec
 +
Bora>
 +
</pre>
 +
 +
=== Linux userspace access ===
 +
 +
The programmed MAC value can be verified once the ethernet interface has been correctly configured by u-boot and then activated by the Linux kernel.
 +
 +
It is enough to check it using <code>ifconfig</code> at the userspace level:
 +
 +
<pre>
 +
root@bora:~# ifconfig eth0
 +
eth0      Link encap:Ethernet  HWaddr 00:50:c2:1e:af:ec
 +
          inet addr:192.168.0.90  Bcast:192.168.0.255  Mask:255.255.255.0
 +
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
 +
          RX packets:11620 errors:0 dropped:4 overruns:0 frame:0
 +
          TX packets:9125 errors:0 dropped:0 overruns:0 carrier:0
 +
          collisions:0 txqueuelen:1000
 +
          RX bytes:12494336 (11.9 MiB)  TX bytes:1189523 (1.1 MiB)
 +
          Interrupt:148 Base address:0xb000
 +
 +
root@bora:~#
 +
</pre>
 +
 +
== Bora git repositories ==
 +
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]]

Revision as of 08:34, 30 July 2021

Info Box
Bora5-small.jpg Applies to Bora
BORA Xpress.png Applies to BORA Xpress
BORALite-TOP.png Applies to BORA Lite


Warning-icon.png This technical note was validated against specific versions of hardware and software. What is described here may not work with other versions. Warning-icon.png

History[edit | edit source]

Version Date BELK/BXELK version Notes
1.0.1 Jul 2021 4.1.4 BELK update 4.1.4

Introduction[edit | edit source]

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 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 a1-c2-e3-44-5f-6d. The purpose of the MAC address is to uniquely identify every node; every adapter has a unique MAC address.

Permanent storage areas[edit | edit source]

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[edit | edit source]

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[edit | edit source]

Accessing NOR SPI and u-boot update[edit | edit source]

Actual u-boot version belk-4.1.1 has native macros for managing the u-boot update. Here below the messages using the boot from NOR QSPI:

U-Boot SPL 2017.01-belk-4.1.1 (Jan 08 2020 - 16:44:36)
qspi boot
Trying to boot from SPI


U-Boot 2017.01-belk-4.1.1 (Jan 08 2020 - 16:44:36 +0100), Build: belk-4.1.1

Model: Bora
Board: Xilinx Zynq
I2C:   ready
DRAM:  ECC disabled 1 GiB
Relocating to 3ff14000, new gd at 3ead3ee8, sp at 3ead3ec0
NAND:  1024 MiB
MMC:   Card did not respond to voltage select!
Card did not respond to voltage select!
sdhci@e0100000 - probe failed: -95
Card did not respond to voltage select!

SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
*** Warning - bad CRC, using default environment

In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Model: Bora
Board: Xilinx Zynq
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
WARNING: ConfigID on block 0 is UNLOCKED
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
SOM ConfigID#: 00000006
SOM UniqueID#: 3a12db08:32291263
ds2431_readmem(): error in chip reset
ds2431_readmem(): error in reading buffer
ds2431_readmem(): error in chip reset
ds2431_readmem(): error in reading buffer
CB ConfigID CRC mismatch for 0x00000000 (was 0x00000000, expected 0x2144df1c) at block 3 (offset 96): using default
CB ConfigID#: ffffffff
CB UniqueID#: 00000000:00000000
Net:   ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id
eth0: ethernet@e000b000
Hit ENTER within 3 seconds to stop autoboot
Bora>

The following macros can be used for u-boot re-programming:

load_spl=tftpboot ${loadaddr} bora/boot.bin
update_spl=sf probe 0 0 0;sf erase ${SPL_base} +${filesize};sf write ${loadaddr} ${SPL_base} ${filesize}
load=tftpboot ${loadaddr} bora/u-boot.img
update=sf probe 0 0 0;sf erase ${u-boot_base} +${filesize};sf write ${loadaddr} ${u-boot_base} ${filesize}

with proper settings (i.e. binary filenames)

ethaddr[edit | edit source]

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[edit | edit source]

If the ethaddr variable is deleted from the environment, a random value is generated by u-boot:

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 ...
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[edit | edit source]

For accessing the NOR OTP blocks area a special u-boot version should be used.

The proper defconfig 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[edit | edit source]

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:

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>

Simply properly copied into a FAT32 SD card with the default filename (for the bootrom readability) boot.bin and u-boot.img.

Bora> fatls mmc 0:1
            system volume information/
    88892   boot.bin
   688280   u-boot.img

2 file(s), 1 dir(s)

Bora>

Once programmed, the devel u-boot version provides the command required:

U-Boot SPL 2017.01-belk-4.1.4 (Jul 30 2021 - 10:13:19)
mmc boot
Trying to boot from MMC1
reading fpga.bit
reading fpga.bit
  design filename = "bora_wrapper;UserID=0XFFFFFFFF;Version=2017.1"
  part number = "7z020clg400"
  date = "2020/01/08"
  time = "15:46:46"
  bytes in bitstream = 4045564
zynq_align_dma_buffer: Align buffer at 400006c to 3ffff80(swap 1)
reading u-boot.img
reading u-boot.img


U-Boot 2017.01-belk-4.1.4 (Jul 30 2021 - 10:13:19 +0200)

Model: Bora
Board: Xilinx Zynq
I2C:   ready
DRAM:  ECC disabled 1 GiB
Relocating to 3ff13000, new gd at 3ead2ee8, sp at 3ead2ec0
NAND:  1024 MiB
MMC:   sdhci@e0100000: 0 (SD)
reading bora.env
In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Model: Bora
Board: Xilinx Zynq
SF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
SF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
SOM ConfigID#: 00000001
SOM UniqueID#: 01234567:89abcdef
ds2431_readmem(): error in chip reset
ds2431_readmem(): error in reading buffer
ds2431_readmem(): error in chip reset
ds2431_readmem(): error in reading buffer
CB ConfigID CRC mismatch for 0x00000000 (was 0x00000000, expected 0x2144df1c) at block 3 (offset 96): using default
CB ConfigID#: ffffffff
CB UniqueID#: 00000000:00000000
SF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
ethaddr in SPI NOR: CRC mismatch for 0x0000000000000000 (was 0x00000000, expected 0x6522df69) at block 8
Net:   ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id

Warning: ethernet@e000b000 (eth0) using random MAC address - ae:6d:59:6e:aa:87
eth0: ethernet@e000b000
Hit ENTER within 3 seconds to stop autoboot
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>

The MAC not programmed is shown by the two debug messages:

ethaddr in SPI NOR: CRC mismatch for 0x0000000000000000 (was 0x00000000, expected 0x6522df69) at block 8

Warning: ethernet@e000b000 (eth0) using random MAC address - ae:6d:59:6e:aa:87

Programming the required MAC address[edit | edit source]

For programming the MAC address the following steps can be used:

  • set the ethaddr ethernet address value
Bora> setenv ethaddr 00:50:C2:1E:AF:EC
Bora> printenv ethaddr
ethaddr=00:50:C2:1E:AF:EC
Bora> 
  • programming the MAC and lock the OTP register
Bora> macprog ethaddr
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
Your're about to program this MAC address: 00:50:C2:1E:AF:EC for ethaddr (block 8). Continue? (y/N)
y
Block 8 NOT locked. Use 'macprog lock_ethaddr' to lock it
Bora> macprog lock_ethaddr
You're about to lock block 8. Continue (y/N)?
y
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
Bora>

incorrect ethaddr[edit | edit source]

If ethaddr is empty the macprog command will report an error:

Bora> setenv ethaddr
Bora> macprog ethaddr
Error: "ethaddr" not defined
Bora> 

u-boot[edit | edit source]

Once the MAC address has been programmed, the standard u-boot version can be used in the field.

Typically, the NOR SPI is used as boot storage device, so the defconfig used for the binary version is:

  • for Bora SOM: bora_qspi_defconfig (i.e. u-boot has to compiled with make bora_qspi_defconfig)
  • for BoraX SOM: borax_qspi_defconfig (i.e. u-boot has to compiled with make borax_qspi_defconfig)

Verify the programmed MAC address[edit | edit source]

The MAC address can be checked using the on the field u-boot version:

  • install the u-boot field version using the u-boot binaries
belk-4.1.4_bora_qspi_boot.bin
belk-4.1.4_bora_qspi_u-boot.img

and reset the board.

  • the configured MAC address is available in the variable ethaddr
U-Boot SPL 2017.01-belk-4.1.4 (Jul 30 2021 - 10:24:26)
qspi boot
Trying to boot from SPI


U-Boot 2017.01-belk-4.1.4 (Jul 30 2021 - 10:24:26 +0200)

Model: Bora
Board: Xilinx Zynq
I2C:   ready
DRAM:  ECC disabled 1 GiB
Relocating to 3ff14000, new gd at 3ead3ee8, sp at 3ead3ec0
NAND:  1024 MiB
MMC:   Card did not respond to voltage select!
Card did not respond to voltage select!
sdhci@e0100000 - probe failed: -95
Card did not respond to voltage select!

SF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Model: Bora
Board: Xilinx Zynq
SF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
SF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
SOM ConfigID#: 00000001
SOM UniqueID#: 01234567:89abcdef
ds2431_readmem(): error in chip reset
ds2431_readmem(): error in reading buffer
ds2431_readmem(): error in chip reset
ds2431_readmem(): error in reading buffer
CB ConfigID CRC mismatch for 0x00000000 (was 0x00000000, expected 0x2144df1c) at block 3 (offset 96): using default
CB ConfigID#: ffffffff
CB UniqueID#: 00000000:00000000
SF: Detected s25fl256s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
Net:   ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id
eth0: ethernet@e000b000
Hit ENTER within 0 seconds to stop autoboot
Bora>

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:

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
Erasing SPI flash...Writing to SPI flash...done
Valid environment: 2
Bora> reset
resetting ...
...
...
Warning: ethaddr MAC addresses don't match:
Address in SROM is         00:50:c2:1e:af:ec
Address in environment is  00:50:c2:1e:af:aa
Net:   ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id
eth0: ethernet@e000b000
Hit ENTER within 3 seconds to stop autoboot

For using the OTP MAC, simply delete the ethaddr and save the environment:

Bora> pri ethaddr
ethaddr=00:50:c2:1e:af:aa
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: 1
Bora> reset
resetting ...
...
...
SF: Detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 32 MiB
Net:   ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id
eth0: ethernet@e000b000
Hit ENTER within 3 seconds to stop autoboot
Bora> pri ethaddr
ethaddr=00:50:c2:1e:af:ec
Bora>

Linux userspace access[edit | edit source]

The programmed MAC value can be verified once the ethernet interface has been correctly configured by u-boot and then activated by the Linux kernel.

It is enough to check it using ifconfig at the userspace level:

root@bora:~# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:50:c2:1e:af:ec
          inet addr:192.168.0.90  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11620 errors:0 dropped:4 overruns:0 frame:0
          TX packets:9125 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:12494336 (11.9 MiB)  TX bytes:1189523 (1.1 MiB)
          Interrupt:148 Base address:0xb000

root@bora:~# 

Bora git repositories[edit | edit source]

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 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 server