Skip to main content

Convert AUTOSAR DCM/CanTp arxml to LaTeX UDS specification documents

Project description

udsxml2tex

Convert AUTOSAR DCM/CanTp arxml to LaTeX UDS specification documents

A Python library that parses AUTOSAR DCM (Diagnostic Communication Manager) and CanTp (CAN Transport Protocol) arxml configuration files and automatically generates ISO 14229 (UDS) / ISO 15765 (UDS on CAN) specification documents in LaTeX format.

Features

  • Automatically extracts UDS specification data from DCM arxml files
    • Diagnostic sessions
    • Security access levels
    • UDS service list (SID, supported sessions, NRCs, etc.)
    • DID (Data Identifier) definitions
    • Routine Control definitions
  • Parses CanTp arxml for transport layer configuration
    • Channel parameters (Block Size, STmin, channel mode)
    • ISO 15765-2 timing parameters (N_As, N_Bs, N_Cs, N_Ar, N_Br, N_Cr)
    • Addressing format and padding configuration
  • Generates professional LaTeX specification documents
  • Customizable via Jinja2 templates
  • Available as both a CLI command and a Python API
  • Supports merging multiple arxml files (DCM + CanTp)

Installation

pip install udsxml2tex

From source (for development):

git clone https://github.com/YutaroNakagama/udsxml2tex.git
cd udsxml2tex
pip install -e ".[dev]"

Usage

CLI

# Basic conversion
udsxml2tex input.arxml

# Specify output file
udsxml2tex input.arxml -o output.tex

# Override ECU name
udsxml2tex input.arxml --ecu-name "MyECU"

# Merge and convert multiple files (DCM + CanTp)
udsxml2tex dcm_config.arxml cantp_config.arxml -o merged_spec.tex

# Verbose logging
udsxml2tex input.arxml -v

Python API

from udsxml2tex import ArxmlParser, TexGenerator

# Parse ARXML (DCM + CanTp)
parser = ArxmlParser()
spec = parser.parse("path/to/dcm_config.arxml")

# Or merge multiple files
spec = parser.parse_multi(["dcm_config.arxml", "cantp_config.arxml"])

# Generate LaTeX
generator = TexGenerator()
generator.generate(spec, "output/uds_spec.tex")

# Get as string
tex_content = generator.generate_string(spec)

Custom Templates

You can use your own LaTeX templates:

generator = TexGenerator(template_dir="my_templates/")
generator.generate(spec, "output.tex", template_name="custom.tex.j2")
udsxml2tex input.arxml --template-dir my_templates/ --template custom.tex.j2

Document Class (udsspec.cls)

The generated documents use the udsspec document class, which encapsulates all package imports, page layout, header/footer styling, and custom commands. The .cls file is automatically copied alongside the output .tex file during generation.

When creating a custom template, use \documentclass{udsspec} and configure metadata via the following commands:

\documentclass{udsspec}

\ecuname{MyECU}              % ECU name (appears in header and title)
\docversion{2.0}             % Document version (default: 1.0)
\docresponsible{John Doe}    % Responsible person (header field)
\docauthor{Jane Smith}       % Author (header field)
\docfooter{CONFIDENTIAL}     % Footer text (default: Generated by udsxml2tex)

The class provides the following commands for use in document body:

Command Example Output
\serviceid{10} \serviceid{10} 10₁₆
\hexval{FF} \hexval{FF} FF₁₆

Custom column types C{width} (centered) and L{width} (left-aligned) are also available.

Compiling to PDF

The generated .tex file can be compiled to PDF using pdflatex:

# Basic compilation
pdflatex output.tex

# Full compilation (recommended — resolves cross-references and TOC)
pdflatex output.tex && pdflatex output.tex

Note: A LaTeX distribution with pdflatex is required (e.g., TeX Live, MiKTeX). The udsspec.cls document class and tikz-uml.sty style file are bundled with the generated output, so no additional package installation is needed.

Generated Document Structure

The document is structured according to the OSI reference model:

  1. Title Page — ECU name, date
  2. Table of Contents
  3. Document Overview — OSI layer mapping overview
  4. Transport Layer (ISO 15765-2 / CanTp) — Channel overview, timing parameters, addressing & padding
  5. Session Layer (ISO 14229-2) — Diagnostic sessions (ID, P2/P2* timers)
  6. Application Layer (ISO 14229-1)
    • UDS Services — Service overview + per-service details (sub-functions, NRCs)
      • SecurityAccess (0x27) includes security access levels
      • RoutineControl (0x31) includes routine overview + parameter details
    • Data Identifiers (DIDs) — DID overview + data element details

Supported arxml Structure

The following AUTOSAR module configuration elements are parsed:

Module Element Description
DCM DcmDsl Diagnostic Session Layer (protocol, timing)
DCM DcmDsp Diagnostic Service Processing (sessions, security, DIDs, routines)
DCM DcmDsd Diagnostic Service Dispatcher (service table)
CanTp CanTpGeneral Main function period
CanTp CanTpChannel Channel mode, RxNSdu/TxNSdu (BS, STmin, N_As/N_Bs/N_Cs/N_Ar/N_Br/N_Cr, padding, addressing)

Supports AUTOSAR R4.x arxml format.

Requirements

  • Python >= 3.9
  • lxml >= 4.9.0
  • Jinja2 >= 3.1.0
  • LaTeX distribution (for compiling the generated .tex files)

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

udsxml2tex-0.10.0.tar.gz (83.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

udsxml2tex-0.10.0-py3-none-any.whl (74.4 kB view details)

Uploaded Python 3

File details

Details for the file udsxml2tex-0.10.0.tar.gz.

File metadata

  • Download URL: udsxml2tex-0.10.0.tar.gz
  • Upload date:
  • Size: 83.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for udsxml2tex-0.10.0.tar.gz
Algorithm Hash digest
SHA256 721e6d8951fc44f3362c81120b925fc2d2cc111a6bea2eba4594d901b22fe37c
MD5 0fc17d68d1b7f06bdd004b2b0b0a4ccf
BLAKE2b-256 a4ede34763d6366113d574c0546edba22a6b7c39c68f8ba5147bb327f4218377

See more details on using hashes here.

File details

Details for the file udsxml2tex-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: udsxml2tex-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 74.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for udsxml2tex-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6714f60e48364a791fb31dce8a07c4cfcbf0cef18beac3f70ee680a03566dc56
MD5 f9fa6624804c631679c07c61437ae730
BLAKE2b-256 0001300c8c714a201e7e34dd14b68120245ea70e1389891e86e6c26c28ad6c1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page