
.. note:: 8th and 9th Generation Intel® Core :sup:`TM` Processor Families formally known as |WHL| and |CFLR| platform.

Supported Boards
^^^^^^^^^^^^^^^^^^^^^

|SPN| supports **Whiskey Lake, Coffee Lake Refresh Desktop S8+2, Coffee Lake Refresh Mobile H6+2 CRB** platforms and **UP Xtreme** platform.


Building
^^^^^^^^^^

To build |SPN| for |WHL|, |CFLR| and |UPX| platforms::

    python BuildLoader.py build cfl

The output images are generated under ``Outputs`` directory.


Stitching
^^^^^^^^^^

1. Gather |WHL|, |CFLR| or |UPX| IFWI firmware image

  Users can either download the full IFWI image if the IFWI image release is available, or read the exising IFWI image on the board using SPI programmer.
  This image contains additional firmware ingredients that are required to boot on |WHL|, |CFLR| or |UPX|.

.. note::
  ``StitchLoader.py`` currently only supports stitching with boot guard feature **disabled**.


2. Stitch |SPN| images into downloaded IFWI image::

    For Whiskey Lake and Coffee Lake Refresh CRB boards:
      python Platform/CoffeelakeBoardPkg/Script/StitchLoader.py -i <BIOS_IMAGE_NAME>
             -s Outputs/cfl/SlimBootloader.bin -o <SBL_IFWI_IMAGE_NAME>

    For UP Xtreme board:
      python Platform/CoffeelakeBoardPkg/Script/StitchLoader.py -i <BIOS_IMAGE_NAME>
             -s Outputs/cfl/SlimBootloader.bin -o <SBL_IFWI_IMAGE_NAME> -p 0xAA00??10
      '??' can be the following values:
       02:  Use PCH UART2 (Label CN16 on board) as debug serial port
       FF:  Use SIO UART1 (Label COM1 on board) as debug serial port
       FE:  Use SIO UART2 (Label COM2 on board) as debug serial port

    where -i = Input file, -o = Output file.

For example, stitching |SPN| IFWI image ``sbl_cfl_ifwi.bin`` from |CFLR| firmware image::

    python Platform/CoffeelakeBoardPkg/Script/StitchLoader.py -i xxxx.bin -s Outputs/cfl/SlimBootloader.bin -o sbl_cfl_ifwi.bin

For more details on stitch tool, see :ref:`stitch-tool` on how to stitch the IFWI image with |SPN|.


Flashing
^^^^^^^^^

Flash the generated IFWI image to the target board using DediProg SF100 or SF600 programmer.

.. note:: Please check the alignment/polarity when connecting Dediprog to the board. Please power off the board before connecting the Dediprog.
.. note:: Please set the dediprog  to flash the ifwi binary from offset 0

SPI Header to connect dediprog is provided in the table below:

  +---------------------------+--------------+
  |            Board          |   Connector  |
  +---------------------------+--------------+
  |            |WHL|          |    **J3H1**  |
  +---------------------------+--------------+
  |           |CFLSR|         |    **J7H1**  |
  +---------------------------+--------------+
  |           |CFLHR|         |    **J7H2**  |
  +---------------------------+--------------+
  |            |UPX|          |    **CN18**  |
  +---------------------------+--------------+

.. note:: Please disconnect Deidprog before powering up the board again.


Slimbootloader binary for capsule
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Creating slimbootloader binary for capsule image requires the following steps:

Build |SPN| for |WHL|, |CFLR| or |UPX|::

  python BuildLoader.py build cfl

slimbootloader binary generated in ``outputs\cfl\slimbootloader.bin`` can be used for generating capsule image.


Triggering Firmware Update
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sample implementation of trigerring firmware update is explained below

|SPN| for |WHL|, |CFLR| uses BIT16 of PMC I/O register (Over-Clocking WDT Control (OC_WDT_CTL) - Offset 54h) to trigger firmware update. When BIT16 is set, |SPN| will set the boot mode to FLASH_UPDATE.

please refer to IsFirmwareUpdate() function called in ``Platform\CoffeelakeBoardPkg\Library\Stage1BBoardInitLib\Stage1BBoardInitLib.c`` to understand how |SPN| will detect firmware update mode.


Debug UART
^^^^^^^^^^^

Serial port connector on board is provided in the table below:

  +---------------------------+------------------------+
  |            Board          |   Connector            |
  +---------------------------+------------------------+
  |            |WHL|          |    **J8J1**            |
  +---------------------------+------------------------+
  |           |CFLSR|         |    **J9B7**            |
  +---------------------------+------------------------+
  |           |CFLHR|         |    **J4A1**            |
  +---------------------------+------------------------+
  |            |UPX|          |    **CN16/COM1/COM2**  |
  +---------------------------+------------------------+

.. note:: Configure host PuTTY or minicom to 115200bps, 8N1, no hardware flow control.

Booting Yocto Linux from USB
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You may need to change boot options to boot from USB. See :ref:`change-boot-options`.

1. Download Yocto Linux
2. Create bootable USB key. For example: In Windows, Rufus can be used. In Linux, etcher app can be used.
3. Boot the bootable OS image from USB key on the board.

Booting Ubuntu
^^^^^^^^^^^^^^^^^^^^^

See :ref:`boot-ubuntu` for more details.

You may need to change boot options to boot from USB. See :ref:`change-boot-options`.

Board ID Assignments
^^^^^^^^^^^^^^^^^^^^^

Each board is assigned a unique platform ID

  +---------------------------+---------------+
  |            Board          |  Platform ID  |
  +---------------------------+---------------+
  |            |WHL|          |     0x14      |
  +---------------------------+---------------+
  |           |CFLSR|         |     0x1B      |
  +---------------------------+---------------+
  |           |CFLHR|         |     0x16      |
  +---------------------------+---------------+
  |            |UPX|          |     0x10      |
  +---------------------------+---------------+

See :ref:`dynamic-platform-id` for more details.

To customize board configurations in ``*.dlt`` file, make sure to specify ``PlatformId`` to the corresponding values for the board.

See :ref:`configuration-tool` for more details.
