1.. _burn-block-data-cmd:
2
3Burn Block Data
4===============
5
6The ``espefuse.py burn_block_data`` command allows writing arbitrary data (non-key data) from a file into an eFuse block, for software use.
7
8This command is available in ``espefuse.py`` v2.6 and newer.
9
10Positional arguments:
11
12* ``Name of key block``
13* ``Datafile``. File containing data to burn into the efuse block. The file size can be smaller than the eFuse block size.
14
15It can be list of blocks and datafiles (like BLOCK1 datafile1.bin BLOCK2 datafile2.bin etc.).
16
17Optional arguments:
18
19* ``--force-write-always``. Write the eFuse key even if it looks like it is already been written, or is write protected. Note that this option can't disable write protection, or clear any bit which has already been set.
20* ``--offset``. Byte offset in the eFuse block.
21
22**Example:** Write to eFuse BLOCK3 from binary file ``device_id.bin``, starting at eFuse byte offset 6:
23
24.. code-block:: none
25
26    > espefuse.py -p PORT burn_block_data --offset 6 BLOCK3 device_id.bin
27
28    === Run "burn_block_data" command ===
29    [03] BLOCK3               size=32 bytes, offset=06 - > [00 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 00 00 00 00 00 00 00 00 00 00].
30
31    Check all blocks for burn...
32    idx, BLOCK_NAME,          Conclusion
33    [03] BLOCK3               is empty, will burn the new value
34    .
35    This is an irreversible operation!
36    Type 'BURN' (all capitals) to continue.
37    BURN
38    BURN BLOCK3  - OK (write block == read block)
39    Reading updated efuses...
40    Successful
41
42Peculiarities
43-------------
44
451. Data is written to the eFuse block in normal byte order (treating the eFuse block as if it was an array of bytes). It can be read back in firmware using eFuse API or from the eFuse read registers (but these reads must be always be complete register words, 4-byte aligned).
46
47.. code-block:: none
48
49    > espefuse.py dump
50    ...
51    BLOCK3          (                ) [3 ] read_regs: 00000000 01000000 05040302 09080706 0d0c0b0a 00000f0e 00000000 00000000
52
53    > espefuse.py summary
54    ....
55    BLOCK3 (BLOCK3):                                   Variable Block 3
56    = 00 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 00 00 00 00 00 00 00 00 00 00 R/W
57
582. Part of the eFuse block can be written at a time. The ``--offset`` argument allows writing to a byte offset inside the eFuse block itself.
593. This command is not suitable for writing key data which will be used by flash encryption or secure boot hardware, use ``burn_key`` for this.
60