ec_fw: Initial commit for ec dtsi tool

- Migrated export-ec-devicetree-csv tool from arb cli
- Created pin maps for chips arbitrage tool supported
- Unit tests for new functions
- Example csv/generated dtsi
- Read me files for usage/building
- moved go.mod to root so both ap_fw and ec_fw can share it

BUG=b:427556454, b:475292981
TEST=Compared DTSI files generated by this tool for fatcat, nissa, rex
     To output generated by arbitrage tool, verified only differences
     resulting from new features/bugs in original arbitrage.

Change-Id: I6dc27ee29971ada122cc74c5be09e66c0cad3aa1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/firmweaver/+/8090097
Commit-Queue: Kshitij Shah <tij@google.com>
Tested-by: Kshitij Shah <tij@google.com>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
23 files changed
tree: 318e861242749825d26fd3f55b7500f72bd5a0a4
  1. ap_fw/
  2. ec_fw/
  3. .gitignore
  4. DIR_METADATA
  5. go.mod
  6. LICENSE
  7. OWNERS
  8. PRESUBMIT.cfg
  9. README.md
README.md

Firmweaver

Firmweaver is a collection of tools for Chromium OS to assist with initial firmware setup during board bringup.

Introduction

The Chromium OS project includes tools to assist with initial firmware setup during board bringup. These tools generate certain objects in Application Processor (AP) and Embedded Controller (EC) firmware (e.g., EC devicetree, AP GPIO configuration, etc.).

The tools take a curated sheet as prepared by the hardware team as an input and generate these objects as output. Developers can validate the generated output and contribute them to the concerned project.

Features

  • Automatic Generation: Generates firmware objects from hardware sheets.
  • Supported Outputs:
    • EC Devicetree (ec_fw)
    • AP GPIO Configuration (ap_fw)

Getting Started

Building the GPIO Tool

The GPIO tool is located in the ap_fw directory.

  1. Navigate to the ap_fw directory:
    cd ap_fw
    
  2. Build the tool:
    go build -o gpio_tool
    
    This will generate the gpio_tool executable in the ap_fw directory.

Building the EC Devicetree Generator

The EC Devicetree generator is located in the ec_fw directory. See ec_fw/README.md for full details.

  1. Navigate to the ec_fw directory:
    cd ec_fw
    
  2. Build the tool:
    go build -o ec_fw
    
    This will generate the ec_fw executable in the ec_fw directory.

Usage

Running the GPIO Tool

The gpio_tool parses a GPIO map CSV file and generates C configuration code.

./ap_fw/gpio_tool --soc <soc_type> --csv <path_to_csv> [--output <path_to_output_c_file>]

Arguments:

  • --soc: SoC type. Supported values: intel, qcom, mtk. (Required)
  • --csv: Path to the local CSV file containing the GPIO map. (Required)
  • --output: Path to the output file. If omitted, output is written to stdout.

Example:

To generate Intel GPIO configuration from the provided example CSV:

./ap_fw/gpio_tool --soc intel --csv ap_fw/test/ExampleGpio.csv --output ap_fw/test/gpio_config.c

Running the EC Devicetree Generator

The ec_fw tool parses an EC pinout CSV spreadsheet and generates Zephyr devicetree overlays.

./ec_fw/ec_fw --chip <chip_name> --csv <path_to_csv> [--pin-col <variant>] [--output <path_to_output_dtsi>]

Example:

To generate Nuvoton NPCX9 Devicetree overlay from the provided example CSV:

./ec_fw/ec_fw --chip npcx99 --csv ec_fw/test/ExampleEcPinout.csv --pin-col "NPCX99 (NPCX)" --output ec_fw/test/generated.dtsi

Testing

Run unit tests across all tools in the workspace:

go test -v ./...

Contributing

This project follows the standard Chromium OS contribution process.