Home Learning Paths ECU Lab Assessments Interview Preparation Arena Pricing Log In Sign Up

Pipeline Stages: ARXML Commit to Flash

GroovyJenkinsfile
pipeline {
  agent any
  stages {
    stage('Validate ARXML') {
      steps {
        sh 'davinci_cli.exe -project ECU.dpj -validate -strict'
        sh 'python3 ci_bsw_validation.py'  // PduR routes, signal matrix
      }
    }
    stage('Generate BSW + RTE Code') {
      steps {
        sh 'davinci_cli.exe -project ECU.dpj -gen -output GENDATA/'
        sh 'python3 ci_stale_check.py'  // verify GENDATA matches ARXML checksum
      }
    }
    stage('MISRA-C Analysis') {
      steps {
        sh 'polyspace-bug-finder -sources GENDATA/ src/ -misra C2012 -report polyspace_report.pdf'
        sh 'python3 check_misra_deviations.py polyspace_report.pdf approved_deviations.csv'
      }
    }
    stage('Cross-Compile') {
      steps {
        sh 'cmake --build build/ --config Release -j4'
        archiveArtifacts artifacts: 'build/ECU_EPS.elf, build/ECU_EPS.map'
      }
    }
    stage('ROM Budget Gate') {
      steps {
        sh 'python3 ci_map_budget.py --map build/ECU_EPS.map --budgets rom_budgets.yaml'
      }
    }
    stage('Flash to Bench + CAN Validation') {
      steps {
        sh 'trace32_cli -script flash_bench.cmm'
        sh 'python3 canoe_validation.py --dbc ECU.dbc --duration 30'
      }
    }
  }
}

Map File ROM Budget Gate

Pythonci_map_budget.py
#!/usr/bin/env python3
import re, sys, yaml, argparse

def parse_map(mapfile):
    # Parse arm-none-eabi-ld map file, return {section: size_bytes}
    sections = {}
    with open(mapfile) as f:
        for line in f:
            m = re.match(r'^(\.\S+)\s+0x[0-9a-f]+\s+0x([0-9a-f]+)', line)
            if m:
                sections[m.group(1)] = int(m.group(2), 16)
    return sections

parser = argparse.ArgumentParser()
parser.add_argument('--map', required=True)
parser.add_argument('--budgets', required=True)
args = parser.parse_args()

sections = parse_map(args.map)
budgets = yaml.safe_load(open(args.budgets))

failures = []
for section, budget_bytes in budgets.items():
    actual = sections.get(section, 0)
    status = "PASS" if actual <= budget_bytes else "FAIL"
    print(f"{status}: {section} = {actual:,} / {budget_bytes:,} bytes ({actual/budget_bytes:.0%})")
    if status == "FAIL":
        failures.append(section)

sys.exit(1 if failures else 0)
YAMLrom_budgets.yaml
.text:          196608   # 192 KB total code
.rodata:         65536    # 64 KB const data (COM tables etc.)
.bss:             8192    # 8 KB zero-init data
.os_stacks:      16384    # 16 KB task stacks
.post_build:     32768    # 32 KB post-build config

Post-Build Binary Update Without Recompile

Shellupdate_postbuild.sh
#!/bin/bash
# Update PduR routing table without recompiling full BSW
# Scenario: OEM adds new CAN signal after BSW freeze

# 1. Update only Com_PBcfg.arxml and PduR_PBcfg.arxml
# 2. Regenerate PBcfg files only
davinci_cli.exe -project ECU.dpj -gen-postbuild -output GENDATA_PB/

# 3. Compile PBcfg only
arm-none-eabi-gcc -c GENDATA_PB/Com_PBcfg.c -o build/Com_PBcfg.o
arm-none-eabi-gcc -c GENDATA_PB/PduR_PBcfg.c -o build/PduR_PBcfg.o

# 4. Link PBcfg binary (self-contained — no BSW code references)
arm-none-eabi-ld -T postbuild.ld build/Com_PBcfg.o build/PduR_PBcfg.o -o ECU_PBcfg.bin

# 5. Flash PBcfg section only (100KB flash, not 2MB full BSW image)
trace32_cli -script flash_postbuild.cmm ECU_PBcfg.bin

echo "Post-build update complete — BSW binary unchanged" 

Release Gate: Automated CAN Trace Comparison

Pythoncanoe_validation.py
#!/usr/bin/env python3
# CANoe headless CAN trace comparison against DBC expected values
import canoe_com_api as canoe
import can_dbc_parser as dbc_parser
import sys

# Load DBC expected signal specifications
dbc = dbc_parser.load("ECU.dbc")
expected_cycles = {sig.name: sig.cycle_time_ms for sig in dbc.signals if sig.is_cyclic}

# Connect to CANoe and run 30-second capture
session = canoe.start_headless("CANoe_Config.cfg")
session.start_measurement()
session.wait(30.0)
trace = session.get_trace()
session.stop_measurement()

failures = []
for sig_name, expected_ms in expected_cycles.items():
    actual_ms = trace.measure_average_cycle_time(sig_name)
    if actual_ms is None:
        failures.append(f"{sig_name}: NOT FOUND ON BUS (PDU disabled?)")
    elif abs(actual_ms - expected_ms) > expected_ms * 0.15:  # ±15% tolerance
        failures.append(f"{sig_name}: cycle={actual_ms:.1f}ms expected={expected_ms}ms")

if failures:
    print("CAN VALIDATION FAILED:"); [print(f"  {f}") for f in failures]; sys.exit(1)
print(f"CAN validation PASSED: {len(expected_cycles)} signals verified")

Summary

A production-grade AUTOSAR build pipeline automates six gates: ARXML validation, code generation with stale-detection, MISRA analysis against an approved deviation list, ROM budget enforcement from map file, post-build binary separation for field-updatable config, and CANoe-based CAN signal presence and cycle time verification. Any gate failure blocks merge to the integration branch — the cost of fixing a DaVinci validation error in CI is 5 minutes; the cost of finding the same error after flashing hardware is 5 hours.

🔬 Deep Dive — Core Concepts Expanded

This section builds on the foundational concepts covered above with additional technical depth, edge cases, and configuration nuances that separate competent engineers from experts. When working on production ECU projects, the details covered here are the ones most commonly responsible for integration delays and late-phase defects.

Key principles to reinforce:

  • Configuration over coding: In AUTOSAR and automotive middleware environments, correctness is largely determined by ARXML configuration, not application code. A correctly implemented algorithm can produce wrong results due to a single misconfigured parameter.
  • Traceability as a first-class concern: Every configuration decision should be traceable to a requirement, safety goal, or architecture decision. Undocumented configuration choices are a common source of regression defects when ECUs are updated.
  • Cross-module dependencies: In tightly integrated automotive software stacks, changing one module's configuration often requires corresponding updates in dependent modules. Always perform a dependency impact analysis before submitting configuration changes.

🏭 How This Topic Appears in Production Projects

  • Project integration phase: The concepts covered in this lesson are most commonly encountered during ECU integration testing — when multiple software components from different teams are combined for the first time. Issues that were invisible in unit tests frequently surface at this stage.
  • Supplier/OEM interface: This is a topic that frequently appears in technical discussions between Tier-1 ECU suppliers and OEM system integrators. Engineers who can speak fluently about these details earn credibility and are often brought into critical design review meetings.
  • Automotive tool ecosystem: Vector CANoe/CANalyzer, dSPACE tools, and ETAS INCA are the standard tools used to validate and measure the correct behaviour of the systems described in this lesson. Familiarity with these tools alongside the conceptual knowledge dramatically accelerates debugging in real projects.

⚠️ Common Mistakes and How to Avoid Them

  1. Assuming default configuration is correct: Automotive software tools ship with default configurations that are designed to compile and link, not to meet project-specific requirements. Every configuration parameter needs to be consciously set. 'It compiled' is not the same as 'it is correctly configured'.
  2. Skipping documentation of configuration rationale: In a 3-year ECU project with team turnover, undocumented configuration choices become tribal knowledge that disappears when engineers leave. Document why a parameter is set to a specific value, not just what it is set to.
  3. Testing only the happy path: Automotive ECUs must behave correctly under fault conditions, voltage variations, and communication errors. Always test the error handling paths as rigorously as the nominal operation. Many production escapes originate in untested error branches.
  4. Version mismatches between teams: In a multi-team project, the BSW team, SWC team, and system integration team may use different versions of the same ARXML file. Version management of all ARXML files in a shared repository is mandatory, not optional.

📊 Industry Note

Engineers who master both the theoretical concepts and the practical toolchain skills covered in this course are among the most sought-after professionals in the automotive software industry. The combination of AUTOSAR standards knowledge, safety engineering understanding, and hands-on configuration experience commands premium salaries at OEMs and Tier-1 suppliers globally.

← PreviousReducing Configuration ComplexityNext →Classic ↔ Adaptive Gateway Design