firmweaver: Introduce GPIO tool for AP firmware config

Introduce the GPIO tool in ap_fw directory. This tool parses a GPIO
map CSV file (typically generated from a hardware spreadsheet) and
generates C configuration code for different SoCs.

Currently supports Intel SoCs, with placeholder support for Qualcomm
and MediaTek SoCs.

The Intel-specific logic is organized in intel_gpio_config.go, while
the main entry point and generic logic are in gpio_tool.go.

Include a Go module definition for building the tool, and update
README.md with instructions.
Also include test data and expected output for verification.

BUG=b:475292981, b:475293394
TEST=Build the tool and run against the provided test CSV:
./ap_fw/gpio_tool --soc intel --csv ap_fw/test/ExampleGpio.csv \
  --output /tmp/test.c
Verify the output matches the expected ap_fw/test/gpio_config.c.

Change-Id: Iafaa8f74510cdab0b6213c393350138f7fdbc7f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/firmweaver/+/8051010
Commit-Queue: Karthik Ramasubramanian <kramasub@google.com>
Tested-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Kshitij Shah <tij@google.com>
7 files changed
tree: 868c5fe2f3a761dabf0408c7dec235ca8514349b
  1. ap_fw/
  2. DIR_METADATA
  3. LICENSE
  4. OWNERS
  5. PRESUBMIT.cfg
  6. 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
    • AP GPIO Configuration

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.

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

Contributing

This project follows the standard Chromium OS contribution process.