zephyr/cmake/vif.cmake
Madhurima Paruchuri fa738b0f74 usb-c: Generate USB-C connector VIF policies XML file
Generates XML file containing VIF policies by reading the device tree
using EDT.pickle generated during build
This script writes a subset of general and sink-pdo VIF policies in
output file
This script gets invoked during build if enabled through kconfig
The generated XML containing USB-C VIF policies could be used by
USB PD/Type-C analysers/testers to understand USB-C properties and
perform tests accordingly

Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com>
2022-12-02 08:46:04 -06:00

23 lines
712 B
CMake

# Copyright (c) 2022 The Chromium OS Authors
# SPDX-License-Identifier: Apache-2.0
# Generates USB-C VIF policies in XML format from device tree.
set(gen_vif_script ${ZEPHYR_BASE}/scripts/generate_usb_vif/generate_vif.py)
set(dts_compatible usb-c-connector)
set(vif_xml ${PROJECT_BINARY_DIR}/vif.xml)
set(cmd_gen_vif ${PYTHON_EXECUTABLE} ${gen_vif_script}
--edt-pickle ${EDT_PICKLE}
--compatible ${dts_compatible}
--vif-out ${vif_xml}
--board ${BOARD}
)
add_custom_command(
OUTPUT ${vif_xml}
DEPENDS ${EDT_PICKLE}
COMMENT "Generating XML file at zephyr/vif.xml"
COMMAND ${cmd_gen_vif}
)
add_custom_target(gen_vif ALL DEPENDS ${vif_xml})