12.3.TF-A CoT dt2c Tool

This tool is used to automatically generate the corresponding c file for aCoT DT file. Since currently TF-A support two type of CoT file: static c fileand CoT DT binding. This is error prone and hard to maintain, therefore thistool can generate the c file for the platform that does not support CoT DTbinding, given the CoT DT file so the c file can be deprecated.

12.3.1.Prerequisites

  1. Python (3.8 or later)

  2. Poetry Python package manager

12.3.2.Getting Started

cot-dt2c is installed by default with TF-A’s poetry environment. All of it’sdependencies are listed intools/cot_dt2c/pyproject.toml.

cot-dt2c requires a standard DTS file without #ifdef, macros, or otherpreprocessor directives. Therefore, you need to provide a preprocessed devicetree source(DTS) as input to the tool.

  1. Usage of the tool

    cot-dt2c

    This command will output the following as usage for this command

    Usage: cot-dt2c [OPTIONS] COMMAND [ARGS]...Options:--version  Show the version and exit.--help     Show this message and exit.Commands:convert-to-cvalidate-cotvisualize-cotvalidate-dt

12.3.3.Convert CoT descriptors to C file

To convert the CoT descriptors

This command is for the platform that does not use CoT DT parser,which can generate the C file given the CoT descriptors. Beforethe conversion to C file, the tool will do an implicit checks onthe validity of the CoT DT file.

cot-dt2cconvert-to-c[INPUTDTSPATH][OUTPUTCPATH]cot-dt2cconvert-to-cfdts/tbbr_cot_descriptors.dtsitest.c

12.3.4.Validate CoT descriptors

To validate the certificate

The tests folder in the tool folder provides some bad-example of theDT file, and the tool will print out “not a valid CoT DT file” on console.

The command will check the format of the CoT file

  1. The open bracket

  2. The open ifdef macro

  3. The missing mandatory attribute

  4. Malformed DT file (cert missing parent, missing root certs. etc.)

Currently the validation is specifically for checking the CoT DT file

cot-dt2cvalidate-cot[INPUTDTSPATH]cot-dt2cvalidate-cotfdts/tbbr_cot_descriptors.dtsi

12.3.5.Visualize CoT descriptors

This command create a HTML to visualize the relationship betweenthe certificates and the image of a CoT DT file.

cot-dt2cvisualize-cot[INPUTDTSPATH]cot-dt2cvisualize-cotfdts/tbbr_cot_descriptors.dtsi

12.3.6.Validate Other DT files

The command will transform the dtsi/dts file into a more standarddtsi/dts file inside /tmp folder that can be used as input to dt-schemafor further validation. Currently the tool will perform some basic validationfor the file (syntax) and dt-schema can be used for advance checks. dt-schemais not installed along with the tool.

cot-dt2cvalidate-dt[INPUTDTSPATHorINPUTDTSfolder]cot-dt2cvalidate-dtfdts/cot-dt2cvalidate-dtfdts/fvp-bsae-gicv3.dtsi

Copyright (c) 2024, Arm Limited. All rights reserved.