[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M735PN9VEZXSGPZHMHSDXQAN":3,"skill-same:01M735PN9VEZXSGPZHMHSDXQAN":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":6,"ownerHtmlUrl":31,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M735PN9VEZXSGPZHMHSDXQAN","automotive-hpc",null,"Automotive Hpc expertise. Covers 5 topics: Autosar Adaptive, Containerization Orchestration, Hypervisor Virtualization, Safety Certification Hpc, Vehicle Compute Platforms.","pangzhenying2025\u002Fhermes-automotive-skills","pangzhenying2025","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F213717646?v=4","01M735F4ESJ0SM29HHRG810PS8","01M735F4FX3N7R55KGY8AYBRZ0",11,"MIT","https:\u002F\u002Fgithub.com\u002Fpangzhenying2025\u002Fhermes-automotive-skills\u002Fblob\u002Fmain\u002Fskills\u002Fautomotive-hpc\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: automotive-hpc\ndescription: >\n  Automotive Hpc expertise. Covers 5 topics: Autosar Adaptive, Containerization Orchestration, Hypervisor Virtualization, Safety Certification Hpc, Vehicle Compute Platforms.\ntags: [automotive, automotive-hpc]\n---\n\n# Automotive Hpc\n\n## Autosar Adaptive\n\n# AUTOSAR Adaptive Platform for HPC\n\n**Category:** automotive-hpc\n**Version:** 1.0.0\n**Maturity:** production\n**Complexity:** advanced\n\n## Overview\n\nComprehensive guide to AUTOSAR Adaptive Platform (AP) for high-performance computing in Software-Defined Vehicles. Covers service-oriented architecture, ara::com communication, execution management, state management, and C++14 framework development.\n\n## Core Competencies\n\n### 1. AUTOSAR Adaptive Architecture\n\n**AUTOSAR Adaptive Platform Stack:**\n```\n┌─────────────────────────────────────────────────┐\n│         Adaptive Applications (C++14)           │\n├─────────────────────────────────────────────────┤\n│  ara::com  │  ara::exec │  ara::log │  ara::per│\n│  ara::diag │  ara::sm   │  ara::ucm │  ara::phm│\n├─────────────────────────────────────────────────┤\n│          Adaptive Platform Foundation           │\n│  - Communication Management (SOME\u002FIP)           │\n│  - Execution Management (Process Control)       │\n│  - State Management (Function Groups)           │\n│  - Update & Config Management                   │\n├─────────────────────────────────────────────────┤\n│       Operating System (POSIX PSE51)            │\n│  - Linux with PREEMPT_RT patch                  │\n│  - QNX 7.1 (Safety-certified option)            │\n└─────────────────────────────────────────────────┘\n```\n\n### 2. Service-Oriented Communication (ara::com)\n\n**Service Interface Definition (ARXML):**\n```xml\n\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003CAUTOSAR xmlns=\"http:\u002F\u002Fautosar.org\u002Fschema\u002Fr4.0\">\n    \u003CAR-PACKAGES>\n        \u003CAR-PACKAGE>\n            \u003CSHORT-NAME>RadarServices\u003C\u002FSHORT-NAME>\n            \u003CELEMENTS>\n                \u003C!-- Service Interface Definition -->\n                \u003CSERVICE-INTERFACE>\n                    \u003CSHORT-NAME>RadarFusion\u003C\u002FSHORT-NAME>\n                    \u003CMAJOR-VERSION>1\u003C\u002FMAJOR-VERSION>\n                    \u003CMINOR-VERSION>0\u003C\u002FMINOR-VERSION>\n\n                    \u003C!-- Events (pub\u002Fsub) -->\n                    \u003CEVENTS>\n                        \u003CVARIABLE-DATA-PROTOTYPE>\n                            \u003CSHORT-NAME>ObjectList\u003C\u002FSHORT-NAME>\n                            \u003CTYPE-TREF DEST=\"IMPLEMENTATION-DATA-TYPE\">\u002FDataTypes\u002FObjectListType\u003C\u002FTYPE-TREF>\n                        \u003C\u002FVARIABLE-DATA-PROTOTYPE>\n                        \u003CVARIABLE-DATA-PROTOTYPE>\n                            \u003CSHORT-NAME>FreeSpaceMap\u003C\u002FSHORT-NAME>\n                            \u003CTYPE-TREF DEST=\"IMPLEMENTATION-DATA-TYPE\">\u002FDataTypes\u002FFreeSpaceMapType\u003C\u002FTYPE-TREF>\n                        \u003C\u002FVARIABLE-DATA-PROTOTYPE>\n                    \u003C\u002FEVENTS>\n\n                    \u003C!-- Methods (client\u002Fserver) -->\n                    \u003CMETHODS>\n                        \u003CCLIENT-SERVER-OPERATION>\n                            \u003CSHORT-NAME>SetRadarMode\u003C\u002FSHORT-NAME>\n                            \u003CARGUMENTS>\n                                \u003CARGUMENT-DATA-PROTOTYPE>\n                                    \u003CSHORT-NAME>mode\u003C\u002FSHORT-NAME>\n                                    \u003CTYPE-TREF DEST=\"IMPLEMENTATION-DATA-TYPE\">\u002FDataTypes\u002FRadarModeType\u003C\u002FTYPE-TREF>\n                                    \u003CDIRECTION>IN\u003C\u002FDIRECTION>\n                                \u003C\u002FARGUMENT-DATA-PROTOTYPE>\n                                \u003CARGUMENT-DATA-PROTOTYPE>\n                                    \u003CSHORT-NAME>success\u003C\u002FSHORT-NAME>\n                                    \u003CTYPE-TREF DEST=\"IMPLEMENTATION-DATA-TYPE\">\u002FDataTypes\u002FBooleanType\u003C\u002FTYPE-TREF>\n                                    \u003CDIRECTION>OUT\u003C\u002FDIRECTION>\n                                \u003C\u002FARGUMENT-DATA-PROTOTYPE>\n                            \u003C\u002FARGUMENTS>\n                            \u003CPOSSIBLE-ERROR-REFS>\n                                \u003CPOSSIBLE-ERROR-REF DEST=\"APPLICATION-ERROR\">\u002FErrors\u002FInvalidModeError\u003C\u002FPOSSIBLE-ERROR-REF>\n                            \u003C\u002FPOSSIBLE-ERROR-REFS>\n                        \u003C\u002FCLIENT-SERVER-OPERATION>\n                    \u003C\u002FMETHODS>\n\n                    \u003C!-- Fields (getter\u002Fsetter) -->\n                    \u003CFIELDS>\n                        \u003CFIELD>\n                            \u003CSHORT-NAME>RadarStatus\u003C\u002FSHORT-NAME>\n                            \u003CTYPE-TREF DEST=\"IMPLEMENTATION-DATA-TYPE\">\u002FDataTypes\u002FRadarStatusType\u003C\u002FTYPE-TREF>\n                            \u003CHAS-GETTER>true\u003C\u002FHAS-GETTER>\n                            \u003CHAS-SETTER>false\u003C\u002FHAS-SETTER>\n                            \u003CHAS-NOTIFIER>true\u003C\u002FHAS-NOTIFIER>\n                        \u003C\u002FFIELD>\n                    \u003C\u002FFIELDS>\n                \u003C\u002FSERVICE-INTERFACE>\n\n                \u003C!-- Service Instance Deployment -->\n                \u003CSOMEIP-SERVICE-INSTANCE-TO-MACHINE-MAPPING>\n                    \u003CSHORT-NAME>RadarFusionInstance\u003C\u002FSHORT-NAME>\n                    \u003CCOMMUNICATION-CONNECTOR-REF DEST=\"ETHERNET-COMMUNICATION-CONNECTOR\">\n                        \u002FNetwork\u002FEthernetConnector\n                    \u003C\u002FCOMMUNICATION-CONNECTOR-REF>\n                    \u003CSERVICE-INTERFACE-DEPLOYMENT-REF DEST=\"SOMEIP-SERVICE-INTERFACE-DEPLOYMENT\">\n                        \u002FDeployments\u002FRadarFusionDeployment\n                    \u003C\u002FSERVICE-INTERFACE-DEPLOYMENT-REF>\n                    \u003CSOMEIP-SERVICE-INSTANCE-CONFIG>\n                        \u003CSERVICE-ID>0x1234\u003C\u002FSERVICE-ID>\n                        \u003CINSTANCE-ID>0x0001\u003C\u002FINSTANCE-ID>\n                        \u003CMAJOR-VERSION>1\u003C\u002FMAJOR-VERSION>\n                        \u003CMINOR-VERSION>0\u003C\u002FMINOR-VERSION>\n                        \u003CUDP-PORT>30490\u003C\u002FUDP-PORT>\n                        \u003CTCP-PORT>30491\u003C\u002FTCP-PORT>\n                    \u003C\u002FSOMEIP-SERVICE-INSTANCE-CONFIG>\n                \u003C\u002FSOMEIP-SERVICE-INSTANCE-TO-MACHINE-MAPPING>\n            \u003C\u002FELEMENTS>\n        \u003C\u002FAR-PACKAGE>\n    \u003C\u002FAR-PACKAGES>\n\u003C\u002FAUTOSAR>\n```\n\n**C++14 Service Implementation (Provider):**\n```cpp\n\u002F\u002F radar_fusion_service_impl.hpp\n#include \u003Cara\u002Fcom\u002Ftypes.h>\n#include \u003Cara\u002Fcom\u002Finstance_identifier.h>\n#include \u003Cara\u002Fcom\u002Fskeleton.h>\n#include \"radar_fusion_skeleton.h\"  \u002F\u002F Generated from ARXML\n\nnamespace radar {\nnamespace fusion {\n\nclass RadarFusionServiceImpl {\npublic:\n    RadarFusionServiceImpl()\n        : skeleton_(ara::com::InstanceIdentifier(\"RadarFusion\u002FInstance1\")) {\n\n        \u002F\u002F Register method handler\n        skeleton_.SetRadarMode.SetMethodCallHandler(\n            [this](const RadarModeType& mode) -> ara::core::Future\u003CSetRadarModeOutput> {\n                return HandleSetRadarMode(mode);\n            }\n        );\n\n        \u002F\u002F Offer service on network\n        skeleton_.OfferService();\n    }\n\n    ~RadarFusionServiceImpl() {\n        skeleton_.StopOfferService();\n    }\n\n    \u002F\u002F Publish object list event (10Hz)\n    void PublishObjectList(const ObjectListType& objects) {\n        skeleton_.ObjectList.Send(objects);\n    }\n\n    \u002F\u002F Update field value with notification\n    void UpdateRadarStatus(const RadarStatusType& status) {\n        skeleton_.RadarStatus.Update(status);\n    }\n\nprivate:\n    RadarFusionSkeleton skeleton_;\n\n    ara::core::Future\u003CSetRadarModeOutput> HandleSetRadarMode(const RadarModeType& mode) {\n        ara::core::Promise\u003CSetRadarModeOutput> promise;\n\n        if (mode \u003C RadarModeType::MIN || mode > RadarModeType::MAX) {\n            \u002F\u002F Return application error\n            promise.SetError(ara::com::ApplicationErrorDomain::Errc::kInvalidMode);\n        } else {\n            \u002F\u002F Apply mode change\n            ApplyRadarMode(mode);\n\n            SetRadarModeOutput output;\n            output.success = true;\n            promise.set_value(output);\n        }\n\n        return promise.get_future();\n    }\n\n    void ApplyRadarMode(const RadarModeType& mode) {\n        \u002F\u002F Hardware-specific mode configuration\n        \u002F\u002F ...\n    }\n};\n\n} \u002F\u002F namespace fusion\n} \u002F\u002F namespace radar\n\n\u002F\u002F Main application\nint main() {\n    ara::log::InitLogging(\"RadarFusion\", ara::log::LogLevel::kInfo);\n    ara::exec::ExecutionClient exec_client;\n\n    \u002F\u002F Report Execution State\n    exec_client.ReportExecutionState(ara::exec::ExecutionState::kRunning);\n\n    \u002F\u002F Create service\n    radar::fusion::RadarFusionServiceImpl service;\n\n    \u002F\u002F Main processing loop\n    while (!ShutdownRequested()) {\n        \u002F\u002F Process radar data\n        auto objects = ProcessRadarData();\n        service.PublishObjectList(objects);\n\n        std::this_thread::sleep_for(std::chrono::milliseconds(100));\n    }\n\n    \u002F\u002F Clean shutdown\n    exec_client.ReportExecutionState(ara::exec::ExecutionState::kTerminating);\n    return 0;\n}\n```\n\n**C++14 Service Consumer (Proxy):**\n```cpp\n\u002F\u002F adas_controller.cpp\n#include \u003Cara\u002Fcom\u002Fproxy.h>\n#include \"radar_fusion_proxy.h\"\n\nnamespace adas {\n\nclass AdasController {\npublic:\n    AdasController() {\n        \u002F\u002F Find service instances\n        auto find_handle = RadarFusionProxy::StartFindService(\n            [this](ara::com::ServiceHandleContainer\u003CRadarFusionProxy::HandleType> handles,\n                   ara::com::FindServiceHandle find_handle) {\n                this->OnServiceAvailable(std::move(handles));\n            }\n        );\n    }\n\n    void OnServiceAvailable(ara::com::ServiceHandleContainer\u003CRadarFusionProxy::HandleType> handles) {\n        if (!handles.empty()) {\n            \u002F\u002F Create proxy to first available service\n            proxy_ = std::make_unique\u003CRadarFusionProxy>(handles[0]);\n\n            \u002F\u002F Subscribe to ObjectList event\n            proxy_->ObjectList.Subscribe(10 \u002F* queue size *\u002F);\n            proxy_->ObjectList.SetReceiveHandler(\n                [this]() { this->OnObjectListReceived(); }\n            );\n\n            \u002F\u002F Subscribe to RadarStatus field changes\n            proxy_->RadarStatus.Subscribe(1);\n            proxy_->RadarStatus.SetReceiveHandler(\n                [this]() { this->OnRadarStatusChanged(); }\n            );\n\n            \u002F\u002F Call method\n            SetRadarMode(RadarModeType::LONG_RANGE);\n        }\n    }\n\n    void OnObjectListReceived() {\n        proxy_->ObjectList.GetNewSamples(\n            [this](auto sample) {\n                \u002F\u002F Process object list\n                for (const auto& obj : sample->objects) {\n                    ProcessDetectedObject(obj);\n                }\n            }\n        );\n    }\n\n    void OnRadarStatusChanged() {\n        auto status = proxy_->RadarStatus.Get();\n        ara::log::LogInfo() \u003C\u003C \"Radar status: \" \u003C\u003C status.value();\n    }\n\n    void SetRadarMode(RadarModeType mode) {\n        \u002F\u002F Async method call\n        auto future = proxy_->SetRadarMode(mode);\n\n        future.then([](ara::core::Future\u003CSetRadarModeOutput> result) {\n            if (result.HasValue()) {\n                auto output = result.GetResult();\n                if (output.value().success) {\n                    ara::log::LogInfo() \u003C\u003C \"Mode change successful\";\n                }\n            } else {\n                auto error = result.GetError();\n                ara::log::LogError() \u003C\u003C \"Mode change failed: \" \u003C\u003C error;\n            }\n        });\n    }\n\nprivate:\n    std::unique_ptr\u003CRadarFusionProxy> proxy_;\n\n    void ProcessDetectedObject(const ObjectType& obj) {\n        \u002F\u002F ADAS processing logic\n        \u002F\u002F ...\n    }\n};\n\n} \u002F\u002F namespace adas\n```\n\n### 3. Execution Management (ara::exec)\n\n**Application Manifest (JSON):**\n```json\n{\n  \"ApplicationManifest\": {\n    \"shortName\": \"RadarFusionApp\",\n    \"executableName\": \"radar_fusion\",\n    \"version\": \"1.0.0\",\n\n    \"processDesign\": {\n      \"executable\": \"\u002Fopt\u002Fautosar\u002Fbin\u002Fradar_fusion\",\n      \"arguments\": [\"--config\", \"\u002Fetc\u002Fautosar\u002Fradar_fusion.yaml\"],\n      \"environmentVariables\": {\n        \"LD_LIBRARY_PATH\": \"\u002Fopt\u002Fautosar\u002Flib\",\n        \"LOG_LEVEL\": \"INFO\"\n      }\n    },\n\n    \"resourceGroups\": [\n      {\n        \"name\": \"RadarFusionResources\",\n        \"cpuCores\": [4, 5, 6, 7],\n        \"memoryMB\": 512,\n        \"priority\": 80,\n        \"schedulingPolicy\": \"SCHED_FIFO\"\n      }\n    ],\n\n    \"startupConfig\": {\n      \"functionGroup\": \"DrivingMode\",\n      \"startupTimeout\": 5000,\n      \"dependsOn\": [\n        \"SensorAcquisition\",\n        \"NetworkStack\"\n      ]\n    },\n\n    \"stateManagement\": {\n      \"functionGroup\": \"DrivingMode\",\n      \"states\": [\n        {\n          \"name\": \"Startup\",\n          \"timeout\": 2000\n        },\n        {\n          \"name\": \"Running\",\n          \"timeout\": -1\n        },\n        {\n          \"name\": \"Degraded\",\n          \"timeout\": -1\n        },\n        {\n          \"name\": \"Shutdown\",\n          \"timeout\": 5000\n        }\n      ]\n    },\n\n    \"healthMonitoring\": {\n      \"checkpoints\": [\n        {\n          \"name\": \"DataProcessing\",\n          \"maxInterval\": 200\n        },\n        {\n          \"name\": \"NetworkCommunication\",\n          \"maxInterval\": 1000\n        }\n      ],\n      \"aliveSupervision\": {\n        \"expectedAliveIndications\": 10,\n        \"minInterval\": 50,\n        \"maxInterval\": 150\n      }\n    }\n  }\n}\n```\n\n**Execution Client Implementation:**\n```cpp\n\u002F\u002F execution_manager.cpp\n#include \u003Cara\u002Fexec\u002Fexecution_client.h>\n#include \u003Cara\u002Fexec\u002Fstate_client.h>\n#include \u003Cara\u002Fphm\u002Fsupervised_entity.h>\n\nnamespace radar {\nnamespace exec {\n\nclass ExecutionManager {\npublic:\n    ExecutionManager()\n        : exec_client_(),\n          state_client_(),\n          supervised_entity_(\"RadarFusion\") {\n\n        \u002F\u002F Register state transition handler\n        state_client_.SetStateTransitionHandler(\n            [this](ara::exec::StateTransition transition) {\n                this->HandleStateTransition(transition);\n            }\n        );\n    }\n\n    void Initialize() {\n        \u002F\u002F Report to Execution Management that we're starting\n        exec_client_.ReportExecutionState(ara::exec::ExecutionState::kRunning);\n\n        \u002F\u002F Report checkpoint during initialization\n        supervised_entity_.ReportCheckpoint(\n            ara::phm::CheckpointIdentifier(\"Initialization\")\n        );\n\n        \u002F\u002F Load configuration\n        LoadConfiguration();\n\n        \u002F\u002F Initialize hardware\n        InitializeRadarHardware();\n\n        \u002F\u002F Start alive supervision\n        StartAlivenessMonitoring();\n    }\n\n    void Run() {\n        while (!shutdown_requested_) {\n            \u002F\u002F Report alive indication\n            supervised_entity_.ReportAlive();\n\n            \u002F\u002F Main processing\n            ProcessRadarData();\n\n            \u002F\u002F Report data processing checkpoint\n            supervised_entity_.ReportCheckpoint(\n                ara::phm::CheckpointIdentifier(\"DataProcessing\")\n            );\n\n            std::this_thread::sleep_for(std::chrono::milliseconds(100));\n        }\n    }\n\n    void Shutdown() {\n        \u002F\u002F Stop processing\n        StopRadarHardware();\n\n        \u002F\u002F Report terminating state\n        exec_client_.ReportExecutionState(ara::exec::ExecutionState::kTerminating);\n    }\n\nprivate:\n    ara::exec::ExecutionClient exec_client_;\n    ara::exec::StateClient state_client_;\n    ara::phm::SupervisedEntity supervised_entity_;\n    std::atomic\u003Cbool> shutdown_requested_{false};\n\n    void HandleStateTransition(ara::exec::StateTransition transition) {\n        ara::log::LogInfo() \u003C\u003C \"State transition: \"\n                           \u003C\u003C transition.from_state \u003C\u003C \" -> \"\n                           \u003C\u003C transition.to_state;\n\n        if (transition.to_state == \"Shutdown\") {\n            shutdown_requested_ = true;\n        } else if (transition.to_state == \"Degraded\") {\n            EnterDegradedMode();\n        }\n    }\n\n    void StartAlivenessMonitoring() {\n        \u002F\u002F Start thread for periodic alive reporting\n        alive_thread_ = std::thread([this]() {\n            while (!shutdown_requested_) {\n                supervised_entity_.ReportAlive();\n                std::this_thread::sleep_for(std::chrono::milliseconds(100));\n            }\n        });\n    }\n\n    void ProcessRadarData() {\n        \u002F\u002F Radar processing logic\n    }\n\n    void EnterDegradedMode() {\n        \u002F\u002F Reduce functionality for degraded operation\n        ara::log::LogWarn() \u003C\u003C \"Entering degraded mode\";\n    }\n\n    std::thread alive_thread_;\n};\n\n} \u002F\u002F namespace exec\n} \u002F\u002F namespace radar\n\nint main() {\n    radar::exec::ExecutionManager manager;\n\n    try {\n        manager.Initialize();\n        manager.Run();\n        manager.Shutdown();\n    } catch (const std::exception& e) {\n        ara::log::LogFatal() \u003C\u003C \"Fatal error: \" \u003C\u003C e.what();\n        return EXIT_FAILURE;\n    }\n\n    return EXIT_SUCCESS;\n}\n```\n\n### 4. State Management (ara::sm)\n\n**Function Group State Machine:**\n```cpp\n\u002F\u002F state_machine.cpp\n#include \u003Cara\u002Fsm\u002Fstate_client.h>\n#include \u003Cara\u002Fsm\u002Ftrigger_out.h>\n\nnamespace vehicle {\nnamespace sm {\n\nenum class VehicleMode {\n    OFF,\n    STANDBY,\n    DRIVING,\n    PARKING,\n    CHARGING,\n    DIAGNOSTIC\n};\n\nclass VehicleStateManager {\npublic:\n    VehicleStateManager() {\n        \u002F\u002F Subscribe to function group state changes\n        state_client_.SetStateTransitionHandler(\n            [this](const ara::sm::FunctionGroupState& state) {\n                this->OnStateChange(state);\n            }\n        );\n\n        \u002F\u002F Register trigger providers\n        RegisterTriggers();\n    }\n\n    void RequestModeChange(VehicleMode target_mode) {\n        ara::sm::FunctionGroupState target_state;\n\n        switch (target_mode) {\n            case VehicleMode::DRIVING:\n                target_state = ara::sm::FunctionGroupState(\"DrivingMode\");\n                break;\n            case VehicleMode::PARKING:\n                target_state = ara::sm::FunctionGroupState(\"ParkingMode\");\n                break;\n            case VehicleMode::CHARGING:\n                target_state = ara::sm::FunctionGroupState(\"ChargingMode\");\n                break;\n            default:\n                ara::log::LogError() \u003C\u003C \"Invalid mode requested\";\n                return;\n        }\n\n        \u002F\u002F Request state transition\n        auto result = state_client_.SetState(target_state);\n        result.then([target_mode](ara::core::Future\u003Cvoid> future) {\n            if (future.has_value()) {\n                ara::log::LogInfo() \u003C\u003C \"Mode change to \"\n                                   \u003C\u003C static_cast\u003Cint>(target_mode)\n                                   \u003C\u003C \" successful\";\n            } else {\n                ara::log::LogError() \u003C\u003C \"Mode change failed: \"\n                                    \u003C\u003C future.GetError().Message();\n            }\n        });\n    }\n\nprivate:\n    ara::sm::StateClient state_client_;\n    std::unique_ptr\u003Cara::sm::TriggerOut> ignition_trigger_;\n    std::unique_ptr\u003Cara::sm::TriggerOut> charging_trigger_;\n\n    void RegisterTriggers() {\n        \u002F\u002F Register ignition trigger\n        ignition_trigger_ = std::make_unique\u003Cara::sm::TriggerOut>(\n            ara::sm::TriggerIdentifier(\"IgnitionOn\")\n        );\n\n        \u002F\u002F Register charging trigger\n        charging_trigger_ = std::make_unique\u003Cara::sm::TriggerOut>(\n            ara::sm::TriggerIdentifier(\"ChargingConnected\")\n        );\n    }\n\n    void OnStateChange(const ara::sm::FunctionGroupState& state) {\n        ara::log::LogInfo() \u003C\u003C \"Function group state changed to: \" \u003C\u003C state;\n\n        if (state == \"DrivingMode\") {\n            EnableDrivingFunctions();\n        } else if (state == \"ParkingMode\") {\n            EnableParkingFunctions();\n        } else if (state == \"ChargingMode\") {\n            EnableChargingFunctions();\n        }\n    }\n\n    void EnableDrivingFunctions() {\n        \u002F\u002F Activate ADAS, powertrain control, etc.\n        ara::log::LogInfo() \u003C\u003C \"Driving functions enabled\";\n    }\n\n    void EnableParkingFunctions() {\n        \u002F\u002F Activate parking assist, surround view, etc.\n        ara::log::LogInfo() \u003C\u003C \"Parking functions enabled\";\n    }\n\n    void EnableChargingFunctions() {\n        \u002F\u002F Activate battery management, charging control\n        ara::log::LogInfo() \u003C\u003C \"Charging functions enabled\";\n    }\n};\n\n} \u002F\u002F namespace sm\n} \u002F\u002F namespace vehicle\n```\n\n### 5. Platform Health Management (ara::phm)\n\n**Health Monitoring Implementation:**\n```cpp\n\u002F\u002F health_monitor.cpp\n#include \u003Cara\u002Fphm\u002Frecovery_action.h>\n#include \u003Cara\u002Fphm\u002Fhealth_channel.h>\n\nnamespace platform {\nnamespace health {\n\nclass HealthMonitor {\npublic:\n    HealthMonitor() {\n        \u002F\u002F Create health channels\n        sensor_health_ = std::make_unique\u003Cara::phm::HealthChannel>(\n            ara::phm::HealthChannelId(\"SensorHealth\")\n        );\n\n        computation_health_ = std::make_unique\u003Cara::phm::HealthChannel>(\n            ara::phm::HealthChannelId(\"ComputationHealth\")\n        );\n\n        \u002F\u002F Register recovery actions\n        RegisterRecoveryActions();\n    }\n\n    void MonitorSensorHealth(const SensorData& data) {\n        if (!ValidateSensorData(data)) {\n            \u002F\u002F Report health status degraded\n            sensor_health_->ReportHealthStatus(\n                ara::phm::HealthStatus::kDegraded,\n                ara::phm::HealthStatusCause::kInvalidData\n            );\n\n            \u002F\u002F Trigger recovery action\n            recovery_action_->Invoke();\n        } else {\n            sensor_health_->ReportHealthStatus(\n                ara::phm::HealthStatus::kOk\n            );\n        }\n    }\n\n    void MonitorComputationLoad() {\n        float cpu_usage = GetCPUUsage();\n        float memory_usage = GetMemoryUsage();\n\n        if (cpu_usage > 95.0 || memory_usage > 90.0) {\n            computation_health_->ReportHealthStatus(\n                ara::phm::HealthStatus::kDegraded,\n                ara::phm::HealthStatusCause::kResourceExhaustion\n            );\n\n            \u002F\u002F Reduce processing load\n            ReduceComputationLoad();\n        }\n    }\n\nprivate:\n    std::unique_ptr\u003Cara::phm::HealthChannel> sensor_health_;\n    std::unique_ptr\u003Cara::phm::HealthChannel> computation_health_;\n    std::unique_ptr\u003Cara::phm::RecoveryAction> recovery_action_;\n\n    void RegisterRecoveryActions() {\n        recovery_action_ = std::make_unique\u003Cara::phm::RecoveryAction>(\n            ara::phm::RecoveryActionId(\"SensorRecovery\"),\n            [this]() {\n                \u002F\u002F Recovery logic: restart sensor, use fallback data, etc.\n                ara::log::LogWarn() \u003C\u003C \"Executing sensor recovery\";\n                RestartSensorInterface();\n            }\n        );\n    }\n\n    bool ValidateSensorData(const SensorData& data) {\n        return data.timestamp_valid &&\n               data.crc_valid &&\n               data.alive_counter_sequential;\n    }\n\n    void RestartSensorInterface() {\n        \u002F\u002F Sensor restart logic\n    }\n\n    void ReduceComputationLoad() {\n        \u002F\u002F Temporarily disable non-critical features\n    }\n\n    float GetCPUUsage() { return 0.0; }  \u002F\u002F Implementation\n    float GetMemoryUsage() { return 0.0; }  \u002F\u002F Implementation\n};\n\n} \u002F\u002F namespace health\n} \u002F\u002F namespace platform\n```\n\n## Use Cases\n\n1. **L3+ Autonomous Driving**: ADAS applications using ara::com for sensor fusion\n2. **OTA Updates**: ara::ucm for safe software updates with rollback\n3. **Zone Controllers**: Service-oriented communication between domain controllers\n4. **Cloud Connectivity**: ara::rest for vehicle-to-cloud data exchange\n\n## Automotive Standards\n\n- **AUTOSAR R22-11**: Latest Adaptive Platform specification\n- **ISO 26262 ASIL-D**: Safety-critical application development\n- **ISO 21434**: Cybersecurity for service communication\n- **ASPICE CL3**: Software development process compliance\n\n## Tools Required\n\n- **Vector DaVinci**: ARXML editing and code generation\n- **EB tresos AdaptiveCore**: AUTOSAR Adaptive middleware\n- **Elektrobit EB corbos**: Adaptive Platform implementation\n- **COVESA VSS**: Vehicle Signal Specification integration\n\n## Performance Metrics\n\n- **Service Discovery**: \u003C100ms to find and bind to service\n- **Event Throughput**: >10,000 events\u002Fsec via SOME\u002FIP\n- **Method Call Latency**: \u003C2ms round-trip for local services\n- **Memory Footprint**: \u003C50MB for Adaptive Platform runtime\n\n## References\n\n- AUTOSAR Adaptive Platform Release 22-11 Specification\n- \"AUTOSAR Adaptive Platform Explained\" (AUTOSAR Whitepaper)\n- ISO 26262-6:2018 Software Development Guidelines\n- COVESA Vehicle Signal Specification\n\n---\n\n**Version:** 1.0.0\n**Last Updated:** 2026-03-19\n**Author:** Automotive Claude Code Agents\n\n---\n\n## Containerization Orchestration\n\n# Containerization and Orchestration for Automotive HPC\n\n**Category:** automotive-hpc\n**Version:** 1.0.0\n**Maturity:** production\n**Complexity:** advanced\n\n## Overview\n\nComprehensive guide to container technologies and orchestration for automotive HPC platforms. Covers Docker, Podman, Kubernetes for vehicles, application lifecycle management, and OTA container updates with safety considerations.\n\n## Core Competencies\n\n### 1. Automotive Container Architecture\n\n**Why Containers in Automotive:**\n- **Rapid Updates**: Deploy new algorithms without full ECU reflash\n- **Isolation**: Separate safety-critical from non-critical workloads\n- **Portability**: Same container runs on test bench, HIL, and production vehicle\n- **Resource Control**: cgroups for CPU\u002Fmemory limits per ASIL level\n- **Versioning**: Atomic rollback for failed updates\n\n**Container vs Traditional ECU:**\n```\nTraditional ECU:               Containerized Platform:\n┌──────────────────┐          ┌─────────────────────────────┐\n│   App Binary     │          │ Container 1: ADAS (ASIL-D)  │\n│   (Monolithic)   │          │ Container 2: IVI (QM)       │\n├──────────────────┤          │ Container 3: Telematics     │\n│   AUTOSAR RTE    │          ├─────────────────────────────┤\n├──────────────────┤          │ Container Runtime (containerd)│\n│   OS (QNX\u002FLinux) │          ├─────────────────────────────┤\n│   Bare Metal     │          │ OS (Linux\u002FQNX)              │\n└──────────────────┘          └─────────────────────────────┘\nUpdate: Full flash (30min)    Update: Container only (2min)\n```\n\n### 2. Container Runtime for Automotive\n\n#### Docker for Development\n\n**Dockerfile for ADAS Application:**\n```dockerfile\n# Multi-stage build for ADAS perception pipeline\nFROM nvcr.io\u002Fnvidia\u002Fl4t-base:r35.3.1 AS builder\n\n# Install build dependencies\nRUN apt-get update && apt-get install -y \\\n    build-essential \\\n    cmake \\\n    cuda-toolkit-11-4 \\\n    libeigen3-dev \\\n    libopencv-dev \\\n    && rm -rf \u002Fvar\u002Flib\u002Fapt\u002Flists\u002F*\n\n# Build ADAS application\nWORKDIR \u002Fapp\nCOPY src\u002F \u002Fapp\u002Fsrc\u002F\nCOPY CMakeLists.txt \u002Fapp\u002F\n\nRUN mkdir build && cd build && \\\n    cmake -DCMAKE_BUILD_TYPE=Release .. && \\\n    make -j$(nproc)\n\n# Runtime stage (minimal image)\nFROM nvcr.io\u002Fnvidia\u002Fl4t-base:r35.3.1\n\n# Install runtime dependencies only\nRUN apt-get update && apt-get install -y \\\n    libopencv-core4.5d \\\n    libopencv-imgproc4.5d \\\n    cuda-cudart-11-4 \\\n    && rm -rf \u002Fvar\u002Flib\u002Fapt\u002Flists\u002F*\n\n# Copy only built artifacts\nCOPY --from=builder \u002Fapp\u002Fbuild\u002Fadas_perception \u002Fusr\u002Flocal\u002Fbin\u002F\nCOPY --from=builder \u002Fapp\u002Fmodels\u002F \u002Fopt\u002Fmodels\u002F\n\n# Non-root user for security\nRUN useradd -m -u 1000 adas && \\\n    chown -R adas:adas \u002Fopt\u002Fmodels\n\nUSER adas\n\n# CUDA device access\nENV NVIDIA_VISIBLE_DEVICES all\nENV NVIDIA_DRIVER_CAPABILITIES compute,utility\n\n# Health check\nHEALTHCHECK --interval=5s --timeout=3s --retries=3 \\\n    CMD \u002Fusr\u002Flocal\u002Fbin\u002Fadas_perception --health-check\n\nENTRYPOINT [\"\u002Fusr\u002Flocal\u002Fbin\u002Fadas_perception\"]\nCMD [\"--config\", \"\u002Fetc\u002Fadas\u002Fconfig.yaml\"]\n```\n\n**Docker Compose for Development Environment:**\n```yaml\n# docker-compose.yaml - Local ADAS development\nversion: '3.8'\n\nservices:\n  # Sensor simulation\n  sensor_sim:\n    image: autoware\u002Fsensor-simulator:latest\n    volumes:\n      - .\u002Fdata\u002Frosbag:\u002Fdata:ro\n    networks:\n      - vehicle_net\n    command: [\"--replay\", \"\u002Fdata\u002Ftest_drive.bag\"]\n\n  # ADAS perception\n  adas_perception:\n    build:\n      context: .\n      dockerfile: Dockerfile\n    runtime: nvidia\n    environment:\n      - CUDA_VISIBLE_DEVICES=0\n      - ROS_MASTER_URI=http:\u002F\u002Fsensor_sim:11311\n    volumes:\n      - .\u002Fmodels:\u002Fopt\u002Fmodels:ro\n      - .\u002Flogs:\u002Fvar\u002Flog\u002Fadas:rw\n    networks:\n      - vehicle_net\n    depends_on:\n      - sensor_sim\n    deploy:\n      resources:\n        limits:\n          cpus: '4'\n          memory: 4G\n        reservations:\n          devices:\n            - driver: nvidia\n              count: 1\n              capabilities: [gpu]\n\n  # Visualization\n  rviz:\n    image: osrf\u002Fros:noetic-desktop-full\n    environment:\n      - DISPLAY=$DISPLAY\n      - ROS_MASTER_URI=http:\u002F\u002Fsensor_sim:11311\n    volumes:\n      - \u002Ftmp\u002F.X11-unix:\u002Ftmp\u002F.X11-unix:rw\n    networks:\n      - vehicle_net\n    depends_on:\n      - adas_perception\n\nnetworks:\n  vehicle_net:\n    driver: bridge\n```\n\n#### Podman for Production (Rootless & Daemonless)\n\n**Why Podman for Automotive:**\n- **Rootless**: Better security, no privileged daemon\n- **Systemd Integration**: Native systemd unit generation\n- **OCI Compliant**: Compatible with Kubernetes\n- **No Daemon**: Reduces attack surface\n\n**Podman Container for Safety-Critical ADAS:**\n```bash\n#!\u002Fbin\u002Fbash\n# Build and run ADAS container with Podman\n\n# Build image\npodman build -t adas-perception:1.0.0 -f Dockerfile.adas .\n\n# Run with systemd integration and resource limits\npodman run -d \\\n  --name adas-safety \\\n  --security-opt label=type:adas_t \\\n  --cap-drop=ALL \\\n  --cap-add=SYS_NICE \\\n  --cpuset-cpus=4-7 \\\n  --memory=4G \\\n  --memory-swap=0 \\\n  --oom-score-adj=-1000 \\\n  --device=\u002Fdev\u002Fnvidia0 \\\n  --device=\u002Fdev\u002Fcan0 \\\n  --volume=\u002Fetc\u002Fadas\u002Fconfig.yaml:\u002Fetc\u002Fadas\u002Fconfig.yaml:ro,Z \\\n  --volume=\u002Fvar\u002Flog\u002Fadas:\u002Fvar\u002Flog\u002Fadas:rw,Z \\\n  --network=host \\\n  --restart=on-failure:3 \\\n  adas-perception:1.0.0\n\n# Generate systemd service\npodman generate systemd --new --name adas-safety \\\n  --restart-policy=always \\\n  --start-timeout=30 \\\n  --stop-timeout=10 \\\n  > \u002Fetc\u002Fsystemd\u002Fsystem\u002Fadas-safety.service\n\nsystemctl enable adas-safety.service\nsystemctl start adas-safety.service\n```\n\n### 3. Kubernetes for Automotive\n\n**Lightweight Kubernetes Distributions:**\n- **K3s**: Minimal Kubernetes (40MB binary) for edge\u002Fembedded\n- **MicroK8s**: Snap-based, fast cluster setup\n- **KubeEdge**: Extends Kubernetes to edge devices\n\n**K3s Installation on Vehicle ECU:**\n```bash\n#!\u002Fbin\u002Fbash\n# Install K3s on automotive HPC (NVIDIA Orin)\n\n# Install K3s server (control plane + worker)\ncurl -sfL https:\u002F\u002Fget.k3s.io | sh -s - \\\n  --disable traefik \\\n  --disable servicelb \\\n  --kubelet-arg=\"cpu-manager-policy=static\" \\\n  --kubelet-arg=\"topology-manager-policy=single-numa-node\" \\\n  --kubelet-arg=\"reserved-cpus=0-1\" \\\n  --kubelet-arg=\"system-reserved=cpu=2,memory=2Gi\" \\\n  --kube-apiserver-arg=\"feature-gates=CPUManager=true,TopologyManager=true\"\n\n# Install NVIDIA GPU device plugin\nkubectl apply -f https:\u002F\u002Fraw.githubusercontent.com\u002FNVIDIA\u002Fk8s-device-plugin\u002Fmain\u002Fnvidia-device-plugin.yml\n\n# Verify installation\nkubectl get nodes\nkubectl describe node $(hostname)\n```\n\n**ADAS Deployment Manifest:**\n```yaml\n# adas-deployment.yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: adas-safety\n  labels:\n    asil: \"d\"\n    safety-critical: \"true\"\n\n---\n# ConfigMap for ADAS configuration\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: adas-config\n  namespace: adas-safety\ndata:\n  config.yaml: |\n    perception:\n      camera_count: 8\n      lidar_enabled: true\n      radar_count: 5\n      fusion_rate_hz: 10\n    planning:\n      algorithm: \"model_predictive_control\"\n      horizon_seconds: 5\n      safety_margin_meters: 2.0\n\n---\n# ADAS Perception Deployment\napiVersion: apps\u002Fv1\nkind: Deployment\nmetadata:\n  name: adas-perception\n  namespace: adas-safety\n  labels:\n    app: adas-perception\n    asil: \"d\"\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: adas-perception\n  template:\n    metadata:\n      labels:\n        app: adas-perception\n        asil: \"d\"\n    spec:\n      # Node affinity for HPC cores\n      affinity:\n        nodeAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n            nodeSelectorTerms:\n            - matchExpressions:\n              - key: node-role.kubernetes.io\u002Fhpc\n                operator: In\n                values:\n                - \"true\"\n\n      # Host networking for low-latency CAN\u002FEthernet\n      hostNetwork: true\n      dnsPolicy: ClusterFirstWithHostNet\n\n      # Security context\n      securityContext:\n        runAsNonRoot: true\n        runAsUser: 1000\n        fsGroup: 1000\n        seccompProfile:\n          type: RuntimeDefault\n\n      containers:\n      - name: perception\n        image: adas-perception:1.0.0\n        imagePullPolicy: IfNotPresent\n\n        # Resource requests\u002Flimits (guaranteed QoS)\n        resources:\n          requests:\n            cpu: \"4\"\n            memory: \"4Gi\"\n            nvidia.com\u002Fgpu: \"1\"\n          limits:\n            cpu: \"4\"\n            memory: \"4Gi\"\n            nvidia.com\u002Fgpu: \"1\"\n\n        # Environment variables\n        env:\n        - name: CUDA_VISIBLE_DEVICES\n          value: \"0\"\n        - name: OMP_NUM_THREADS\n          value: \"4\"\n\n        # Volume mounts\n        volumeMounts:\n        - name: config\n          mountPath: \u002Fetc\u002Fadas\n          readOnly: true\n        - name: models\n          mountPath: \u002Fopt\u002Fmodels\n          readOnly: true\n        - name: logs\n          mountPath: \u002Fvar\u002Flog\u002Fadas\n        - name: dev-can\n          mountPath: \u002Fdev\u002Fcan0\n\n        # Liveness probe\n        livenessProbe:\n          exec:\n            command:\n            - \u002Fusr\u002Flocal\u002Fbin\u002Fhealth-check\n            - --type=liveness\n          initialDelaySeconds: 30\n          periodSeconds: 10\n          timeoutSeconds: 5\n          failureThreshold: 3\n\n        # Readiness probe\n        readinessProbe:\n          exec:\n            command:\n            - \u002Fusr\u002Flocal\u002Fbin\u002Fhealth-check\n            - --type=readiness\n          initialDelaySeconds: 10\n          periodSeconds: 5\n          timeoutSeconds: 3\n\n        # Security capabilities\n        securityContext:\n          allowPrivilegeEscalation: false\n          capabilities:\n            drop:\n            - ALL\n            add:\n            - SYS_NICE  # For RT scheduling\n          readOnlyRootFilesystem: true\n\n      # Volumes\n      volumes:\n      - name: config\n        configMap:\n          name: adas-config\n      - name: models\n        hostPath:\n          path: \u002Fopt\u002Fadas\u002Fmodels\n          type: Directory\n      - name: logs\n        emptyDir:\n          sizeLimit: 1Gi\n      - name: dev-can\n        hostPath:\n          path: \u002Fdev\u002Fcan0\n          type: CharDevice\n\n      # Tolerations for dedicated HPC nodes\n      tolerations:\n      - key: \"hpc\"\n        operator: \"Equal\"\n        value: \"true\"\n        effect: \"NoSchedule\"\n\n      # Priority class for safety-critical workload\n      priorityClassName: safety-critical\n\n---\n# PriorityClass for ASIL-D workloads\napiVersion: scheduling.k8s.io\u002Fv1\nkind: PriorityClass\nmetadata:\n  name: safety-critical\nvalue: 1000000\nglobalDefault: false\ndescription: \"Reserved for ASIL-D safety-critical applications\"\n```\n\n### 4. OTA Container Updates\n\n**Safe OTA Update Strategy:**\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"\nAutomotive OTA Container Update Manager\nImplements A\u002FB partition scheme for safe rollback\n\"\"\"\n\nimport subprocess\nimport json\nimport hashlib\nfrom enum import Enum\nfrom dataclasses import dataclass\nfrom typing import Optional\n\nclass UpdateStatus(Enum):\n    IDLE = \"idle\"\n    DOWNLOADING = \"downloading\"\n    VALIDATING = \"validating\"\n    INSTALLING = \"installing\"\n    TESTING = \"testing\"\n    COMMITTED = \"committed\"\n    ROLLING_BACK = \"rolling_back\"\n    FAILED = \"failed\"\n\n@dataclass\nclass ContainerUpdate:\n    name: str\n    current_version: str\n    target_version: str\n    image_url: str\n    checksum_sha256: str\n    asil_level: str\n\nclass OTAUpdateManager:\n    def __init__(self):\n        self.update_partition = \"B\"  # A=active, B=update\n        self.status = UpdateStatus.IDLE\n\n    def update_container(self, update: ContainerUpdate) -> bool:\n        \"\"\"\n        Perform safe OTA container update with rollback capability\n        \"\"\"\n        try:\n            # 1. Pre-update validation\n            if not self.validate_preconditions(update):\n                return False\n\n            # 2. Download new container image\n            self.status = UpdateStatus.DOWNLOADING\n            if not self.download_image(update):\n                return False\n\n            # 3. Validate checksum\n            self.status = UpdateStatus.VALIDATING\n            if not self.verify_checksum(update):\n                return False\n\n            # 4. Install to inactive partition\n            self.status = UpdateStatus.INSTALLING\n            if not self.install_to_partition(update, self.update_partition):\n                return False\n\n            # 5. Test new version (smoke test)\n            self.status = UpdateStatus.TESTING\n            if not self.smoke_test(update):\n                self.rollback(update)\n                return False\n\n            # 6. Commit update (switch active partition)\n            self.status = UpdateStatus.COMMITTED\n            self.commit_update(update)\n\n            # 7. Monitor for stability (2 minutes)\n            if not self.monitor_stability(update, duration_sec=120):\n                self.rollback(update)\n                return False\n\n            self.status = UpdateStatus.IDLE\n            return True\n\n        except Exception as e:\n            self.status = UpdateStatus.FAILED\n            print(f\"Update failed: {e}\")\n            self.rollback(update)\n            return False\n\n    def validate_preconditions(self, update: ContainerUpdate) -> bool:\n        \"\"\"Check vehicle state before update\"\"\"\n        # Don't update while driving\n        vehicle_speed = self.get_vehicle_speed()\n        if vehicle_speed > 0:\n            print(\"Update blocked: Vehicle in motion\")\n            return False\n\n        # Check battery SOC (>20% for safety)\n        if self.get_battery_soc() \u003C 20.0:\n            print(\"Update blocked: Low battery\")\n            return False\n\n        # Verify parking brake engaged\n        if not self.is_parking_brake_engaged():\n            print(\"Update blocked: Parking brake not engaged\")\n            return False\n\n        return True\n\n    def download_image(self, update: ContainerUpdate) -> bool:\n        \"\"\"Download container image from OTA server\"\"\"\n        print(f\"Downloading {update.name}:{update.target_version}\")\n\n        result = subprocess.run([\n            'podman', 'pull',\n            f'{update.image_url}:{update.target_version}'\n        ], capture_output=True, text=True)\n\n        return result.returncode == 0\n\n    def verify_checksum(self, update: ContainerUpdate) -> bool:\n        \"\"\"Verify image integrity\"\"\"\n        result = subprocess.run([\n            'podman', 'image', 'inspect',\n            f'{update.image_url}:{update.target_version}',\n            '--format', '{{.Id}}'\n        ], capture_output=True, text=True)\n\n        image_id = result.stdout.strip()\n        # Extract SHA256 from image ID (sha256:abc123...)\n        actual_checksum = image_id.split(':')[1][:64]\n\n        if actual_checksum != update.checksum_sha256:\n            print(f\"Checksum mismatch: {actual_checksum} != {update.checksum_sha256}\")\n            return False\n\n        return True\n\n    def install_to_partition(self, update: ContainerUpdate, partition: str) -> bool:\n        \"\"\"Install container to inactive partition\"\"\"\n        # Tag image for specific partition\n        subprocess.run([\n            'podman', 'tag',\n            f'{update.image_url}:{update.target_version}',\n            f'{update.name}:partition-{partition}'\n        ])\n\n        # Create new container (don't start yet)\n        result = subprocess.run([\n            'podman', 'create',\n            '--name', f'{update.name}-{partition}',\n            '--cpuset-cpus', '4-7',\n            '--memory', '4G',\n            f'{update.name}:partition-{partition}'\n        ], capture_output=True, text=True)\n\n        return result.returncode == 0\n\n    def smoke_test(self, update: ContainerUpdate) -> bool:\n        \"\"\"Start container and verify basic functionality\"\"\"\n        container_name = f'{update.name}-{self.update_partition}'\n\n        # Start container\n        subprocess.run(['podman', 'start', container_name])\n\n        # Wait for container to be ready\n        import time\n        time.sleep(5)\n\n        # Check health endpoint\n        result = subprocess.run([\n            'podman', 'exec', container_name,\n            '\u002Fusr\u002Flocal\u002Fbin\u002Fhealth-check'\n        ], capture_output=True)\n\n        if result.returncode != 0:\n            print(\"Smoke test failed: Health check returned error\")\n            subprocess.run(['podman', 'stop', container_name])\n            return False\n\n        # For ASIL-D: Run extended validation\n        if update.asil_level == \"D\":\n            if not self.asil_d_validation(container_name):\n                subprocess.run(['podman', 'stop', container_name])\n                return False\n\n        return True\n\n    def commit_update(self, update: ContainerUpdate):\n        \"\"\"Switch active partition\"\"\"\n        old_container = f'{update.name}-A'\n        new_container = f'{update.name}-{self.update_partition}'\n\n        # Stop old version\n        subprocess.run(['podman', 'stop', old_container])\n\n        # Rename containers (swap partitions)\n        subprocess.run(['podman', 'rename', old_container, f'{update.name}-OLD'])\n        subprocess.run(['podman', 'rename', new_container, old_container])\n\n        # Update systemd service to point to new container\n        subprocess.run(['systemctl', 'restart', f'{update.name}.service'])\n\n    def monitor_stability(self, update: ContainerUpdate, duration_sec: int) -> bool:\n        \"\"\"Monitor container for crashes\u002Ferrors after update\"\"\"\n        import time\n        container_name = f'{update.name}-A'\n\n        start_time = time.time()\n        while time.time() - start_time \u003C duration_sec:\n            # Check if container is still running\n            result = subprocess.run([\n                'podman', 'inspect',\n                '--format', '{{.State.Running}}',\n                container_name\n            ], capture_output=True, text=True)\n\n            if result.stdout.strip() != 'true':\n                print(\"Container crashed during stability monitoring\")\n                return False\n\n            # Check error logs\n            result = subprocess.run([\n                'podman', 'logs', '--tail', '10', container_name\n            ], capture_output=True, text=True)\n\n            if 'FATAL' in result.stdout or 'CRITICAL' in result.stdout:\n                print(\"Critical errors detected in logs\")\n                return False\n\n            time.sleep(10)\n\n        return True\n\n    def rollback(self, update: ContainerUpdate):\n        \"\"\"Rollback to previous version\"\"\"\n        self.status = UpdateStatus.ROLLING_BACK\n        print(f\"Rolling back {update.name} to {update.current_version}\")\n\n        new_container = f'{update.name}-A'\n        old_container = f'{update.name}-OLD'\n\n        # Stop failed new version\n        subprocess.run(['podman', 'stop', new_container])\n\n        # Restore old version\n        subprocess.run(['podman', 'rename', new_container, f'{update.name}-FAILED'])\n        subprocess.run(['podman', 'rename', old_container, new_container])\n        subprocess.run(['podman', 'start', new_container])\n\n        # Restore systemd service\n        subprocess.run(['systemctl', 'restart', f'{update.name}.service'])\n\n    def asil_d_validation(self, container_name: str) -> bool:\n        \"\"\"Extended validation for ASIL-D containers\"\"\"\n        # Run safety test suite\n        result = subprocess.run([\n            'podman', 'exec', container_name,\n            '\u002Fusr\u002Flocal\u002Fbin\u002Fsafety-test-suite'\n        ], capture_output=True)\n\n        return result.returncode == 0\n\n    # Mock functions for vehicle state\n    def get_vehicle_speed(self) -> float:\n        return 0.0  # km\u002Fh\n\n    def get_battery_soc(self) -> float:\n        return 80.0  # %\n\n    def is_parking_brake_engaged(self) -> bool:\n        return True\n\n# Example usage\nif __name__ == '__main__':\n    manager = OTAUpdateManager()\n\n    update = ContainerUpdate(\n        name='adas-perception',\n        current_version='1.0.0',\n        target_version='1.1.0',\n        image_url='registry.oem.com\u002Fadas-perception',\n        checksum_sha256='abc123def456...',\n        asil_level='D'\n    )\n\n    success = manager.update_container(update)\n    print(f\"Update {'successful' if success else 'failed'}\")\n```\n\n### 5. Container Resource Management\n\n**CPU and Memory Isolation:**\n```yaml\n# cgroup v2 configuration for container resource limits\n# \u002Fsys\u002Ffs\u002Fcgroup\u002Fadas-perception.slice\u002Fcpu.max\n# Format: $MAX $PERIOD (microseconds)\n400000 100000  # 4 CPUs worth (4 * 100ms = 400ms per 100ms period)\n\n# \u002Fsys\u002Ffs\u002Fcgroup\u002Fadas-perception.slice\u002Fmemory.max\n4294967296  # 4 GB\n\n# \u002Fsys\u002Ffs\u002Fcgroup\u002Fadas-perception.slice\u002Fmemory.swap.max\n0  # No swap for safety-critical\n\n# \u002Fsys\u002Ffs\u002Fcgroup\u002Fadas-perception.slice\u002Fcpuset.cpus\n4-7  # Pin to CPU cores 4-7\n\n# \u002Fsys\u002Ffs\u002Fcgroup\u002Fadas-perception.slice\u002Fcpuset.mems\n0  # NUMA node 0\n```\n\n## Use Cases\n\n1. **Modular ADAS Updates**: Update perception algorithm without touching planning\u002Fcontrol\n2. **A\u002FB Testing**: Run two algorithm versions side-by-side for validation\n3. **Multi-Tenant ECU**: IVI, telematics, and ADAS on single HPC with isolation\n4. **CI\u002FCD Integration**: Automated testing and deployment pipeline\n\n## Automotive Standards\n\n- **ISO 26262**: Container isolation for FFI compliance\n- **ISO 21434**: Secure container registry and image signing\n- **ASPICE CL3**: Container lifecycle management process\n\n## Tools Required\n\n- **Docker\u002FPodman**: Container runtime\n- **K3s\u002FMicroK8s**: Lightweight Kubernetes\n- **Helm**: Kubernetes package manager\n- **Harbor**: Container registry with security scanning\n- **Notary**: Container image signing (TUF framework)\n\n## Performance Metrics\n\n- **Container Startup**: \u003C2s for ADAS application\n- **Overhead**: \u003C2% CPU, \u003C50MB memory for runtime\n- **Update Time**: \u003C5min for full container replacement\n- **Rollback Time**: \u003C30s to previous version\n\n## References\n\n- CNCF Automotive Edge Computing Whitepaper\n- AGL (Automotive Grade Linux) Container Guidelines\n- Kubernetes for Edge Computing (K3s documentation)\n- \"Containers in Safety-Critical Systems\" (SAE Paper)\n\n---\n\n**Version:** 1.0.0\n**Last Updated:** 2026-03-19\n**Author:** Automotive Claude Code Agents\n\n---\n\n## Hypervisor Virtualization\n\n# Hypervisor Virtualization for Automotive HPC\n\n**Category:** automotive-hpc\n**Version:** 1.0.0\n**Maturity:** production\n**Complexity:** advanced\n\n## Overview\n\nExpert knowledge in automotive hypervisor technologies for High-Performance Computing platforms. Covers QNX Hypervisor, ACRN, Xen, and other automotive-grade virtualization solutions for mixed-criticality systems, safety partitioning, and resource management.\n\n## Core Competencies\n\n### 1. Automotive Hypervisor Technologies\n\n#### QNX Hypervisor 2.2\n- Type 1 bare-metal hypervisor for safety-critical systems\n- ASIL-D certified for ISO 26262 compliance\n- Microkernel architecture with minimal TCB (Trusted Computing Base)\n- Hardware virtualization using ARM VE or Intel VT-x\u002FVT-d\n- Real-time guarantee preservation across VMs\n\n**QNX Hypervisor Configuration Example:**\n```xml\n\u003C?xml version=\"1.0\"?>\n\u003Csystem>\n    \u003Chypervisor>\n        \u003Cname>qnx-hypervisor\u003C\u002Fname>\n        \u003Cversion>2.2\u003C\u002Fversion>\n        \u003Cscheduler type=\"partition\">\n            \u003Cmajor_frame>10ms\u003C\u002Fmajor_frame>\n        \u003C\u002Fscheduler>\n    \u003C\u002Fhypervisor>\n\n    \u003C!-- ASIL-D Safety VM for ADAS -->\n    \u003Cguest id=\"0\" name=\"safety-vm\" asil=\"D\">\n        \u003Cos>qnx-710\u003C\u002Fos>\n        \u003Cvcpus>2\u003C\u002Fvcpus>\n        \u003Cmemory>2GB\u003C\u002Fmemory>\n        \u003Csafety_partition>\n            \u003Cinterference_freedom>guaranteed\u003C\u002Finterference_freedom>\n            \u003Cwatchdog>enabled\u003C\u002Fwatchdog>\n            \u003Cmemory_protection>mpu\u003C\u002Fmemory_protection>\n        \u003C\u002Fsafety_partition>\n        \u003Cschedule>\n            \u003Cpartition_window>6ms\u003C\u002Fpartition_window>\n            \u003Cpriority>255\u003C\u002Fpriority>\n        \u003C\u002Fschedule>\n        \u003Cdevices>\n            \u003Cpci bus=\"0\" dev=\"2\" func=\"0\" \u002F> \u003C!-- CAN controller -->\n            \u003Cinterrupt line=\"45\" \u002F>\n        \u003C\u002Fdevices>\n    \u003C\u002Fguest>\n\n    \u003C!-- QM Non-Safety VM for Infotainment -->\n    \u003Cguest id=\"1\" name=\"infotainment-vm\" asil=\"QM\">\n        \u003Cos>android-automotive-13\u003C\u002Fos>\n        \u003Cvcpus>4\u003C\u002Fvcpus>\n        \u003Cmemory>4GB\u003C\u002Fmemory>\n        \u003Cschedule>\n            \u003Cpartition_window>4ms\u003C\u002Fpartition_window>\n            \u003Cpriority>128\u003C\u002Fpriority>\n        \u003C\u002Fschedule>\n        \u003Cgpu>\n            \u003Cpassthrough device=\"\u002Fdev\u002Fgpu0\" \u002F>\n            \u003Csriov vf=\"1\" \u002F>\n        \u003C\u002Fgpu>\n    \u003C\u002Fguest>\n\u003C\u002Fsystem>\n```\n\n#### ACRN Hypervisor (Intel)\n- Open-source Type 1 hypervisor optimized for IoT and automotive\n- Safety VM (Service VM) + User VMs architecture\n- Device Model for I\u002FO virtualization\n- ACRN-DM (Device Model) for para-virtualized devices\n- Real-time VM support for safety workloads\n\n**ACRN Launch Configuration:**\n```python\n# ACRN VM Launch Script - Safety VM\nimport sys\nimport acrn_vm\n\n# Safety VM Configuration (ASIL-D)\nsafety_vm = acrn_vm.VM({\n    'name': 'RTLinux-Safety',\n    'vcpu_num': 2,\n    'memory_size': '2G',\n    'vm_type': 'RTVM',  # Real-time VM\n    'lapic_passthrough': True,\n    'ivshmem_regions': [\n        {\n            'name': 'sensor-data-region',\n            'size': '64M',\n            'shared_with': ['adas-vm', 'gateway-vm']\n        }\n    ],\n    'cpu_affinity': [0, 1],  # Pin to cores 0-1\n    'vpci_devices': [\n        {'bus': 0, 'dev': 2, 'func': 0, 'type': 'CAN'}\n    ],\n    'boot_args': 'root=\u002Fdev\u002Fsda1 rw console=ttyS0 isolcpus=0,1'\n})\n\n# Configure virtio devices\nsafety_vm.add_virtio_net(\n    tap_device='tap0',\n    mac='52:54:00:12:34:56'\n)\n\nsafety_vm.add_virtio_blk(\n    image_path='\u002Fvar\u002Fvms\u002Fsafety-rootfs.img'\n)\n\n# Launch VM with real-time priority\nsafety_vm.launch(priority='rt', policy='FIFO')\n```\n\n#### Xen Hypervisor (ARM\u002Fx86)\n- Type 1 hypervisor with strong isolation\n- Dom0 (privileged domain) for device drivers\n- DomU (unprivileged domains) for guest VMs\n- PV (paravirtualization) and HVM (hardware virtual machine) modes\n- IOMMU support for device assignment\n\n**Xen VM Configuration (xl toolstack):**\n```python\n# Xen DomU Configuration - ADAS Processing VM\nname = \"adas-processing\"\ntype = \"hvm\"\nmemory = 4096\nvcpus = 4\ncpus = \"4-7\"  # Pin to cores 4-7\n\n# Boot configuration\nkernel = \"\u002Fboot\u002Fvmlinuz-rt\"\nramdisk = \"\u002Fboot\u002Finitrd.img-rt\"\nextra = \"root=\u002Fdev\u002Fxvda1 console=hvc0 isolcpus=4-7\"\n\n# Virtual devices\ndisk = [\n    'phy:\u002Fdev\u002Fvg_vms\u002Fadas-root,xvda1,w',\n    'file:\u002Fvar\u002Fvms\u002Fadas-data.img,xvdb,w'\n]\n\nvif = ['bridge=xenbr0,mac=00:16:3e:12:34:56']\n\n# PCI passthrough for GPU\npci = ['0000:01:00.0']  # NVIDIA GPU\n\n# IOMMU settings\niommu = 1\npermissive = 0\n\n# Virtual framebuffer for display\nvfb = ['vnc=1,vnclisten=0.0.0.0']\n\n# Security settings\non_poweroff = 'destroy'\non_reboot = 'restart'\non_crash = 'coredump-restart'\n```\n\n### 2. Mixed-Criticality System Design\n\n**ASIL Decomposition and Isolation:**\n```cpp\n\u002F\u002F C++14 - Safety Partition Manager\n#include \u003Chypervisor\u002Fpartition.h>\n#include \u003Csafety\u002Fasil.h>\n\nnamespace automotive {\nnamespace hpc {\n\nclass SafetyPartitionManager {\npublic:\n    struct PartitionConfig {\n        std::string name;\n        ASIL asil_level;\n        uint64_t memory_base;\n        uint64_t memory_size;\n        std::vector\u003Cuint32_t> cpu_affinity;\n        uint32_t time_slice_us;\n        bool interference_free;\n    };\n\n    SafetyPartitionManager() : major_frame_us_(10000) {}\n\n    \u002F\u002F Create isolated partition for specific ASIL level\n    bool CreatePartition(const PartitionConfig& config) {\n        \u002F\u002F Validate ASIL requirements\n        if (config.asil_level >= ASIL::D) {\n            if (!ValidateFFI(config)) {\n                LOG_ERROR(\"FFI validation failed for ASIL-D partition\");\n                return false;\n            }\n        }\n\n        \u002F\u002F Configure MPU\u002FMMU for memory isolation\n        if (!ConfigureMemoryProtection(config)) {\n            return false;\n        }\n\n        \u002F\u002F Setup temporal isolation (time partitioning)\n        if (!ConfigureTimeSlice(config)) {\n            return false;\n        }\n\n        \u002F\u002F Register partition\n        partitions_.push_back(config);\n        return true;\n    }\n\n    \u002F\u002F Freedom From Interference validation\n    bool ValidateFFI(const PartitionConfig& config) {\n        \u002F\u002F Check memory interference\n        for (const auto& existing : partitions_) {\n            if (MemoryOverlap(config, existing)) {\n                return false;\n            }\n        }\n\n        \u002F\u002F Check CPU affinity conflicts\n        for (const auto& existing : partitions_) {\n            if (CPUAffinityConflict(config, existing)) {\n                return false;\n            }\n        }\n\n        \u002F\u002F Validate time budget doesn't exceed major frame\n        uint64_t total_time = 0;\n        for (const auto& p : partitions_) {\n            total_time += p.time_slice_us;\n        }\n        if (total_time + config.time_slice_us > major_frame_us_) {\n            return false;\n        }\n\n        return true;\n    }\n\nprivate:\n    std::vector\u003CPartitionConfig> partitions_;\n    uint64_t major_frame_us_;\n\n    bool ConfigureMemoryProtection(const PartitionConfig& config) {\n        \u002F\u002F Setup MPU regions for ARM or EPT for x86\n        return hypervisor_api::SetMemoryRegion(\n            config.memory_base,\n            config.memory_size,\n            MPU_ATTR_NO_ACCESS_FROM_OTHER_PARTITIONS\n        );\n    }\n\n    bool ConfigureTimeSlice(const PartitionConfig& config) {\n        return hypervisor_api::SetPartitionSchedule(\n            config.name,\n            config.time_slice_us,\n            major_frame_us_,\n            SCHEDULE_POLICY_STRICT_PARTITION\n        );\n    }\n\n    bool MemoryOverlap(const PartitionConfig& a, const PartitionConfig& b) {\n        uint64_t a_end = a.memory_base + a.memory_size;\n        uint64_t b_end = b.memory_base + b.memory_size;\n        return !(a_end \u003C= b.memory_base || b_end \u003C= a.memory_base);\n    }\n\n    bool CPUAffinityConflict(const PartitionConfig& a, const PartitionConfig& b) {\n        for (auto cpu_a : a.cpu_affinity) {\n            for (auto cpu_b : b.cpu_affinity) {\n                if (cpu_a == cpu_b && a.asil_level >= ASIL::C && b.asil_level >= ASIL::C) {\n                    return true;  \u002F\u002F ASIL-C\u002FD partitions cannot share CPUs\n                }\n            }\n        }\n        return false;\n    }\n};\n\n} \u002F\u002F namespace hpc\n} \u002F\u002F namespace automotive\n```\n\n### 3. Inter-VM Communication\n\n**IVSHMEM (Inter-VM Shared Memory):**\n```cpp\n\u002F\u002F High-performance zero-copy IPC using shared memory\n#include \u003Civshmem\u002Fshared_region.h>\n#include \u003Catomic>\n#include \u003Ccstring>\n\nnamespace automotive {\nnamespace ipc {\n\n\u002F\u002F Lock-free ring buffer for inter-VM sensor data\ntemplate\u003Ctypename T, size_t Capacity>\nclass IVSHMEMRingBuffer {\npublic:\n    explicit IVSHMEMRingBuffer(void* shmem_base)\n        : region_(static_cast\u003CSharedRegion*>(shmem_base)) {\n        region_->write_idx.store(0, std::memory_order_release);\n        region_->read_idx.store(0, std::memory_order_release);\n    }\n\n    \u002F\u002F Producer: Write sensor data (from sensor VM to ADAS VM)\n    bool Push(const T& item) {\n        size_t current_write = region_->write_idx.load(std::memory_order_relaxed);\n        size_t next_write = (current_write + 1) % Capacity;\n\n        if (next_write == region_->read_idx.load(std::memory_order_acquire)) {\n            return false;  \u002F\u002F Buffer full\n        }\n\n        std::memcpy(&region_->buffer[current_write], &item, sizeof(T));\n        region_->write_idx.store(next_write, std::memory_order_release);\n\n        \u002F\u002F Signal consumer VM via doorbell interrupt\n        SignalDoorbell();\n        return true;\n    }\n\n    \u002F\u002F Consumer: Read sensor data\n    bool Pop(T& item) {\n        size_t current_read = region_->read_idx.load(std::memory_order_relaxed);\n\n        if (current_read == region_->write_idx.load(std::memory_order_acquire)) {\n            return false;  \u002F\u002F Buffer empty\n        }\n\n        std::memcpy(&item, &region_->buffer[current_read], sizeof(T));\n        size_t next_read = (current_read + 1) % Capacity;\n        region_->read_idx.store(next_read, std::memory_order_release);\n        return true;\n    }\n\nprivate:\n    struct SharedRegion {\n        std::atomic\u003Csize_t> write_idx;\n        std::atomic\u003Csize_t> read_idx;\n        alignas(64) T buffer[Capacity];\n    };\n\n    SharedRegion* region_;\n\n    void SignalDoorbell() {\n        \u002F\u002F Write to doorbell register to trigger interrupt in consumer VM\n        volatile uint32_t* doorbell = reinterpret_cast\u003Cuint32_t*>(0xFEDC0000);\n        *doorbell = 1;\n    }\n};\n\n\u002F\u002F Usage example: Camera frame sharing\nstruct CameraFrame {\n    uint64_t timestamp_us;\n    uint32_t frame_id;\n    uint32_t width;\n    uint32_t height;\n    uint8_t data[1920 * 1080 * 3];  \u002F\u002F RGB888\n};\n\n\u002F\u002F In Sensor VM (producer)\nvoid SensorVMMain() {\n    void* shmem = MapIVSHMEM(\"\u002Fdev\u002Fivshmem0\", 128 * 1024 * 1024);\n    IVSHMEMRingBuffer\u003CCameraFrame, 4> frame_queue(shmem);\n\n    while (true) {\n        CameraFrame frame = CaptureCamera();\n        if (!frame_queue.Push(frame)) {\n            LOG_WARN(\"Frame queue full, dropping frame\");\n        }\n    }\n}\n\n\u002F\u002F In ADAS VM (consumer)\nvoid ADASVMMain() {\n    void* shmem = MapIVSHMEM(\"\u002Fdev\u002Fivshmem0\", 128 * 1024 * 1024);\n    IVSHMEMRingBuffer\u003CCameraFrame, 4> frame_queue(shmem);\n\n    CameraFrame frame;\n    while (true) {\n        if (frame_queue.Pop(frame)) {\n            ProcessFrameForObjectDetection(frame);\n        }\n    }\n}\n\n} \u002F\u002F namespace ipc\n} \u002F\u002F namespace automotive\n```\n\n### 4. Resource Management and Scheduling\n\n**CPU Partitioning and Real-Time Scheduling:**\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"\nHPC Platform Resource Manager\nManages CPU, memory, and I\u002FO bandwidth across VMs\n\"\"\"\n\nimport yaml\nfrom dataclasses import dataclass\nfrom typing import List, Dict\nfrom enum import Enum\n\nclass VMType(Enum):\n    SAFETY_CRITICAL = \"safety_critical\"  # ASIL-C\u002FD\n    PERFORMANCE = \"performance\"          # ADAS, autonomous\n    GENERAL_PURPOSE = \"general_purpose\"  # Infotainment, telematics\n\n@dataclass\nclass CPUAllocation:\n    vm_name: str\n    physical_cores: List[int]\n    vcpu_count: int\n    scheduler: str  # 'rt-fifo', 'rt-rr', 'cfs'\n    priority: int\n    cpu_quota_percent: float\n\n@dataclass\nclass MemoryAllocation:\n    vm_name: str\n    size_gb: float\n    numa_node: int\n    hugepages: bool\n    swap_disabled: bool\n\nclass HPCResourceManager:\n    def __init__(self, platform_config: str):\n        with open(platform_config, 'r') as f:\n            self.config = yaml.safe_load(f)\n\n        self.total_cores = self.config['platform']['cpu_cores']\n        self.total_memory_gb = self.config['platform']['memory_gb']\n        self.allocations: Dict[str, Dict] = {}\n\n    def allocate_vm_resources(self, vm_name: str, vm_type: VMType,\n                             cpu_cores: int, memory_gb: float):\n        \"\"\"Allocate resources following ASIL requirements\"\"\"\n\n        if vm_type == VMType.SAFETY_CRITICAL:\n            # ASIL-C\u002FD VMs get dedicated cores\n            cpu_alloc = self._allocate_dedicated_cores(vm_name, cpu_cores)\n            mem_alloc = self._allocate_locked_memory(vm_name, memory_gb)\n        elif vm_type == VMType.PERFORMANCE:\n            # Performance VMs get isolated cores with high priority\n            cpu_alloc = self._allocate_isolated_cores(vm_name, cpu_cores)\n            mem_alloc = self._allocate_hugepages_memory(vm_name, memory_gb)\n        else:\n            # General purpose VMs share remaining cores\n            cpu_alloc = self._allocate_shared_cores(vm_name, cpu_cores)\n            mem_alloc = self._allocate_standard_memory(vm_name, memory_gb)\n\n        self.allocations[vm_name] = {\n            'type': vm_type,\n            'cpu': cpu_alloc,\n            'memory': mem_alloc\n        }\n\n        return cpu_alloc, mem_alloc\n\n    def _allocate_dedicated_cores(self, vm_name: str, count: int) -> CPUAllocation:\n        \"\"\"Dedicated cores for safety-critical VMs (ASIL-D)\"\"\"\n        # Allocate from first available cores\n        available = self._find_available_cores(count, dedicated=True)\n\n        return CPUAllocation(\n            vm_name=vm_name,\n            physical_cores=available,\n            vcpu_count=count,\n            scheduler='rt-fifo',\n            priority=99,  # Highest RT priority\n            cpu_quota_percent=100.0\n        )\n\n    def _allocate_isolated_cores(self, vm_name: str, count: int) -> CPUAllocation:\n        \"\"\"Isolated cores for performance VMs (ADAS)\"\"\"\n        available = self._find_available_cores(count, dedicated=False)\n\n        return CPUAllocation(\n            vm_name=vm_name,\n            physical_cores=available,\n            vcpu_count=count,\n            scheduler='rt-rr',\n            priority=50,\n            cpu_quota_percent=90.0\n        )\n\n    def _allocate_locked_memory(self, vm_name: str, size_gb: float) -> MemoryAllocation:\n        \"\"\"Locked, non-swappable memory for safety VMs\"\"\"\n        return MemoryAllocation(\n            vm_name=vm_name,\n            size_gb=size_gb,\n            numa_node=0,\n            hugepages=True,\n            swap_disabled=True\n        )\n\n    def generate_systemd_config(self, vm_name: str) -> str:\n        \"\"\"Generate systemd unit file with resource limits\"\"\"\n        alloc = self.allocations[vm_name]\n        cpu = alloc['cpu']\n        mem = alloc['memory']\n\n        cores_list = ','.join(map(str, cpu.physical_cores))\n\n        config = f\"\"\"\n[Unit]\nDescription={vm_name} Virtual Machine\nAfter=hypervisor.service\n\n[Service]\nType=simple\nExecStart=\u002Fusr\u002Fbin\u002Fqemu-system-x86_64 \\\\\n    -name {vm_name} \\\\\n    -cpu host \\\\\n    -smp {cpu.vcpu_count} \\\\\n    -m {int(mem.size_gb * 1024)}M \\\\\n    -mem-path \u002Fdev\u002Fhugepages \\\\\n    -mem-prealloc \\\\\n    -rtc base=utc,clock=host \\\\\n    -drive file=\u002Fvar\u002Fvms\u002F{vm_name}.qcow2,if=virtio \\\\\n    -netdev tap,id=net0,ifname=tap-{vm_name},script=no \\\\\n    -device virtio-net-pci,netdev=net0\n\n# CPU affinity\nCPUAffinity={cores_list}\n\n# CPU quota ({cpu.cpu_quota_percent}% of allocated cores)\nCPUQuota={cpu.cpu_quota_percent * cpu.vcpu_count}%\n\n# Memory limits\nMemoryLimit={int(mem.size_gb * 1024)}M\nMemorySwapMax=0\n\n# Real-time scheduling (if safety critical)\n{\"CPUSchedulingPolicy=fifo\" if cpu.scheduler == 'rt-fifo' else \"\"}\n{\"CPUSchedulingPriority=\" + str(cpu.priority) if cpu.scheduler.startswith('rt-') else \"\"}\n\n# Security\nPrivateTmp=yes\nNoNewPrivileges=yes\n\n[Install]\nWantedBy=multi-user.target\n\"\"\"\n        return config\n\n# Example usage\nif __name__ == '__main__':\n    manager = HPCResourceManager('platform_config.yaml')\n\n    # Allocate ASIL-D ADAS VM\n    cpu, mem = manager.allocate_vm_resources(\n        'adas-safety',\n        VMType.SAFETY_CRITICAL,\n        cpu_cores=4,\n        memory_gb=8.0\n    )\n\n    # Generate systemd service\n    config = manager.generate_systemd_config('adas-safety')\n    with open('\u002Fetc\u002Fsystemd\u002Fsystem\u002Fvm-adas-safety.service', 'w') as f:\n        f.write(config)\n\n    print(f\"Allocated cores {cpu.physical_cores} to ADAS VM\")\n    print(f\"Memory: {mem.size_gb}GB, NUMA node: {mem.numa_node}\")\n```\n\n## Use Cases\n\n1. **Centralized ADAS Platform**: Run L3+ autonomous driving workloads in safety VMs alongside infotainment in QM VMs\n2. **Gateway ECU Consolidation**: Combine multiple network domains (CAN, Ethernet, FlexRay) in isolated VMs\n3. **Cockpit Domain Controller**: Instrument cluster, HMI, and Android Automotive on single SoC with GPU sharing\n4. **OTA Update Isolation**: Separate update VM from running system for fail-safe updates\n\n## Automotive Standards\n\n- **ISO 26262**: ASIL-D certification for hypervisor TCB\n- **ISO 21434**: Cybersecurity isolation between VMs\n- **ASPICE CL3**: Process compliance for hypervisor development\n- **AUTOSAR Adaptive**: Ara::exec for VM lifecycle management\n\n## Tools Required\n\n- **QNX Momentics IDE**: For QNX Hypervisor development\n- **ACRN Configuration Tool**: Web-based hypervisor configurator\n- **Xen Orchestra**: Management interface for Xen\n- **libvirt\u002Fvirsh**: VM lifecycle management\n- **perf\u002Fftrace**: Performance profiling and latency analysis\n\n## Constraints\n\n- **Real-time Latency**: \u003C100µs interrupt latency for ASIL-D VMs\n- **Memory Overhead**: \u003C5% hypervisor overhead\n- **FFI Guarantees**: ISO 26262 Part 6 clause 7 compliance\n- **Deterministic Scheduling**: WCET guarantees for safety partitions\n\n## Performance Metrics\n\n- **VM Boot Time**: \u003C500ms for safety VM cold boot\n- **Context Switch**: \u003C5µs VM-to-VM switch\n- **Shared Memory Throughput**: >10GB\u002Fs IVSHMEM bandwidth\n- **Interrupt Delivery**: \u003C20µs doorbell latency\n\n## References\n\n- QNX Hypervisor 2.2 User Guide\n- ACRN Hypervisor Documentation (projectacrn.org)\n- Xen ARM Virtualization Extensions\n- ISO 26262-6:2018 Clause 7 (Freedom from Interference)\n- \"Mixed-Criticality Systems on Multi-core\" (WATERS 2019)\n\n---\n\n**Version:** 1.0.0\n**Last Updated:** 2026-03-19\n**Author:** Automotive Claude Code Agents\n\n---\n\n## Safety Certification Hpc\n\n# Safety Certification for Automotive HPC Platforms\n\n**Category:** automotive-hpc\n**Version:** 1.0.0\n**Maturity:** production\n**Complexity:** advanced\n\n## Overview\n\nComprehensive guide to ISO 26262 safety certification for High-Performance Computing platforms. Covers ASIL-D partitioning, Freedom from Interference (FFI), safety mechanisms, certification strategies, and evidence documentation.\n\n## Core Competencies\n\n### 1. ISO 26262 for HPC Platforms\n\n**ISO 26262 Part 6 - Software Development:**\n- **Clause 7**: Freedom From Interference\n- **Clause 8**: Software Unit Design and Implementation\n- **Clause 9**: Software Unit Testing\n- **Clause 10**: Software Integration and Testing\n\n**ASIL Decomposition on HPC:**\n```\nSingle HPC SoC replacing multiple ECUs:\n┌─────────────────────────────────────────────┐\n│        NVIDIA DRIVE Orin \u002F Snapdragon       │\n├─────────────────────────────────────────────┤\n│ Partition 1: ADAS (ASIL-D)                  │\n│ - Decomposed to: ASIL-B(B) + ASIL-B(B)     │\n│ - Dual-core lockstep execution              │\n│ - E2E protection for inter-core comm        │\n├─────────────────────────────────────────────┤\n│ Partition 2: Instrument Cluster (ASIL-A)   │\n│ - Warning lamps, speedometer                │\n│ - Independent from ADAS partition           │\n├─────────────────────────────────────────────┤\n│ Partition 3: Infotainment (QM)              │\n│ - No safety requirements                    │\n│ - Resource limits enforced by hypervisor    │\n└─────────────────────────────────────────────┘\n```\n\n### 2. ASIL-D Partitioning Strategy\n\n**Hardware Partitioning:**\n```cpp\n\u002F\u002F HPC Safety Partition Configuration\n#include \u003Ciso26262\u002Fpartition_manager.h>\n#include \u003Ciso26262\u002Fffi_validator.h>\n\nnamespace safety {\nnamespace hpc {\n\nenum class ASILLevel {\n    QM,   \u002F\u002F Quality Management\n    A,    \u002F\u002F Lowest ASIL\n    B,\n    C,\n    D     \u002F\u002F Highest ASIL\n};\n\nstruct SafetyPartition {\n    std::string name;\n    ASILLevel asil;\n    std::vector\u003Cuint32_t> cpu_cores;\n    uint64_t memory_base;\n    uint64_t memory_size;\n    std::vector\u003Cuint32_t> allowed_interrupts;\n    bool mpu_enabled;\n    bool ecc_enabled;\n    bool lockstep_enabled;\n};\n\nclass HPC_SafetyPartitionManager {\npublic:\n    HPC_SafetyPartitionManager() {\n        InitializePartitions();\n        ValidateFFI();\n    }\n\n    void InitializePartitions() {\n        \u002F\u002F ASIL-D ADAS Partition (decomposed to 2x ASIL-B)\n        SafetyPartition adas_partition_1 {\n            .name = \"ADAS-Perception-1\",\n            .asil = ASILLevel::B,\n            .cpu_cores = {0, 1},  \u002F\u002F Lockstep pair\n            .memory_base = 0x8000'0000,\n            .memory_size = 2ULL * 1024 * 1024 * 1024,  \u002F\u002F 2GB\n            .allowed_interrupts = {IRQ_CAN0, IRQ_CAMERA0, IRQ_LIDAR},\n            .mpu_enabled = true,\n            .ecc_enabled = true,\n            .lockstep_enabled = true\n        };\n\n        SafetyPartition adas_partition_2 {\n            .name = \"ADAS-Perception-2\",\n            .asil = ASILLevel::B,\n            .cpu_cores = {2, 3},  \u002F\u002F Lockstep pair\n            .memory_base = 0xC000'0000,\n            .memory_size = 2ULL * 1024 * 1024 * 1024,  \u002F\u002F 2GB\n            .allowed_interrupts = {IRQ_CAN1, IRQ_CAMERA1, IRQ_RADAR},\n            .mpu_enabled = true,\n            .ecc_enabled = true,\n            .lockstep_enabled = true\n        };\n\n        \u002F\u002F Configure MPU for spatial isolation\n        ConfigureMPU(adas_partition_1);\n        ConfigureMPU(adas_partition_2);\n\n        \u002F\u002F Enable ECC for temporal fault detection\n        EnableECC(adas_partition_1);\n        EnableECC(adas_partition_2);\n\n        \u002F\u002F Configure lockstep cores for fault detection\n        ConfigureLockstep(adas_partition_1);\n        ConfigureLockstep(adas_partition_2);\n\n        partitions_.push_back(adas_partition_1);\n        partitions_.push_back(adas_partition_2);\n    }\n\n    void ConfigureMPU(const SafetyPartition& partition) {\n        \u002F\u002F MPU Configuration for ARM Cortex-A78\n        \u002F\u002F Region 0: Partition memory (RW, Executable)\n        MPU_RegionConfig region_config {\n            .base_address = partition.memory_base,\n            .size = partition.memory_size,\n            .access_permission = MPU_ACCESS_RW_NONE,  \u002F\u002F No access from other cores\n            .execute_never = false,\n            .shareable = false,\n            .cacheable = true\n        };\n\n        for (auto core : partition.cpu_cores) {\n            SetMPURegion(core, 0, region_config);\n        }\n\n        \u002F\u002F Region 1: Shared communication region (RW, Non-executable)\n        MPU_RegionConfig shared_region {\n            .base_address = 0xE000'0000,\n            .size = 64 * 1024 * 1024,  \u002F\u002F 64MB\n            .access_permission = MPU_ACCESS_RW_RW,\n            .execute_never = true,\n            .shareable = true,\n            .cacheable = false  \u002F\u002F Uncached for inter-partition comm\n        };\n\n        for (auto core : partition.cpu_cores) {\n            SetMPURegion(core, 1, shared_region);\n        }\n    }\n\n    void EnableECC(const SafetyPartition& partition) {\n        \u002F\u002F Enable ECC on LPDDR5 memory for partition\n        for (auto core : partition.cpu_cores) {\n            \u002F\u002F Enable ECC in memory controller\n            WriteMemoryControllerReg(\n                MEMORY_ECC_ENABLE_REG,\n                partition.memory_base,\n                partition.memory_size\n            );\n\n            \u002F\u002F Register ECC error handler\n            RegisterECCHandler(core, [partition](uint64_t error_addr) {\n                HandleECCError(partition, error_addr);\n            });\n        }\n    }\n\n    void ConfigureLockstep(const SafetyPartition& partition) {\n        if (!partition.lockstep_enabled || partition.cpu_cores.size() != 2) {\n            return;\n        }\n\n        \u002F\u002F Configure ARM Split-Lock mode (lockstep)\n        uint32_t primary_core = partition.cpu_cores[0];\n        uint32_t shadow_core = partition.cpu_cores[1];\n\n        \u002F\u002F Enable lockstep mode in SCU (Snoop Control Unit)\n        EnableCoreLockstep(primary_core, shadow_core);\n\n        \u002F\u002F Configure lockstep comparator\n        SetLockstepComparator(primary_core, shadow_core, [](uint32_t core_a, uint32_t core_b) {\n            \u002F\u002F Lockstep mismatch detected\n            LOG_FATAL(\"Lockstep mismatch between core %d and %d\", core_a, core_b);\n            TriggerSafeState();\n        });\n    }\n\n    void ValidateFFI() {\n        FFI_Validator validator;\n\n        \u002F\u002F Validate spatial interference (memory)\n        if (!validator.ValidateMemoryIsolation(partitions_)) {\n            throw std::runtime_error(\"Memory isolation validation failed\");\n        }\n\n        \u002F\u002F Validate temporal interference (CPU time)\n        if (!validator.ValidateTemporalIsolation(partitions_)) {\n            throw std::runtime_error(\"Temporal isolation validation failed\");\n        }\n\n        \u002F\u002F Validate interrupt isolation\n        if (!validator.ValidateInterruptIsolation(partitions_)) {\n            throw std::runtime_error(\"Interrupt isolation validation failed\");\n        }\n\n        LOG_INFO(\"FFI validation passed for all partitions\");\n    }\n\nprivate:\n    std::vector\u003CSafetyPartition> partitions_;\n\n    static void HandleECCError(const SafetyPartition& partition, uint64_t error_addr) {\n        LOG_ERROR(\"ECC error in partition %s at address 0x%lx\",\n                  partition.name.c_str(), error_addr);\n\n        \u002F\u002F For ASIL-B\u002FD: Trigger safe state\n        if (partition.asil >= ASILLevel::B) {\n            TriggerSafeState();\n        }\n    }\n\n    static void TriggerSafeState() {\n        \u002F\u002F Transition vehicle to safe state\n        \u002F\u002F - Reduce speed\n        \u002F\u002F - Activate hazard lights\n        \u002F\u002F - Pull over\n        LOG_FATAL(\"Entering safe state due to safety partition failure\");\n        \u002F\u002F Implementation depends on vehicle platform\n    }\n\n    void SetMPURegion(uint32_t core, uint32_t region, const MPU_RegionConfig& config) {\n        \u002F\u002F Platform-specific MPU configuration\n    }\n\n    void EnableCoreLockstep(uint32_t core_a, uint32_t core_b) {\n        \u002F\u002F Platform-specific lockstep enable\n    }\n\n    void SetLockstepComparator(uint32_t core_a, uint32_t core_b, std::function\u003Cvoid(uint32_t, uint32_t)> handler) {\n        \u002F\u002F Platform-specific lockstep comparator\n    }\n};\n\n} \u002F\u002F namespace hpc\n} \u002F\u002F namespace safety\n```\n\n### 3. Freedom From Interference (FFI)\n\n**FFI Requirements per ISO 26262-6 Clause 7:**\n\n| Interference Type | Mechanism | ASIL-D Requirement |\n|-------------------|-----------|-------------------|\n| **Spatial (Memory)** | MPU\u002FMMU | Hardware isolation |\n| **Temporal (CPU Time)** | Time partitioning | Guaranteed time slots |\n| **Communication** | E2E protection | CRC + alive counter |\n| **Peripheral Access** | Access control list | Exclusive device ownership |\n| **Interrupt** | Interrupt masking | Per-partition IRQ routing |\n\n**End-to-End (E2E) Protection for Inter-Partition Communication:**\n```cpp\n\u002F\u002F ISO 26262 E2E Profile for Inter-Partition Messages\n#include \u003Ciso26262\u002Fe2e_protection.h>\n\nnamespace safety {\nnamespace e2e {\n\n\u002F\u002F E2E Profile 4 (used for AUTOSAR Adaptive)\nstruct E2E_Profile4_Header {\n    uint16_t length;          \u002F\u002F Message length\n    uint16_t counter;         \u002F\u002F Rolling counter (0-65535)\n    uint32_t data_id;         \u002F\u002F Unique message identifier\n    uint32_t crc;             \u002F\u002F CRC-32\n} __attribute__((packed));\n\nclass E2E_Protector {\npublic:\n    E2E_Protector(uint32_t data_id)\n        : data_id_(data_id), counter_(0) {}\n\n    \u002F\u002F Protect outgoing message\n    std::vector\u003Cuint8_t> Protect(const std::vector\u003Cuint8_t>& payload) {\n        std::vector\u003Cuint8_t> protected_msg;\n\n        \u002F\u002F Construct header\n        E2E_Profile4_Header header;\n        header.length = static_cast\u003Cuint16_t>(payload.size());\n        header.counter = counter_++;\n        header.data_id = data_id_;\n\n        \u002F\u002F Compute CRC over header (excluding CRC field) + payload\n        header.crc = ComputeCRC32(header, payload);\n\n        \u002F\u002F Serialize header + payload\n        protected_msg.resize(sizeof(header) + payload.size());\n        std::memcpy(protected_msg.data(), &header, sizeof(header));\n        std::memcpy(protected_msg.data() + sizeof(header), payload.data(), payload.size());\n\n        return protected_msg;\n    }\n\n    \u002F\u002F Check incoming message\n    E2E_CheckResult Check(const std::vector\u003Cuint8_t>& protected_msg) {\n        if (protected_msg.size() \u003C sizeof(E2E_Profile4_Header)) {\n            return E2E_CheckResult::ERROR;\n        }\n\n        \u002F\u002F Deserialize header\n        E2E_Profile4_Header header;\n        std::memcpy(&header, protected_msg.data(), sizeof(header));\n\n        \u002F\u002F Extract payload\n        std::vector\u003Cuint8_t> payload(\n            protected_msg.begin() + sizeof(header),\n            protected_msg.end()\n        );\n\n        \u002F\u002F Verify length\n        if (header.length != payload.size()) {\n            return E2E_CheckResult::ERROR;\n        }\n\n        \u002F\u002F Verify CRC\n        uint32_t expected_crc = header.crc;\n        header.crc = 0;  \u002F\u002F Clear CRC field before computation\n        uint32_t computed_crc = ComputeCRC32(header, payload);\n\n        if (expected_crc != computed_crc) {\n            LOG_ERROR(\"E2E CRC mismatch: expected 0x%08x, got 0x%08x\",\n                     expected_crc, computed_crc);\n            return E2E_CheckResult::ERROR;\n        }\n\n        \u002F\u002F Verify counter (detect loss and duplication)\n        E2E_CheckResult counter_result = CheckCounter(header.counter);\n        if (counter_result != E2E_CheckResult::OK) {\n            return counter_result;\n        }\n\n        last_valid_counter_ = header.counter;\n        return E2E_CheckResult::OK;\n    }\n\nprivate:\n    uint32_t data_id_;\n    uint16_t counter_;\n    uint16_t last_valid_counter_ = 0;\n\n    E2E_CheckResult CheckCounter(uint16_t received_counter) {\n        uint16_t expected_counter = (last_valid_counter_ + 1) % 65536;\n\n        if (received_counter == expected_counter) {\n            return E2E_CheckResult::OK;\n        } else if (received_counter == last_valid_counter_) {\n            return E2E_CheckResult::REPEATED;\n        } else {\n            LOG_WARN(\"E2E counter gap: expected %d, got %d\",\n                    expected_counter, received_counter);\n            return E2E_CheckResult::WRONG_SEQUENCE;\n        }\n    }\n\n    uint32_t ComputeCRC32(const E2E_Profile4_Header& header,\n                         const std::vector\u003Cuint8_t>& payload) {\n        \u002F\u002F CRC-32\u002FAUTOSAR polynomial: 0xF4ACFB13\n        uint32_t crc = 0xFFFFFFFF;\n\n        \u002F\u002F CRC over header (excluding CRC field)\n        const uint8_t* header_bytes = reinterpret_cast\u003Cconst uint8_t*>(&header);\n        for (size_t i = 0; i \u003C offsetof(E2E_Profile4_Header, crc); ++i) {\n            crc = UpdateCRC32(crc, header_bytes[i]);\n        }\n\n        \u002F\u002F CRC over payload\n        for (uint8_t byte : payload) {\n            crc = UpdateCRC32(crc, byte);\n        }\n\n        return crc ^ 0xFFFFFFFF;\n    }\n\n    uint32_t UpdateCRC32(uint32_t crc, uint8_t byte) {\n        \u002F\u002F CRC-32 table lookup (AUTOSAR polynomial)\n        static const uint32_t crc_table[256] = { \u002F* ... *\u002F };\n        return (crc >> 8) ^ crc_table[(crc ^ byte) & 0xFF];\n    }\n};\n\nenum class E2E_CheckResult {\n    OK,\n    ERROR,\n    REPEATED,\n    WRONG_SEQUENCE\n};\n\n} \u002F\u002F namespace e2e\n} \u002F\u002F namespace safety\n```\n\n### 4. Safety Mechanisms for HPC\n\n**Platform-Level Safety Mechanisms:**\n```yaml\n# ISO 26262 Safety Mechanisms for HPC\nsafety_mechanisms:\n  hardware_level:\n    - mechanism: \"CPU Lockstep\"\n      target_fault: \"Random hardware faults\"\n      diagnostic_coverage: 99%\n      asil: D\n\n    - mechanism: \"ECC on LPDDR5\"\n      target_fault: \"Single-bit memory errors\"\n      diagnostic_coverage: 99%\n      asil: C\n\n    - mechanism: \"MPU\u002FMMU Protection\"\n      target_fault: \"Memory corruption\"\n      diagnostic_coverage: 99%\n      asil: D\n\n    - mechanism: \"Watchdog Timer\"\n      target_fault: \"Software hang\"\n      diagnostic_coverage: 90%\n      asil: B\n\n  software_level:\n    - mechanism: \"E2E Protection\"\n      target_fault: \"Communication errors\"\n      diagnostic_coverage: 99%\n      asil: D\n\n    - mechanism: \"Diverse Redundancy\"\n      target_fault: \"Systematic software errors\"\n      diagnostic_coverage: 60%\n      asil: C\n\n    - mechanism: \"Plausibility Checks\"\n      target_fault: \"Sensor data corruption\"\n      diagnostic_coverage: 90%\n      asil: B\n\n    - mechanism: \"Program Flow Monitoring\"\n      target_fault: \"Control flow errors\"\n      diagnostic_coverage: 90%\n      asil: C\n\n  system_level:\n    - mechanism: \"ASIL Decomposition\"\n      target_fault: \"Single point of failure\"\n      diagnostic_coverage: N\u002FA\n      asil: D\n\n    - mechanism: \"Safe State Transition\"\n      target_fault: \"Detected failures\"\n      diagnostic_coverage: 99%\n      asil: D\n```\n\n**Watchdog Supervision:**\n```cpp\n\u002F\u002F Multi-level Watchdog for ASIL-D\n#include \u003Cwatchdog\u002Fsupervisor.h>\n\nnamespace safety {\nnamespace watchdog {\n\nclass ASIL_D_WatchdogSupervisor {\npublic:\n    ASIL_D_WatchdogSupervisor()\n        : expected_alive_period_ms_(100),\n          window_watchdog_min_ms_(80),\n          window_watchdog_max_ms_(120) {\n\n        InitializeHardwareWatchdog();\n        InitializeSoftwareWatchdog();\n    }\n\n    \u002F\u002F Application reports alive\n    void ReportAlive(uint32_t partition_id) {\n        auto now = std::chrono::steady_clock::now();\n\n        \u002F\u002F Check if alive report is within window\n        auto elapsed = std::chrono::duration_cast\u003Cstd::chrono::milliseconds>(\n            now - last_alive_[partition_id]\n        ).count();\n\n        if (elapsed \u003C window_watchdog_min_ms_) {\n            LOG_ERROR(\"Watchdog violation: Alive too early (partition %d)\", partition_id);\n            TriggerWatchdogReset(partition_id);\n            return;\n        }\n\n        if (elapsed > window_watchdog_max_ms_) {\n            LOG_ERROR(\"Watchdog violation: Alive too late (partition %d)\", partition_id);\n            TriggerWatchdogReset(partition_id);\n            return;\n        }\n\n        \u002F\u002F Refresh hardware watchdog\n        RefreshHardwareWatchdog();\n\n        \u002F\u002F Update timestamp\n        last_alive_[partition_id] = now;\n    }\n\n    void MonitorLoop() {\n        while (running_) {\n            auto now = std::chrono::steady_clock::now();\n\n            \u002F\u002F Check each partition\n            for (const auto& [partition_id, last_alive] : last_alive_) {\n                auto elapsed = std::chrono::duration_cast\u003Cstd::chrono::milliseconds>(\n                    now - last_alive\n                ).count();\n\n                if (elapsed > window_watchdog_max_ms_) {\n                    LOG_ERROR(\"Watchdog timeout: Partition %d not responding\", partition_id);\n                    TriggerWatchdogReset(partition_id);\n                }\n            }\n\n            std::this_thread::sleep_for(std::chrono::milliseconds(10));\n        }\n    }\n\nprivate:\n    uint32_t expected_alive_period_ms_;\n    uint32_t window_watchdog_min_ms_;\n    uint32_t window_watchdog_max_ms_;\n    std::map\u003Cuint32_t, std::chrono::steady_clock::time_point> last_alive_;\n    bool running_ = true;\n\n    void InitializeHardwareWatchdog() {\n        \u002F\u002F Configure external watchdog IC (e.g., TI TPS3840)\n        \u002F\u002F Timeout: 200ms\n        ConfigureExternalWatchdog(200);\n    }\n\n    void InitializeSoftwareWatchdog() {\n        \u002F\u002F Start monitoring thread\n        std::thread([this]() { MonitorLoop(); }).detach();\n    }\n\n    void RefreshHardwareWatchdog() {\n        \u002F\u002F Toggle watchdog input pin\n        ToggleWatchdogPin();\n    }\n\n    void TriggerWatchdogReset(uint32_t partition_id) {\n        LOG_FATAL(\"Triggering watchdog reset for partition %d\", partition_id);\n\n        \u002F\u002F Option 1: Reset only the partition (if hypervisor supports it)\n        ResetPartition(partition_id);\n\n        \u002F\u002F Option 2: Reset entire ECU (if ASIL-D requires it)\n        \u002F\u002F TriggerECUReset();\n    }\n\n    void ConfigureExternalWatchdog(uint32_t timeout_ms) {\n        \u002F\u002F Platform-specific\n    }\n\n    void ToggleWatchdogPin() {\n        \u002F\u002F Platform-specific\n    }\n\n    void ResetPartition(uint32_t partition_id) {\n        \u002F\u002F Platform-specific\n    }\n};\n\n} \u002F\u002F namespace watchdog\n} \u002F\u002F namespace safety\n```\n\n### 5. Safety Certification Process\n\n**ISO 26262 V-Model for HPC:**\n```\nDevelopment (Left side):          Verification (Right side):\n┌──────────────────────────┐     ┌──────────────────────────┐\n│ System Requirements      │────>│ System Integration Test  │\n│ (ASIL-D ADAS)            │     │ (HIL, Vehicle)           │\n└──────────────────────────┘     └──────────────────────────┘\n        │                                   ▲\n        ▼                                   │\n┌──────────────────────────┐     ┌──────────────────────────┐\n│ Software Architecture    │────>│ Software Integration Test│\n│ (Partition Design)       │     │ (SIL, Test Bench)        │\n└──────────────────────────┘     └──────────────────────────┘\n        │                                   ▲\n        ▼                                   │\n┌──────────────────────────┐     ┌──────────────────────────┐\n│ Software Detailed Design │────>│ Software Unit Test       │\n│ (C++ Modules)            │     │ (GoogleTest, Coverage)   │\n└──────────────────────────┘     └──────────────────────────┘\n        │                                   ▲\n        ▼                                   │\n┌──────────────────────────┐              │\n│ Implementation (Code)    │──────────────┘\n└──────────────────────────┘\n```\n\n**Safety Case Artifacts:**\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"\nSafety Case Evidence Generator for HPC Platform\nGenerates artifacts required for ISO 26262 certification\n\"\"\"\n\nfrom dataclasses import dataclass\nfrom typing import List\nfrom datetime import datetime\n\n@dataclass\nclass SafetyRequirement:\n    req_id: str\n    description: str\n    asil: str\n    source: str  # ISO 26262 clause\n\n@dataclass\nclass SafetyMechanism:\n    mechanism_id: str\n    name: str\n    target_fault: str\n    diagnostic_coverage: float\n    verification_method: str\n\n@dataclass\nclass TestCase:\n    test_id: str\n    requirement_id: str\n    test_method: str  # Unit, Integration, System\n    pass_criteria: str\n    result: str  # PASS\u002FFAIL\n    evidence_path: str\n\nclass SafetyCaseGenerator:\n    def __init__(self, project_name: str):\n        self.project_name = project_name\n        self.requirements: List[SafetyRequirement] = []\n        self.mechanisms: List[SafetyMechanism] = []\n        self.test_cases: List[TestCase] = []\n\n    def add_requirement(self, req: SafetyRequirement):\n        self.requirements.append(req)\n\n    def add_safety_mechanism(self, mech: SafetyMechanism):\n        self.mechanisms.append(mech)\n\n    def add_test_case(self, test: TestCase):\n        self.test_cases.append(test)\n\n    def generate_safety_case(self, output_file: str):\n        \"\"\"Generate comprehensive safety case document\"\"\"\n        with open(output_file, 'w') as f:\n            f.write(f\"# Safety Case for {self.project_name}\\n\\n\")\n            f.write(f\"Generated: {datetime.now().isoformat()}\\n\\n\")\n\n            # Section 1: Safety Requirements\n            f.write(\"## 1. Safety Requirements\\n\\n\")\n            f.write(\"| Req ID | Description | ASIL | Source |\\n\")\n            f.write(\"|--------|-------------|------|--------|\\n\")\n            for req in self.requirements:\n                f.write(f\"| {req.req_id} | {req.description} | {req.asil} | {req.source} |\\n\")\n\n            # Section 2: Safety Mechanisms\n            f.write(\"\\n## 2. Safety Mechanisms\\n\\n\")\n            f.write(\"| Mechanism ID | Name | Target Fault | DC | Verification |\\n\")\n            f.write(\"|--------------|------|--------------|----|--------------|\\n\")\n            for mech in self.mechanisms:\n                f.write(f\"| {mech.mechanism_id} | {mech.name} | {mech.target_fault} | \"\n                       f\"{mech.diagnostic_coverage*100:.0f}% | {mech.verification_method} |\\n\")\n\n            # Section 3: Verification Results\n            f.write(\"\\n## 3. Verification Results\\n\\n\")\n            f.write(\"| Test ID | Requirement | Method | Pass Criteria | Result | Evidence |\\n\")\n            f.write(\"|---------|-------------|--------|---------------|--------|----------|\\n\")\n            for test in self.test_cases:\n                f.write(f\"| {test.test_id} | {test.requirement_id} | {test.test_method} | \"\n                       f\"{test.pass_criteria} | {test.result} | {test.evidence_path} |\\n\")\n\n            # Section 4: Traceability Matrix\n            f.write(\"\\n## 4. Requirements Traceability\\n\\n\")\n            self._generate_traceability_matrix(f)\n\n            # Section 5: FMEA Results\n            f.write(\"\\n## 5. Failure Modes and Effects Analysis\\n\\n\")\n            self._generate_fmea_table(f)\n\n    def _generate_traceability_matrix(self, f):\n        f.write(\"| Requirement | Safety Mechanism | Test Cases | Coverage |\\n\")\n        f.write(\"|-------------|------------------|------------|----------|\\n\")\n\n        for req in self.requirements:\n            # Find related mechanisms\n            mechanisms = [m.mechanism_id for m in self.mechanisms]\n\n            # Find related tests\n            tests = [t.test_id for t in self.test_cases if t.requirement_id == req.req_id]\n\n            coverage = f\"{len(tests)} tests\" if tests else \"No coverage\"\n            f.write(f\"| {req.req_id} | {', '.join(mechanisms[:2])} | \"\n                   f\"{', '.join(tests[:3])} | {coverage} |\\n\")\n\n    def _generate_fmea_table(self, f):\n        f.write(\"| Failure Mode | Effect | Severity | Detection | Mitigation |\\n\")\n        f.write(\"|--------------|--------|----------|-----------|------------|\\n\")\n        f.write(\"| CPU core failure | Loss of ADAS | S3 | Lockstep | Redundant partition |\\n\")\n        f.write(\"| Memory corruption | Data integrity | S3 | ECC | CRC checks |\\n\")\n        f.write(\"| Hypervisor fault | System crash | S3 | Watchdog | Safe state |\\n\")\n\n# Example usage\nif __name__ == '__main__':\n    generator = SafetyCaseGenerator(\"ADAS HPC Platform\")\n\n    # Add requirements\n    generator.add_requirement(SafetyRequirement(\n        req_id=\"SR-001\",\n        description=\"FFI between ASIL-D and QM partitions\",\n        asil=\"D\",\n        source=\"ISO 26262-6:7.4.2\"\n    ))\n\n    generator.add_requirement(SafetyRequirement(\n        req_id=\"SR-002\",\n        description=\"Diagnostic coverage >99% for hardware faults\",\n        asil=\"D\",\n        source=\"ISO 26262-5:8.4.3\"\n    ))\n\n    # Add safety mechanisms\n    generator.add_safety_mechanism(SafetyMechanism(\n        mechanism_id=\"SM-001\",\n        name=\"CPU Lockstep\",\n        target_fault=\"Random hardware faults in CPU\",\n        diagnostic_coverage=0.99,\n        verification_method=\"Fault injection testing\"\n    ))\n\n    generator.add_safety_mechanism(SafetyMechanism(\n        mechanism_id=\"SM-002\",\n        name=\"Memory ECC\",\n        target_fault=\"Single-bit memory errors\",\n        diagnostic_coverage=0.99,\n        verification_method=\"ECC error injection\"\n    ))\n\n    # Add test cases\n    generator.add_test_case(TestCase(\n        test_id=\"TC-001\",\n        requirement_id=\"SR-001\",\n        test_method=\"Integration Test\",\n        pass_criteria=\"No memory access violations detected\",\n        result=\"PASS\",\n        evidence_path=\"test_results\u002Ftc001_ffi_validation.log\"\n    ))\n\n    # Generate safety case document\n    generator.generate_safety_case(\"safety_case.md\")\n    print(\"Safety case generated: safety_case.md\")\n```\n\n## Use Cases\n\n1. **ASIL-D ADAS Platform Certification**: Certify perception\u002Fplanning on HPC SoC\n2. **Zonal Controller Safety**: Multi-ASIL partitioning for zone ECU\n3. **OTA Update Safety**: Demonstrate safe software updates without re-certification\n4. **Mixed-Criticality Cockpit**: ASIL-A cluster + QM IVI on single platform\n\n## Automotive Standards\n\n- **ISO 26262-6:2018**: Software development at the component level\n- **ISO 26262-8:2018**: Supporting processes (safety analysis)\n- **ISO 26262-9:2018**: ASIL-oriented and safety-oriented analyses\n- **ISO 26262-11:2018**: Application of ISO 26262 to semiconductors\n\n## Tools Required\n\n- **medini analyze**: FMEA and FTA tool\n- **LDRA**: Static analysis and unit test (TÜV certified)\n- **Vector CANoe**: HIL testing with fault injection\n- **QNX Safety Hypervisor**: Pre-certified hypervisor (ASIL-D)\n\n## Performance Metrics\n\n- **Diagnostic Coverage**: >99% for ASIL-D single-point faults\n- **Fault Latency**: \u003C10ms detection and reaction time\n- **Safe State Transition**: \u003C100ms from fault detection to safe state\n- **MPU Overhead**: \u003C1% CPU utilization\n\n## References\n\n- ISO 26262-6:2018 Software Development\n- \"Safety Certification for Multi-Core Automotive Systems\" (SAE Paper 2020-01-0729)\n- NVIDIA DRIVE OS Safety Manual\n- QNX Hypervisor 2.2 Safety Manual (ISO 26262 ASIL-D)\n\n---\n\n**Version:** 1.0.0\n**Last Updated:** 2026-03-19\n**Author:** Automotive Claude Code Agents\n\n---\n\n## Vehicle Compute Platforms\n\n# Vehicle Central Compute Platforms\n\n**Category:** automotive-hpc\n**Version:** 1.0.0\n**Maturity:** production\n**Complexity:** advanced\n\n## Overview\n\nComprehensive guide to automotive High-Performance Computing (HPC) SoC platforms for Software-Defined Vehicles. Covers NVIDIA DRIVE, Qualcomm Snapdragon Ride, NXP S32 family, performance benchmarks, thermal management, and power budgets.\n\n## HPC Platform Comparison\n\n### Platform Overview Table\n\n| Platform | CPU | GPU | NPU\u002FAI | Memory | TOPS | TDP | Use Case |\n|----------|-----|-----|--------|--------|------|-----|----------|\n| **NVIDIA DRIVE Orin** | 12-core ARM Cortex-A78AE | Ampere GPU (2048 CUDA) | 2x DLA | 32GB LPDDR5 | 254 | 60W | L3+ AD, ADAS |\n| **NVIDIA DRIVE Thor** | 16-core Grace CPU | Ada GPU | NvDLA v3 | 128GB | 2000 | 300W | L4\u002FL5 AD |\n| **Qualcomm Snapdragon Ride** | 8-core Kryo 780 | Adreno 740 | Hexagon 780 | 64GB LPDDR5 | 700 | 65W | ADAS, Cockpit |\n| **NXP S32G3** | 8-core Cortex-A53 | PowerVR | - | 16GB DDR4 | - | 12W | Gateway, ADAS |\n| **NXP S32Z\u002FE** | 16-core Cortex-R52 | - | - | 8GB DDR4 | - | 20W | Safety Domain |\n| **Renesas R-Car V4H** | 8-core Cortex-A76 | IMG PowerVR | CNN-IP | 32GB LPDDR4X | 80 | 40W | ADAS, Cockpit |\n| **Intel Atom x7000RE** | 8-core x86 | Xe GPU | VPU | 32GB LPDDR5 | 60 | 35W | IVI, Telematics |\n\n---\n\n## 1. NVIDIA DRIVE Platform\n\n### NVIDIA DRIVE Orin\n\n**Specifications:**\n- **CPU**: 12-core ARM Cortex-A78AE (ISO 26262 ASIL-D)\n- **GPU**: NVIDIA Ampere architecture, 2048 CUDA cores, RT cores\n- **DLA**: 2x Deep Learning Accelerators (70 TOPS each)\n- **AI Performance**: 254 TOPS INT8\n- **Memory**: 32GB LPDDR5, 204.8 GB\u002Fs bandwidth\n- **Video**: 8x 4K60 cameras, H.265 encode\u002Fdecode\n- **Interfaces**: 16-lane PCIe Gen4, 10GbE, CAN-FD\n- **Safety**: ISO 26262 ASIL-D, lockstep CPU cores\n\n**DRIVE OS Software Stack:**\n```\n┌─────────────────────────────────────────────┐\n│      Autonomous Driving Applications        │\n├─────────────────────────────────────────────┤\n│  DriveWorks SDK (Perception, Planning)      │\n│  - Object detection, tracking, fusion       │\n│  - Path planning, behavior prediction       │\n├─────────────────────────────────────────────┤\n│  CUDA, TensorRT, cuDNN (AI Inference)       │\n├─────────────────────────────────────────────┤\n│  DRIVE OS (Linux + RTOS)                    │\n│  - Safety partition (QNX\u002FIntegrity)         │\n│  - Performance partition (Ubuntu)           │\n├─────────────────────────────────────────────┤\n│  Hypervisor (NVIDIA vGPU)                   │\n└─────────────────────────────────────────────┘\n```\n\n**DriveWorks Example - Object Detection:**\n```cpp\n\u002F\u002F NVIDIA DriveWorks - YOLO Object Detection on Orin\n#include \u003Cdw\u002Fcore\u002FContext.h>\n#include \u003Cdw\u002Fsensors\u002Fcamera\u002FCamera.h>\n#include \u003Cdw\u002Fobject\u002FDetector.h>\n#include \u003Cdw\u002Fdnn\u002FDNN.h>\n\nnamespace nvidia {\nnamespace adas {\n\nclass ObjectDetector {\npublic:\n    ObjectDetector() {\n        \u002F\u002F Initialize DriveWorks context\n        dwContextParameters ctx_params{};\n        ctx_params.enableCudaLogging = true;\n        dwInitialize(&context_, DW_VERSION, &ctx_params);\n\n        \u002F\u002F Load DNN model (YOLO) optimized for Orin\n        dwDNNModelHandle_t model;\n        dwDNN_initializeTensorFlowModel(&model, \"\u002Fmodels\u002Fyolo_v5_fp16.trt\", context_);\n\n        \u002F\u002F Create object detector\n        dwObjectDetectorParams detector_params{};\n        detector_params.maxNumObjects = 100;\n        detector_params.enableTracking = true;\n        dwObjectDetector_initialize(&detector_, model, context_);\n\n        \u002F\u002F Initialize camera\n        dwSensorParams camera_params{};\n        camera_params.protocol = \"camera.gmsl\";\n        camera_params.parameters = \"device=0,output-format=yuv420\";\n        dwSAL_createSensor(&camera_, camera_params, sal_);\n    }\n\n    void ProcessFrame() {\n        \u002F\u002F Capture camera frame\n        dwCameraFrameHandle_t frame;\n        dwSensorCamera_getImage(&frame, DW_CAMERA_OUTPUT_CUDA_YUV420, camera_);\n\n        \u002F\u002F Run object detection on DLA\n        dwObjectArray detected_objects;\n        dwObjectDetector_processDeviceAsync(&detected_objects, frame, detector_);\n\n        \u002F\u002F Wait for DLA completion\n        dwObjectDetector_processDeviceSync(detector_);\n\n        \u002F\u002F Process detected objects\n        for (uint32_t i = 0; i \u003C detected_objects.size; ++i) {\n            const auto& obj = detected_objects.objects[i];\n            ProcessDetection(obj);\n        }\n\n        \u002F\u002F Release frame\n        dwSensorCamera_returnImage(&frame, camera_);\n    }\n\n    void ProcessDetection(const dwObject& obj) {\n        std::cout \u003C\u003C \"Object: \" \u003C\u003C GetClassLabel(obj.classLabel)\n                  \u003C\u003C \" Confidence: \" \u003C\u003C obj.confidence\n                  \u003C\u003C \" BBox: (\" \u003C\u003C obj.box.x \u003C\u003C \",\" \u003C\u003C obj.box.y \u003C\u003C \",\"\n                  \u003C\u003C obj.box.width \u003C\u003C \",\" \u003C\u003C obj.box.height \u003C\u003C \")\"\n                  \u003C\u003C std::endl;\n    }\n\n    ~ObjectDetector() {\n        dwObjectDetector_release(detector_);\n        dwSAL_releaseSensor(camera_);\n        dwRelease(context_);\n    }\n\nprivate:\n    dwContextHandle_t context_;\n    dwSALHandle_t sal_;\n    dwSensorHandle_t camera_;\n    dwObjectDetectorHandle_t detector_;\n\n    std::string GetClassLabel(uint32_t label) {\n        static const std::vector\u003Cstd::string> labels = {\n            \"car\", \"truck\", \"pedestrian\", \"bicycle\", \"motorcycle\"\n        };\n        return labels[label];\n    }\n};\n\n} \u002F\u002F namespace adas\n} \u002F\u002F namespace nvidia\n\nint main() {\n    nvidia::adas::ObjectDetector detector;\n\n    \u002F\u002F Process at 30Hz\n    while (true) {\n        detector.ProcessFrame();\n        std::this_thread::sleep_for(std::chrono::milliseconds(33));\n    }\n\n    return 0;\n}\n```\n\n**Performance Benchmarks (NVIDIA Orin):**\n```yaml\n# Orin Performance Profile\nmodel: NVIDIA DRIVE AGX Orin\nsoc: Parker\n\nbenchmarks:\n  yolo_v5_detection:\n    precision: FP16\n    input: 1920x1080\n    accelerator: DLA\n    throughput: 60 FPS\n    latency: 16ms\n    power: 15W\n\n  resnet50_classification:\n    precision: INT8\n    input: 224x224\n    accelerator: DLA\n    throughput: 2000 FPS\n    latency: 0.5ms\n    power: 8W\n\n  pointpillar_lidar:\n    precision: FP16\n    points: 100K\n    accelerator: GPU\n    throughput: 30 FPS\n    latency: 33ms\n    power: 25W\n\n  end_to_end_perception:\n    cameras: 8x 4K\n    lidar: 64-beam\n    radar: 4x continental\n    total_latency: 80ms\n    total_power: 55W\n    tops_utilized: 180\n```\n\n### NVIDIA DRIVE Thor\n\n**Next-Generation Platform (2025+):**\n- **2000 TOPS AI Performance**: 8x Orin capability\n- **Unified Architecture**: Single chip for all vehicle computing\n- **Grace CPU**: ARM Neoverse V2 cores\n- **Ada GPU**: Latest RTX architecture\n- **Consolidated**: Replaces 6-8 ECUs with single SoC\n\n**Thor Use Cases:**\n```python\n# NVIDIA DRIVE Thor - Consolidated Architecture\nplatform = {\n    'soc': 'NVIDIA DRIVE Thor',\n    'consolidated_functions': [\n        {\n            'domain': 'Autonomous Driving',\n            'workloads': ['Perception', 'Planning', 'Control'],\n            'tops_allocated': 1200,\n            'safety_level': 'ASIL-D'\n        },\n        {\n            'domain': 'ADAS',\n            'workloads': ['ACC', 'LKA', 'AEB', 'Parking'],\n            'tops_allocated': 300,\n            'safety_level': 'ASIL-B'\n        },\n        {\n            'domain': 'Cockpit',\n            'workloads': ['IVI', 'Cluster', 'HUD', 'Cameras'],\n            'tops_allocated': 200,\n            'safety_level': 'QM'\n        },\n        {\n            'domain': 'Body\u002FComfort',\n            'workloads': ['Lighting', 'HVAC', 'Access'],\n            'tops_allocated': 50,\n            'safety_level': 'QM'\n        },\n        {\n            'domain': 'Connectivity',\n            'workloads': ['Telematics', 'V2X', 'OTA'],\n            'tops_allocated': 50,\n            'safety_level': 'QM'\n        }\n    ],\n    'isolation': 'Hardware virtualization + Hypervisor',\n    'total_power': '300W @ peak, 150W @ typical'\n}\n```\n\n---\n\n## 2. Qualcomm Snapdragon Ride Platform\n\n**Snapdragon Ride Flex SoC:**\n- **CPU**: Kryo 780 (ARM Cortex-A78 based), 8 cores @ 3.0 GHz\n- **GPU**: Adreno 740 (Vulkan, OpenCL)\n- **AI**: Hexagon 780 DSP, 700 TOPS INT8\n- **ISP**: Spectra 18-bit triple ISP, 12x cameras\n- **Connectivity**: 5G modem, C-V2X, Wi-Fi 6E\n- **Safety**: ISO 26262 ASIL-D support\n\n**Snapdragon Software Stack:**\n```cpp\n\u002F\u002F Qualcomm SNPE (Snapdragon Neural Processing Engine)\n#include \u003CSNPE\u002FSNPE.hpp>\n#include \u003CSNPE\u002FSNPEFactory.hpp>\n#include \u003CDlContainer\u002FIDlContainer.hpp>\n\nnamespace qualcomm {\nnamespace adas {\n\nclass SNPEInference {\npublic:\n    SNPEInference(const std::string& model_path) {\n        \u002F\u002F Load DLC (Deep Learning Container)\n        container_ = zdl::DlContainer::IDlContainer::open(model_path);\n\n        \u002F\u002F Build SNPE network\n        zdl::SNPE::SNPEBuilder builder(container_.get());\n\n        \u002F\u002F Configure runtime (DSP > GPU > CPU)\n        builder.setRuntimeProcessorOrder({\n            zdl::DlSystem::Runtime_t::DSP,\n            zdl::DlSystem::Runtime_t::GPU,\n            zdl::DlSystem::Runtime_t::CPU\n        });\n\n        \u002F\u002F Set performance profile\n        builder.setPerformanceProfile(\n            zdl::DlSystem::PerformanceProfile_t::SUSTAINED_HIGH_PERFORMANCE\n        );\n\n        \u002F\u002F Build network\n        snpe_ = builder.build();\n\n        if (snpe_ == nullptr) {\n            throw std::runtime_error(\"Failed to build SNPE network\");\n        }\n    }\n\n    std::vector\u003Cfloat> Infer(const std::vector\u003Cfloat>& input) {\n        \u002F\u002F Create input tensor\n        auto input_shape = snpe_->getInputDimensions();\n        zdl::DlSystem::ITensor* input_tensor =\n            zdl::SNPE::SNPEFactory::getTensorFactory().createTensor(input_shape);\n\n        \u002F\u002F Copy input data\n        std::copy(input.begin(), input.end(),\n                  input_tensor->begin());\n\n        \u002F\u002F Execute inference on Hexagon DSP\n        snpe_->execute(input_tensor, output_map_);\n\n        \u002F\u002F Extract output\n        zdl::DlSystem::ITensor* output_tensor =\n            output_map_.getTensor(output_map_.getTensorNames()[0]);\n\n        std::vector\u003Cfloat> output(output_tensor->begin(), output_tensor->end());\n        return output;\n    }\n\nprivate:\n    std::unique_ptr\u003Czdl::DlContainer::IDlContainer> container_;\n    std::unique_ptr\u003Czdl::SNPE::SNPE> snpe_;\n    zdl::DlSystem::TensorMap output_map_;\n};\n\n} \u002F\u002F namespace adas\n} \u002F\u002F namespace qualcomm\n```\n\n**Snapdragon Performance:**\n```yaml\nsnapdragon_ride_flex:\n  ai_performance: 700 TOPS INT8\n  camera_support: 12x simultaneous\n  display_output: 4x 4K60\n\n  benchmark_results:\n    mobilenet_v2:\n      precision: INT8\n      accelerator: Hexagon DSP\n      throughput: 5000 FPS\n      latency: 0.2ms\n      power: 3W\n\n    efficientdet_d2:\n      precision: FP16\n      accelerator: Adreno GPU\n      throughput: 45 FPS\n      latency: 22ms\n      power: 12W\n\n    lane_detection:\n      model: Ultra-Fast-Lane\n      accelerator: Hexagon DSP\n      throughput: 90 FPS\n      latency: 11ms\n      power: 5W\n```\n\n---\n\n## 3. NXP S32 Platform Family\n\n### NXP S32G3 (Gateway & Vehicle Networking)\n\n**Specifications:**\n- **CPU**: 8-core ARM Cortex-A53 @ 1.0 GHz\n- **Networking**: 8x Ethernet (up to 10GbE), 16x CAN-FD\n- **Memory**: Up to 16GB DDR4\n- **Safety**: ISO 26262 ASIL-B lockstep cores\n- **HSE**: Hardware Security Engine for secure boot\n\n**S32G3 Gateway Application:**\n```cpp\n\u002F\u002F NXP S32G - Secure Gateway with HSE\n#include \u003Cs32g\u002Fhse_interface.h>\n#include \u003Cs32g\u002Fnetc_driver.h>\n\nnamespace nxp {\nnamespace gateway {\n\nclass SecureGateway {\npublic:\n    SecureGateway() {\n        \u002F\u002F Initialize Hardware Security Engine\n        InitializeHSE();\n\n        \u002F\u002F Configure NETC (Network Controller)\n        InitializeNetworking();\n    }\n\n    void InitializeHSE() {\n        \u002F\u002F HSE firmware installation\n        HSE_InstallFirmware(hse_firmware_bin, firmware_size);\n\n        \u002F\u002F Configure secure boot\n        HSE_ConfigureSecureBoot({\n            .enable_secure_boot = true,\n            .key_store = HSE_KEY_STORE_RAM,\n            .boot_auth_algorithm = HSE_AUTH_SCHEME_RSA2048\n        });\n\n        \u002F\u002F Setup MAC authentication for CAN\u002FEthernet\n        HSE_ConfigureMACGeneration(HSE_MAC_ALGO_CMAC_AES128);\n    }\n\n    void InitializeNetworking() {\n        \u002F\u002F Configure 10GbE for zonal architecture\n        NETC_ConfigureEthernet({\n            .port = NETC_PORT_0,\n            .speed = NETC_SPEED_10G,\n            .mode = NETC_MODE_SWITCH,\n            .vlan_support = true,\n            .time_sync = NETC_PTP_SLAVE  \u002F\u002F IEEE 1588 PTP\n        });\n\n        \u002F\u002F Configure CAN-FD gateway\n        NETC_ConfigureCANGateway({\n            .can_ports = {NETC_CAN_0, NETC_CAN_1, NETC_CAN_2},\n            .routing_rules = LoadRoutingTable(),\n            .frame_authentication = true  \u002F\u002F Use HSE for MAC\n        });\n    }\n\n    void RouteMessage(const CANMessage& msg) {\n        \u002F\u002F Authenticate incoming CAN message using HSE\n        if (!AuthenticateMessage(msg)) {\n            LogSecurityEvent(\"Invalid CAN message authentication\");\n            return;\n        }\n\n        \u002F\u002F Route to appropriate network\n        auto route = routing_table_.Lookup(msg.id);\n        if (route.target_network == NetworkType::ETHERNET) {\n            ForwardToEthernet(msg, route.target_address);\n        } else if (route.target_network == NetworkType::CAN) {\n            ForwardToCAN(msg, route.target_bus);\n        }\n    }\n\nprivate:\n    bool AuthenticateMessage(const CANMessage& msg) {\n        \u002F\u002F Extract MAC from message\n        uint8_t received_mac[16];\n        ExtractMAC(msg, received_mac);\n\n        \u002F\u002F Compute expected MAC using HSE\n        uint8_t expected_mac[16];\n        HSE_ComputeMAC(msg.data, msg.length, expected_mac);\n\n        return std::memcmp(received_mac, expected_mac, 16) == 0;\n    }\n\n    void ForwardToEthernet(const CANMessage& msg, uint32_t target_ip) {\n        \u002F\u002F Encapsulate CAN in SOME\u002FIP or DDS\n        EthernetFrame frame = EncapsulateCANInSOMEIP(msg);\n        NETC_SendEthernetFrame(NETC_PORT_0, frame);\n    }\n\n    RoutingTable routing_table_;\n};\n\n} \u002F\u002F namespace gateway\n} \u002F\u002F namespace nxp\n```\n\n### NXP S32Z\u002FE (Real-Time & Safety)\n\n**Specifications:**\n- **CPU**: 16-core ARM Cortex-R52 @ 800 MHz (lockstep pairs)\n- **Safety**: ISO 26262 ASIL-D\n- **Real-Time**: Deterministic execution, hardware semaphores\n- **Use Cases**: Safety domain controller, real-time control\n\n---\n\n## 4. Thermal Management\n\n**Thermal Control Strategy:**\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"\nHPC Thermal Management for Automotive\nPrevents thermal throttling while maintaining performance\n\"\"\"\n\nimport time\nfrom dataclasses import dataclass\nfrom typing import List\n\n@dataclass\nclass ThermalZone:\n    name: str\n    sensor_path: str\n    trip_points: List[int]  # [warning, critical, shutdown]\n    cooling_devices: List[str]\n\nclass ThermalManager:\n    def __init__(self):\n        self.zones = {\n            'cpu': ThermalZone(\n                name='CPU Package',\n                sensor_path='\u002Fsys\u002Fclass\u002Fthermal\u002Fthermal_zone0\u002Ftemp',\n                trip_points=[85, 95, 105],  # °C\n                cooling_devices=['cpu_fan', 'cpu_freq']\n            ),\n            'gpu': ThermalZone(\n                name='GPU Core',\n                sensor_path='\u002Fsys\u002Fclass\u002Fthermal\u002Fthermal_zone1\u002Ftemp',\n                trip_points=[80, 90, 100],\n                cooling_devices=['gpu_fan', 'gpu_freq']\n            ),\n            'dla': ThermalZone(\n                name='DLA Accelerator',\n                sensor_path='\u002Fsys\u002Fclass\u002Fthermal\u002Fthermal_zone2\u002Ftemp',\n                trip_points=[85, 95, 105],\n                cooling_devices=['system_fan', 'dla_throttle']\n            )\n        }\n\n    def monitor_and_control(self):\n        \"\"\"Main thermal control loop (1Hz)\"\"\"\n        while True:\n            for zone_name, zone in self.zones.items():\n                temp = self.read_temperature(zone)\n\n                if temp >= zone.trip_points[2]:\n                    # Shutdown threshold\n                    self.emergency_shutdown(zone)\n                elif temp >= zone.trip_points[1]:\n                    # Critical: aggressive throttling\n                    self.apply_aggressive_cooling(zone)\n                elif temp >= zone.trip_points[0]:\n                    # Warning: moderate throttling\n                    self.apply_moderate_cooling(zone)\n                else:\n                    # Normal: restore performance\n                    self.restore_performance(zone)\n\n            time.sleep(1.0)\n\n    def read_temperature(self, zone: ThermalZone) -> float:\n        \"\"\"Read temperature from sysfs (in milli-degrees)\"\"\"\n        with open(zone.sensor_path, 'r') as f:\n            temp_millidegrees = int(f.read().strip())\n        return temp_millidegrees \u002F 1000.0\n\n    def apply_aggressive_cooling(self, zone: ThermalZone):\n        \"\"\"Critical temperature: max cooling\"\"\"\n        print(f\"CRITICAL: {zone.name} at {self.read_temperature(zone)}°C\")\n\n        # Set fan to 100%\n        self.set_fan_speed('system_fan', 100)\n\n        # Reduce CPU\u002FGPU frequency to 50%\n        if 'cpu_freq' in zone.cooling_devices:\n            self.set_frequency_limit('cpu', 0.5)\n        if 'gpu_freq' in zone.cooling_devices:\n            self.set_frequency_limit('gpu', 0.5)\n\n        # Throttle DLA workload\n        if 'dla_throttle' in zone.cooling_devices:\n            self.throttle_dla_workload(0.5)\n\n    def apply_moderate_cooling(self, zone: ThermalZone):\n        \"\"\"Warning temperature: moderate cooling\"\"\"\n        print(f\"WARNING: {zone.name} at {self.read_temperature(zone)}°C\")\n\n        # Set fan to 70%\n        self.set_fan_speed('system_fan', 70)\n\n        # Reduce frequency to 80%\n        if 'cpu_freq' in zone.cooling_devices:\n            self.set_frequency_limit('cpu', 0.8)\n        if 'gpu_freq' in zone.cooling_devices:\n            self.set_frequency_limit('gpu', 0.8)\n\n    def restore_performance(self, zone: ThermalZone):\n        \"\"\"Normal temperature: full performance\"\"\"\n        # Fan at baseline (40%)\n        self.set_fan_speed('system_fan', 40)\n\n        # Restore full frequency\n        self.set_frequency_limit('cpu', 1.0)\n        self.set_frequency_limit('gpu', 1.0)\n        self.throttle_dla_workload(1.0)\n\n    def set_fan_speed(self, fan: str, percent: int):\n        \"\"\"Set fan PWM duty cycle\"\"\"\n        pwm_path = f'\u002Fsys\u002Fclass\u002Fhwmon\u002Fhwmon0\u002F{fan}'\n        with open(pwm_path, 'w') as f:\n            f.write(str(int(255 * percent \u002F 100)))\n\n    def set_frequency_limit(self, component: str, ratio: float):\n        \"\"\"Set frequency scaling governor\"\"\"\n        if component == 'cpu':\n            path = '\u002Fsys\u002Fdevices\u002Fsystem\u002Fcpu\u002Fcpufreq\u002Fpolicy0\u002Fscaling_max_freq'\n            max_freq = 2400000  # 2.4 GHz\n        elif component == 'gpu':\n            path = '\u002Fsys\u002Fclass\u002Fdrm\u002Fcard0\u002Fdevice\u002Fpp_dpm_sclk'\n            max_freq = 1500000  # 1.5 GHz\n\n        target_freq = int(max_freq * ratio)\n        with open(path, 'w') as f:\n            f.write(str(target_freq))\n\n    def throttle_dla_workload(self, ratio: float):\n        \"\"\"Reduce DLA workload by skipping frames\"\"\"\n        # Application-level throttling\n        pass\n\n    def emergency_shutdown(self, zone: ThermalZone):\n        \"\"\"Emergency thermal shutdown\"\"\"\n        print(f\"EMERGENCY SHUTDOWN: {zone.name} exceeded safe limits\")\n        # Trigger graceful shutdown\n        import subprocess\n        subprocess.run(['systemctl', 'poweroff'])\n\nif __name__ == '__main__':\n    manager = ThermalManager()\n    manager.monitor_and_control()\n```\n\n## Power Budget Management\n\n**Platform Power Profiles:**\n```yaml\n# Power management for NVIDIA Orin in production vehicle\norin_power_budget:\n  max_tdp: 60W\n  cooling: Liquid cold plate (0.2 °C\u002FW)\n\n  power_states:\n    parking_mode:\n      cpu_cores: 2\n      cpu_freq: 1.2 GHz\n      gpu_active: false\n      dla_active: false\n      power: 8W\n      use_case: \"Parking assist, surround view\"\n\n    driving_mode:\n      cpu_cores: 12\n      cpu_freq: 2.2 GHz\n      gpu_active: true\n      dla_active: true\n      dla_utilization: 80%\n      power: 45W\n      use_case: \"Full ADAS, L3 autonomous\"\n\n    charging_mode:\n      cpu_cores: 4\n      cpu_freq: 1.8 GHz\n      gpu_active: false\n      dla_active: false\n      power: 15W\n      use_case: \"OTA updates, diagnostics\"\n\n  power_optimization:\n    - \"Dynamic Voltage Frequency Scaling (DVFS)\"\n    - \"Clock gating for idle IP blocks\"\n    - \"DLA preferred over GPU (5x power efficiency)\"\n    - \"Camera ISP pipeline optimization\"\n```\n\n## Use Cases\n\n1. **L3+ Autonomous Driving**: NVIDIA Orin for sensor fusion and path planning\n2. **Zonal Architecture Gateway**: NXP S32G3 for network consolidation\n3. **Cockpit Domain Controller**: Qualcomm Snapdragon Ride for IVI + cluster\n4. **Safety Domain**: NXP S32Z\u002FE for ASIL-D real-time control\n\n## References\n\n- NVIDIA DRIVE Orin Product Brief\n- Qualcomm Snapdragon Ride Platform Overview\n- NXP S32 Automotive Platform Family\n- \"Automotive SoC Benchmarks\" (MLPerf Inference)\n\n---\n\n**Version:** 1.0.0\n**Last Updated:** 2026-03-19\n**Author:** Automotive Claude Code Agents\n","# Automotive Hpc\n\n## Autosar Adaptive\n\n# AUTOSAR Adaptive Platform for HPC\n\n**Category:** automotive-hpc\n**Version:** 1.0.0\n**Maturity:** production\n**Complexity:** advanced\n\n## Overview\n\nComprehensive guide to AUTOSAR Adaptive Platform (AP) for high-performance computing in Software-Defined Vehicles. Covers service-oriented architecture, ara::com communication, execution management, state management, and C++14 framework development.\n\n## Core Competencies\n\n### 1. AUTOSAR Adaptive Architecture\n\n**AUTOSAR Adaptive Platform Stack:**\n```\n┌─────────────────────────────────────────────────┐\n│         Adaptive Applications (C++14)           │\n├─────────────────────────────────────────────────┤\n│  ara::com  │  ara::exec │  ara::log │  ara::per│\n│  ara::diag │  ara::sm   │  ara::ucm │  ara::phm│\n├─────────────────────────────────────────────────┤\n│          Adaptive Platform Foundation           │\n│  - Communication Management (SOME\u002FIP)           │\n│  - Execution Management (Process Control)       │\n│  - State Management (Function Groups)           │\n│  - Update & Config Management                   │\n├─────────────────────────────────────────────────┤\n│       Operating System (POSIX PSE51)            │\n│  - Linux with PREEMPT_RT patch                  │\n│  - QNX 7.1 (Safety-certified option)            │\n└─────────────────────────────────────────────────┘\n```\n\n### 2. Service-Oriented Communication (ara::com)\n\n**Service Interface Definition (ARXML):**\n```xml\n\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003CAUTOSAR xmlns=\"http:\u002F\u002Fautosar.org\u002Fschema\u002Fr4.0\">\n    \u003CAR-PACKAGES>\n        \u003CAR-PACKAGE>\n            \u003CSHORT-NAME>RadarServices\u003C\u002FSHORT-NAME>\n            \u003CELEMENTS>\n                \u003C!-- Service Interface Definition -->\n                \u003CSERVICE-INTERFACE>\n                    \u003CSHORT-NAME>RadarFusion\u003C\u002FSHORT-NAME>\n                    \u003CMAJOR-VERSION>1\u003C\u002FMAJOR-VERSION>\n                    \u003CMINOR-VERSION>0\u003C\u002FMINOR-VERSION>\n\n                    \u003C!-- Events (pub\u002Fsub) -->\n                    \u003CEVENTS>\n                        \u003CVARIABLE-DATA-PROTOTYPE>\n                            \u003CSHORT-NAME>ObjectList\u003C\u002FSHORT-NAME>\n                            \u003CTYPE-TREF DEST=\"IMPLEMENTATION-DATA-TYPE\">\u002FDataTypes\u002FObjectListType\u003C\u002FTYPE-TREF>\n                        \u003C\u002FVARIABLE-DATA-PROTOTYPE>\n                        \u003CVARIABLE-DATA-PROTOTYPE>\n                            \u003CSHORT-NAME>FreeSpaceMap\u003C\u002FSHORT-NAME>\n                            \u003CTYPE-TREF DEST=\"IMPLEMENTATION-DATA-TYPE\">\u002FDataTypes\u002FFreeSpaceMapType\u003C\u002FTYPE-TREF>\n                        \u003C\u002FVARIABLE-DATA-PROTOTYPE>\n                    \u003C\u002FEVENTS>\n\n                    \u003C!-- Methods (client\u002Fserver) -->\n                    \u003CMETHODS>\n                        \u003CCLIENT-SERVER-OPERATION>\n                            \u003CSHORT-NAME>SetRadarMode\u003C\u002FSHORT-NAME>\n                            \u003CARGUMENTS>\n                                \u003CARGUMENT-DATA-PROTOTYPE>\n                                    \u003CSHORT-NAME>mode\u003C\u002FSHORT-NAME>\n                                    \u003CTYPE-TREF DEST=\"IMPLEMENTATION-DATA-TYPE\">\u002FDataTypes\u002FRadarModeType\u003C\u002FTYPE-TREF>\n                                    \u003CDIRECTION>IN\u003C\u002FDIRECTION>\n                                \u003C\u002FARGUMENT-DATA-PROTOTYPE>\n                                \u003CARGUMENT-DATA-PROTOTYPE>\n                                    \u003CSHORT-NAME>success\u003C\u002FSHORT-NAME>\n                                    \u003CTYPE-TREF DEST=\"IMPLEMENTATION-DATA-TYPE\">\u002FDataTypes\u002FBooleanType\u003C\u002FTYPE-TREF>\n                                    \u003CDIRECTION>OUT\u003C\u002FDIRECTION>\n                                \u003C\u002FARGUMENT-DATA-PROTOTYPE>\n                            \u003C\u002FARGUMENTS>\n                            \u003CPOSSIBLE-ERROR-REFS>\n                                \u003CPOSSIBLE-ERROR-REF DEST=\"APPLICATION-ERROR\">\u002FErrors\u002FInvalidModeError\u003C\u002FPOSSIBLE-ERROR-REF>\n                            \u003C\u002FPOSSIBLE-ERROR-REFS>\n                        \u003C\u002FCLIENT-SERVER-OPERATION>\n                    \u003C\u002FMETHODS>\n\n                    \u003C!-- Fields (getter\u002Fsetter) -->\n                    \u003CFIELDS>\n                        \u003CFIELD>\n                            \u003CSHORT-NAME>RadarStatus\u003C\u002FSHORT-NAME>\n                            \u003CTYPE-TREF DEST=\"IMPLEMENTATION-DATA-TYPE\">\u002FDataTypes\u002FRadarStatusType\u003C\u002FTYPE-TREF>\n                            \u003CHAS-GETTER>true\u003C\u002FHAS-GETTER>\n                            \u003CHAS-SETTER>false\u003C\u002FHAS-SETTER>\n                            \u003CHAS-NOTIFIER>true\u003C\u002FHAS-NOTIFIER>\n                        \u003C\u002FFIELD>\n                    \u003C\u002FFIELDS>\n                \u003C\u002FSERVICE-INTERFACE>\n\n                \u003C!-- Service Instance Deployment -->\n                \u003CSOMEIP-SERVICE-INSTANCE-TO-MACHINE-MAPPING>\n                    \u003CSHORT-NAME>RadarFusionInstance\u003C\u002FSHORT-NAME>\n                    \u003CCOMMUNICATION-CONNECTOR-REF DEST=\"ETHERNET-COMMUNICATION-CONNECTOR\">\n                        \u002FNetwork\u002FEthernetConnector\n                    \u003C\u002FCOMMUNICATION-CONNECTOR-REF>\n                    \u003CSERVICE-INTERFACE-DEPLOYMENT-REF DEST=\"SOMEIP-SERVICE-INTERFACE-DEPLOYMENT\">\n                        \u002FDeployments\u002FRadarFusionDeployment\n                    \u003C\u002FSERVICE-INTERFACE-DEPLOYMENT-REF>\n                    \u003CSOMEIP-SERVICE-INSTANCE-CONFIG>\n                        \u003CSERVICE-ID>0x1234\u003C\u002FSERVICE-ID>\n                        \u003CINSTANCE-ID>0x0001\u003C\u002FINSTANCE-ID>\n                        \u003CMAJOR-VERSION>1\u003C\u002FMAJOR-VERSION>\n                        \u003CMINOR-VERSION>0\u003C\u002FMINOR-VERSION>\n                        \u003CUDP-PORT>30490\u003C\u002FUDP-PORT>\n                        \u003CTCP-PORT>30491\u003C\u002FTCP-PORT>\n                    \u003C\u002FSOMEIP-SERVICE-INSTANCE-CONFIG>\n                \u003C\u002FSOMEIP-SERVICE-INSTANCE-TO-MACHINE-MAPPING>\n            \u003C\u002FELEMENTS>\n        \u003C\u002FAR-PACKAGE>\n    \u003C\u002FAR-PACKAGES>\n\u003C\u002FAUTOSAR>\n```\n\n**C++14 Service Implementation (Provider):**\n```cpp\n\u002F\u002F radar_fusion_service_impl.hpp\n#include \u003Cara\u002Fcom\u002Ftypes.h>\n#include \u003Cara\u002Fcom\u002Finstance_identifier.h>\n#include \u003Cara\u002Fcom\u002Fskeleton.h>\n#include \"radar_fusion_skeleton.h\"  \u002F\u002F Generated from ARXML\n\nnamespace radar {\nnamespace fusion {\n\nclass RadarFusionServiceImpl {\npublic:\n    RadarFusionServiceImpl()\n        : skeleton_(ara::com::InstanceIdentifier(\"RadarFusion\u002FInstance1\")) {\n\n        \u002F\u002F Register method handler\n        skeleton_.SetRadarMode.SetMethodCallHandler(\n            [this](const RadarModeType& mode) -> ara::core::Future\u003CSetRadarModeOutput> {\n                return HandleSetRadarMode(mode);\n            }\n        );\n\n        \u002F\u002F Offer service on network\n        skeleton_.OfferService();\n    }\n\n    ~RadarFusionServiceImpl() {\n        skeleton_.StopOfferService();\n    }\n\n    \u002F\u002F Publish object list event (10Hz)\n    void PublishObjectList(const ObjectListType& objects) {\n        skeleton_.ObjectList.Send(objects);\n    }\n\n    \u002F\u002F Update field value with notification\n    void UpdateRadarStatus(const RadarStatusType& status) {\n        skeleton_.RadarStatus.Update(status);\n    }\n\nprivate:\n    RadarFusionSkeleton skeleton_;\n\n    ara::core::Future\u003CSetRadarModeOutput> HandleSetRadarMode(const RadarModeType& mode) {\n        ara::core::Promise\u003CSetRadarModeOutput> promise;\n\n        if (mode \u003C RadarModeType::MIN || mode > RadarModeType::MAX) {\n            \u002F\u002F Return application error\n            promise.SetError(ara::com::ApplicationErrorDomain::Errc::kInvalidMode);\n        } else {\n            \u002F\u002F Apply mode change\n            ApplyRadarMode(mode);\n\n            SetRadarModeOutput output;\n            output.success = true;\n            promise.set_value(output);\n        }\n\n        return promise.get_future();\n    }\n\n    void ApplyRadarMode(const RadarModeType& mode) {\n        \u002F\u002F Hardware-specific mode configuration\n        \u002F\u002F ...\n    }\n};\n\n} \u002F\u002F namespace fusion\n} \u002F\u002F namespace radar\n\n\u002F\u002F Main application\nint main() {\n    ara::log::InitLogging(\"RadarFusion\", ara::log::LogLevel::kInfo);\n    ara::exec::ExecutionClient exec_client;\n\n    \u002F\u002F Report Execution State\n    exec_client.ReportExecutionState(ara::exec::ExecutionState::kRunning);\n\n    \u002F\u002F Create service\n    radar::fusion::RadarFusionServiceImpl service;\n\n    \u002F\u002F Main processing loop\n    while (!ShutdownRequested()) {\n        \u002F\u002F Process radar data\n        auto objects = ProcessRadarData();\n        service.PublishObjectList(objects);\n\n        std::this_thread::sleep_for(std::chrono::milliseconds(100));\n    }\n\n    \u002F\u002F Clean shutdown\n    exec_client.ReportExecutionState(ara::exec::ExecutionState::kTerminating);\n    return 0;\n}\n```\n\n**C++14 Service Consumer (Proxy):**\n```cpp\n\u002F\u002F adas_controller.cpp\n#include \u003Cara\u002Fcom\u002Fproxy.h>\n#include \"radar_fusion_proxy.h\"\n\nnamespace adas {\n\nclass AdasController {\npublic:\n    AdasController() {\n        \u002F\u002F Find service instances\n        auto find_handle = RadarFusionProxy::StartFindService(\n            [this](ara::com::ServiceHandleContainer\u003CRadarFusionProxy::HandleType> handles,\n                   ara::com::FindServiceHandle find_handle) {\n                this->OnServiceAvailable(std::move(handles));\n            }\n        );\n    }\n\n    void OnServiceAvailable(ara::com::ServiceHandleContainer\u003CRadarFusionProxy::HandleType> handles) {\n        if (!handles.empty()) {\n            \u002F\u002F Create proxy to first available service\n            proxy_ = std::make_unique\u003CRadarFusionProxy>(handles[0]);\n\n            \u002F\u002F Subscribe to ObjectList event\n            proxy_->ObjectList.Subscribe(10 \u002F* queue size *\u002F);\n            proxy_->ObjectList.SetReceiveHandler(\n                [this]() { this->OnObjectListReceived(); }\n            );\n\n            \u002F\u002F Subscribe to RadarStatus field changes\n            proxy_->RadarStatus.Subscribe(1);\n            proxy_->RadarStatus.SetReceiveHandler(\n                [this]() { this->OnRadarStatusChanged(); }\n            );\n\n            \u002F\u002F Call method\n            SetRadarMode(RadarModeType::LONG_RANGE);\n        }\n    }\n\n    void OnObjectListReceived() {\n        proxy_->ObjectList.GetNewSamples(\n            [this](auto sample) {\n                \u002F\u002F Process object list\n                for (const auto& obj : sample->objects) {\n                    ProcessDetectedObject(obj);\n                }\n            }\n        );\n    }\n\n    void OnRadarStatusChanged() {\n        auto status = proxy_->RadarStatus.Get();\n        ara::log::LogInfo() \u003C\u003C \"Radar status: \" \u003C\u003C status.value();\n    }\n\n    void SetRadarMode(RadarModeType mode) {\n        \u002F\u002F Async method call\n        auto future = proxy_->SetRadarMode(mode);\n\n        future.then([](ara::core::Future\u003CSetRadarModeOutput> result) {\n            if (result.HasValue()) {\n                auto output = result.GetResult();\n                if (output.value().success) {\n                    ara::log::LogInfo() \u003C\u003C \"Mode change successful\";\n                }\n            } else {\n                auto error = result.GetError();\n                ara::log::LogError() \u003C\u003C \"Mode change failed: \" \u003C\u003C error;\n            }\n        });\n    }\n\nprivate:\n    std::unique_ptr\u003CRadarFusionProxy> proxy_;\n\n    void ProcessDetectedObject(const ObjectType& obj) {\n        \u002F\u002F ADAS processing logic\n        \u002F\u002F ...\n    }\n};\n\n} \u002F\u002F namespace adas\n```\n\n### 3. Execution Management (ara::exec)\n\n**Application Manifest (JSON):**\n```json\n{\n  \"ApplicationManifest\": {\n    \"shortName\": \"RadarFusionApp\",\n    \"executableName\": \"radar_fusion\",\n    \"version\": \"1.0.0\",\n\n    \"processDesign\": {\n      \"executable\": \"\u002Fopt\u002Fautosar\u002Fbin\u002Fradar_fusion\",\n      \"arguments\": [\"--config\", \"\u002Fetc\u002Fautosar\u002Fradar_fusion.yaml\"],\n      \"environmentVariables\": {\n        \"LD_LIBRARY_PATH\": \"\u002Fopt\u002Fautosar\u002Flib\",\n        \"LOG_LEVEL\": \"INFO\"\n      }\n    },\n\n    \"resourceGroups\": [\n      {\n        \"name\": \"RadarFusionResources\",\n        \"cpuCores\": [4, 5, 6, 7],\n        \"memoryMB\": 512,\n        \"priority\": 80,\n        \"schedulingPolicy\": \"SCHED_FIFO\"\n      }\n    ],\n\n    \"startupConfig\": {\n      \"functionGroup\": \"DrivingMode\",\n      \"startupTimeout\": 5000,\n      \"dependsOn\": [\n        \"SensorAcquisition\",\n        \"NetworkStack\"\n      ]\n    },\n\n    \"stateManagement\": {\n      \"functionGroup\": \"DrivingMode\",\n      \"states\": [\n        {\n          \"name\": \"Startup\",\n          \"timeout\": 2000\n        },\n        {\n          \"name\": \"Running\",\n          \"timeout\": -1\n        },\n        {\n          \"name\": \"Degraded\",\n          \"timeout\": -1\n        },\n        {\n          \"name\": \"Shutdown\",\n          \"timeout\": 5000\n        }\n      ]\n    },\n\n    \"healthMonitoring\": {\n      \"checkpoints\": [\n        {\n          \"name\": \"DataProcessing\",\n          \"maxInterval\": 200\n        },\n        {\n          \"name\": \"NetworkCommunication\",\n          \"maxInterval\": 1000\n        }\n      ],\n      \"aliveSupervision\": {\n        \"expectedAliveIndications\": 10,\n        \"minInterval\": 50,\n        \"maxInterval\": 150\n      }\n    }\n  }\n}\n```\n\n**Execution Client Implementation:**\n```cpp\n\u002F\u002F execution_manager.cpp\n#include \u003Cara\u002Fexec\u002Fexecution_client.h>\n#include \u003Cara\u002Fexec\u002Fstate_client.h>\n#include \u003Cara\u002Fphm\u002Fsupervised_entity.h>\n\nnamespace radar {\nnamespace exec {\n\nclass ExecutionManager {\npublic:\n    ExecutionManager()\n        : exec_client_(),\n          state_client_(),\n          supervised_entity_(\"RadarFusion\") {\n\n        \u002F\u002F Register state transition handler\n        state_client_.SetStateTransitionHandler(\n            [this](ara::exec::StateTransition transition) {\n                this->HandleStateTransition(transition);\n            }\n        );\n    }\n\n    void Initialize() {\n        \u002F\u002F Report to Execution Management that we're starting\n        exec_client_.ReportExecutionState(ara::exec::ExecutionState::kRunning);\n\n        \u002F\u002F Report checkpoint during initialization\n        supervised_entity_.ReportCheckpoint(\n            ara::phm::CheckpointIdentifier(\"Initialization\")\n        );\n\n        \u002F\u002F Load configuration\n        LoadConfiguration();\n\n        \u002F\u002F Initialize hardware\n        InitializeRadarHardware();\n\n        \u002F\u002F Start alive supervision\n        StartAlivenessMonitoring();\n    }\n\n    void Run() {\n        while (!shutdown_requested_) {\n            \u002F\u002F Report alive indication\n            supervised_entity_.ReportAlive();\n\n            \u002F\u002F Main processing\n            ProcessRadarData();\n\n            \u002F\u002F Report data processing checkpoint\n            supervised_entity_.ReportCheckpoint(\n                ara::phm::CheckpointIdentifier(\"DataProcessing\")\n            );\n\n            std::this_thread::sleep_for(std::chrono::milliseconds(100));\n        }\n    }\n\n    void Shutdown() {\n        \u002F\u002F Stop processing\n        StopRadarHardware();\n\n        \u002F\u002F Report terminating state\n        exec_client_.ReportExecutionState(ara::exec::ExecutionState::kTerminating);\n    }\n\nprivate:\n    ara::exec::ExecutionClient exec_client_;\n    ara::exec::StateClient state_client_;\n    ara::phm::SupervisedEntity supervised_entity_;\n    std::atomic\u003Cbool> shutdown_requested_{false};\n\n    void HandleStateTransition(ara::exec::StateTransition transition) {\n        ara::log::LogInfo() \u003C\u003C \"State transition: \"\n                           \u003C\u003C transition.from_state \u003C\u003C \" -> \"\n                           \u003C\u003C transition.to_state;\n\n        if (transition.to_state == \"Shutdown\") {\n            shutdown_requested_ = true;\n        } else if (transition.to_state == \"Degraded\") {\n            EnterDegradedMode();\n        }\n    }\n\n    void StartAlivenessMonitoring() {\n        \u002F\u002F Start thread for periodic alive reporting\n        alive_thread_ = std::thread([this]() {\n            while (!shutdown_requested_) {\n                supervised_entity_.ReportAlive();\n                std::this_thread::sleep_for(std::chrono::milliseconds(100));\n            }\n        });\n    }\n\n    void ProcessRadarData() {\n        \u002F\u002F Radar processing logic\n    }\n\n    void EnterDegradedMode() {\n        \u002F\u002F Reduce functionality for degraded operation\n        ara::log::LogWarn() \u003C\u003C \"Entering degraded mode\";\n    }\n\n    std::thread alive_thread_;\n};\n\n} \u002F\u002F namespace exec\n} \u002F\u002F namespace radar\n\nint main() {\n    radar::exec::ExecutionManager manager;\n\n    try {\n        manager.Initialize();\n        manager.Run();\n        manager.Shutdown();\n    } catch (const std::exception& e) {\n        ara::log::LogFatal() \u003C\u003C \"Fatal error: \" \u003C\u003C e.what();\n        return EXIT_FAILURE;\n    }\n\n    return EXIT_SUCCESS;\n}\n```\n\n### 4. State Management (ara::sm)\n\n**Function Group State Machine:**\n```cpp\n\u002F\u002F state_machine.cpp\n#include \u003Cara\u002Fsm\u002Fstate_client.h>\n#include \u003Cara\u002Fsm\u002Ftrigger_out.h>\n\nnamespace vehicle {\nnamespace sm {\n\nenum class VehicleMode {\n    OFF,\n    STANDBY,\n    DRIVING,\n    PARKING,\n    CHARGING,\n    DIAGNOSTIC\n};\n\nclass VehicleStateManager {\npublic:\n    VehicleStateManager() {\n        \u002F\u002F Subscribe to function group state changes\n        state_client_.SetStateTransitionHandler(\n            [this](const ara::sm::FunctionGroupState& state) {\n                this->OnStateChange(state);\n            }\n        );\n\n        \u002F\u002F Register trigger providers\n        RegisterTriggers();\n    }\n\n    void RequestModeChange(VehicleMode target_mode) {\n        ara::sm::FunctionGroupState target_state;\n\n        switch (target_mode) {\n            case VehicleMode::DRIVING:\n                target_state = ara::sm::FunctionGroupState(\"DrivingMode\");\n                break;\n            case VehicleMode::PARKING:\n                target_state = ara::sm::FunctionGroupState(\"ParkingMode\");\n                break;\n            case VehicleMode::CHARGING:\n                target_state = ara::sm::FunctionGroupState(\"ChargingMode\");\n                break;\n            default:\n                ara::log::LogError() \u003C\u003C \"Invalid mode requested\";\n                return;\n        }\n\n        \u002F\u002F Request state transition\n        auto result = state_client_.SetState(target_state);\n        result.then([target_mode](ara::core::Future\u003Cvoid> future) {\n            if (future.has_value()) {\n                ara::log::LogInfo() \u003C\u003C \"Mode change to \"\n                                   \u003C\u003C static_cast\u003Cint>(target_mode)\n                                   \u003C\u003C \" successful\";\n            } else {\n                ara::log::LogError() \u003C\u003C \"Mode change failed: \"\n                                    \u003C\u003C future.GetError().Message();\n            }\n        });\n    }\n\nprivate:\n    ara::sm::StateClient state_client_;\n    std::unique_ptr\u003Cara::sm::TriggerOut> ignition_trigger_;\n    std::unique_ptr\u003Cara::sm::TriggerOut> charging_trigger_;\n\n    void RegisterTriggers() {\n        \u002F\u002F Register ignition trigger\n        ignition_trigger_ = std::make_unique\u003Cara::sm::TriggerOut>(\n            ara::sm::TriggerIdentifier(\"IgnitionOn\")\n        );\n\n        \u002F\u002F Register charging trigger\n        charging_trigger_ = std::make_unique\u003Cara::sm::TriggerOut>(\n            ara::sm::TriggerIdentifier(\"ChargingConnected\")\n        );\n    }\n\n    void OnStateChange(const ara::sm::FunctionGroupState& state) {\n        ara::log::LogInfo() \u003C\u003C \"Function group state changed to: \" \u003C\u003C state;\n\n        if (state == \"DrivingMode\") {\n            EnableDrivingFunctions();\n        } else if (state == \"ParkingMode\") {\n            EnableParkingFunctions();\n        } else if (state == \"ChargingMode\") {\n            EnableChargingFunctions();\n        }\n    }\n\n    void EnableDrivingFunctions() {\n        \u002F\u002F Activate ADAS, powertrain control, etc.\n        ara::log::LogInfo() \u003C\u003C \"Driving functions enabled\";\n    }\n\n    void EnableParkingFunctions() {\n        \u002F\u002F Activate parking assist, surround view, etc.\n        ara::log::LogInfo() \u003C\u003C \"Parking functions enabled\";\n    }\n\n    void EnableChargingFunctions() {\n        \u002F\u002F Activate battery management, charging control\n        ara::log::LogInfo() \u003C\u003C \"Charging functions enabled\";\n    }\n};\n\n} \u002F\u002F namespace sm\n} \u002F\u002F namespace vehicle\n```\n\n### 5. Platform Health Management (ara::phm)\n\n**Health Monitoring Implementation:**\n```cpp\n\u002F\u002F health_monitor.cpp\n#include \u003Cara\u002Fphm\u002Frecovery_action.h>\n#include \u003Cara\u002Fphm\u002Fhealth_channel.h>\n\nnamespace platform {\nnamespace health {\n\nclass HealthMonitor {\npublic:\n    HealthMonitor() {\n        \u002F\u002F Create health channels\n        sensor_health_ = std::make_unique\u003Cara::phm::HealthChannel>(\n            ara::phm::HealthChannelId(\"SensorHealth\")\n        );\n\n        computation_health_ = std::make_unique\u003Cara::phm::HealthChannel>(\n            ara::phm::HealthChannelId(\"ComputationHealth\")\n        );\n\n        \u002F\u002F Register recovery actions\n        RegisterRecoveryActions();\n    }\n\n    void MonitorSensorHealth(const SensorData& data) {\n        if (!ValidateSensorData(data)) {\n            \u002F\u002F Report health status degraded\n            sensor_health_->ReportHealthStatus(\n                ara::phm::HealthStatus::kDegraded,\n                ara::phm::HealthStatusCause::kInvalidData\n            );\n\n            \u002F\u002F Trigger recovery action\n            recovery_action_->Invoke();\n        } else {\n            sensor_health_->ReportHealthStatus(\n                ara::phm::HealthStatus::kOk\n            );\n        }\n    }\n\n    void MonitorComputationLoad() {\n        float cpu_usage = GetCPUUsage();\n        float memory_usage = GetMemoryUsage();\n\n        if (cpu_usage > 95.0 || memory_usage > 90.0) {\n            computation_health_->ReportHealthStatus(\n                ara::phm::HealthStatus::kDegraded,\n                ara::phm::HealthStatusCause::kResourceExhaustion\n            );\n\n            \u002F\u002F Reduce processing load\n            ReduceComputationLoad();\n        }\n    }\n\nprivate:\n    std::unique_ptr\u003Cara::phm::HealthChannel> sensor_health_;\n    std::unique_ptr\u003Cara::phm::HealthChannel> computation_health_;\n    std::unique_ptr\u003Cara::phm::RecoveryAction> recovery_action_;\n\n    void RegisterRecoveryActions() {\n        recovery_action_ = std::make_unique\u003Cara::phm::RecoveryAction>(\n            ara::phm::RecoveryActionId(\"SensorRecovery\"),\n            [this]() {\n                \u002F\u002F Recovery logic: restart sensor, use fallback data, etc.\n                ara::log::LogWarn() \u003C\u003C \"Executing sensor recovery\";\n                RestartSensorInterface();\n            }\n        );\n    }\n\n    bool ValidateSensorData(const SensorData& data) {\n        return data.timestamp_valid &&\n               data.crc_valid &&\n               data.alive_counter_sequential;\n    }\n\n    void RestartSensorInterface() {\n        \u002F\u002F Sensor restart logic\n    }\n\n    void ReduceComputationLoad() {\n        \u002F\u002F Temporarily disable non-critical features\n    }\n\n    float GetCPUUsage() { return 0.0; }  \u002F\u002F Implementation\n    float GetMemoryUsage() { return 0.0; }  \u002F\u002F Implementation\n};\n\n} \u002F\u002F namespace health\n} \u002F\u002F namespace platform\n```\n\n## Use Cases\n\n1. **L3+ Autonomous Driving**: ADAS applications using ara::com for sensor fusion\n2. **OTA Updates**: ara::ucm for safe software updates with rollback\n3. **Zone Controllers**: Service-oriented communication between domain controllers\n4. **Cloud Connectivity**: ara::rest for vehicle-to-cloud data exchange\n\n## Automotive Standards\n\n- **AUTOSAR R22-11**: Latest Adaptive Platform specification\n- **ISO 26262 ASIL-D**: Safety-critical application development\n- **ISO 21434**: Cybersecurity for service communication\n- **ASPICE CL3**: Software development process compliance\n\n## Tools Required\n\n- **Vector DaVinci**: ARXML editing and code generation\n- **EB tresos AdaptiveCore**: AUTOSAR Adaptive middleware\n- **Elektrobit EB corbos**: Adaptive Platform implementation\n- **COVESA VSS**: Vehicle Signal Specification integration\n\n## Performance Metrics\n\n- **Service Discovery**: \u003C100ms to find and bind to service\n- **Event Throughput**: >10,000 events\u002Fsec via SOME\u002FIP\n- **Method Call Latency**: \u003C2ms round-trip for local services\n- **Memory Footprint**: \u003C50MB for Adaptive Platform runtime\n\n## References\n\n- AUTOSAR Adaptive Platform Release 22-11 Specification\n- \"AUTOSAR Adaptive Platform Explained\" (AUTOSAR Whitepaper)\n- ISO 26262-6:2018 Software Development Guidelines\n- COVESA Vehicle Signal Specification\n\n---\n\n**Version:** 1.0.0\n**Last Updated:** 2026-03-19\n**Author:** Automotive Claude Code Agents\n\n---\n\n## Containerization Orchestration\n\n# Containerization and Orchestration for Automotive HPC\n\n**Category:** automotive-hpc\n**Version:** 1.0.0\n**Maturity:** production\n**Complexity:** advanced\n\n## Overview\n\nComprehensive guide to container technologies and orchestration for automotive HPC platforms. Covers Docker, Podman, Kubernetes for vehicles, application lifecycle management, and OTA container updates with safety considerations.\n\n## Core Competencies\n\n### 1. Automotive Container Architecture\n\n**Why Containers in Automotive:**\n- **Rapid Updates**: Deploy new algorithms without full ECU reflash\n- **Isolation**: Separate safety-critical from non-critical workloads\n- **Portability**: Same container runs on test bench, HIL, and production vehicle\n- **Resource Control**: cgroups for CPU\u002Fmemory limits per ASIL level\n- **Versioning**: Atomic rollback for failed updates\n\n**Container vs Traditional ECU:**\n```\nTraditional ECU:               Containerized Platform:\n┌──────────────────┐          ┌─────────────────────────────┐\n│   App Binary     │          │ Container 1: ADAS (ASIL-D)  │\n│   (Monolithic)   │          │ Container 2: IVI (QM)       │\n├──────────────────┤          │ Container 3: Telematics     │\n│   AUTOSAR RTE    │          ├─────────────────────────────┤\n├──────────────────┤          │ Container Runtime (containerd)│\n│   OS (QNX\u002FLinux) │          ├─────────────────────────────┤\n│   Bare Metal     │          │ OS (Linux\u002FQNX)              │\n└──────────────────┘          └─────────────────────────────┘\nUpdate: Full flash (30min)    Update: Container only (2min)\n```\n\n### 2. Container Runtime for Automotive\n\n#### Docker for Development\n\n**Dockerfile for ADAS Application:**\n```dockerfile\n# Multi-stage build for ADAS perception pipeline\nFROM nvcr.io\u002Fnvidia\u002Fl4t-base:r35.3.1 AS builder\n\n# Install build dependencies\nRUN apt-get update && apt-get install -y \\\n    build-essential \\\n    cmake \\\n    cuda-toolkit-11-4 \\\n    libeigen3-dev \\\n    libopencv-dev \\\n    && rm -rf \u002Fvar\u002Flib\u002Fapt\u002Flists\u002F*\n\n# Build ADAS application\nWORKDIR \u002Fapp\nCOPY src\u002F \u002Fapp\u002Fsrc\u002F\nCOPY CMakeLists.txt \u002Fapp\u002F\n\nRUN mkdir build && cd build && \\\n    cmake -DCMAKE_BUILD_TYPE=Release .. && \\\n    make -j$(nproc)\n\n# Runtime stage (minimal image)\nFROM nvcr.io\u002Fnvidia\u002Fl4t-base:r35.3.1\n\n# Install runtime dependencies only\nRUN apt-get update && apt-get install -y \\\n    libopencv-core4.5d \\\n    libopencv-imgproc4.5d \\\n    cuda-cudart-11-4 \\\n    && rm -rf \u002Fvar\u002Flib\u002Fapt\u002Flists\u002F*\n\n# Copy only built artifacts\nCOPY --from=builder \u002Fapp\u002Fbuild\u002Fadas_perception \u002Fusr\u002Flocal\u002Fbin\u002F\nCOPY --from=builder \u002Fapp\u002Fmodels\u002F \u002Fopt\u002Fmodels\u002F\n\n# Non-root user for security\nRUN useradd -m -u 1000 adas && \\\n    chown -R adas:adas \u002Fopt\u002Fmodels\n\nUSER adas\n\n# CUDA device access\nENV NVIDIA_VISIBLE_DEVICES all\nENV NVIDIA_DRIVER_CAPABILITIES compute,utility\n\n# Health check\nHEALTHCHECK --interval=5s --timeout=3s --retries=3 \\\n    CMD \u002Fusr\u002Flocal\u002Fbin\u002Fadas_perception --health-check\n\nENTRYPOINT [\"\u002Fusr\u002Flocal\u002Fbin\u002Fadas_perception\"]\nCMD [\"--config\", \"\u002Fetc\u002Fadas\u002Fconfig.yaml\"]\n```\n\n**Docker Compose for Development Environment:**\n```yaml\n# docker-compose.yaml - Local ADAS development\nversion: '3.8'\n\nservices:\n  # Sensor simulation\n  sensor_sim:\n    image: autoware\u002Fsensor-simulator:latest\n    volumes:\n      - .\u002Fdata\u002Frosbag:\u002Fdata:ro\n    networks:\n      - vehicle_net\n    command: [\"--replay\", \"\u002Fdata\u002Ftest_drive.bag\"]\n\n  # ADAS perception\n  adas_perception:\n    build:\n      context: .\n      dockerfile: Dockerfile\n    runtime: nvidia\n    environment:\n      - CUDA_VISIBLE_DEVICES=0\n      - ROS_MASTER_URI=http:\u002F\u002Fsensor_sim:11311\n    volumes:\n      - .\u002Fmodels:\u002Fopt\u002Fmodels:ro\n      - .\u002Flogs:\u002Fvar\u002Flog\u002Fadas:rw\n    networks:\n      - vehicle_net\n    depends_on:\n      - sensor_sim\n    deploy:\n      resources:\n        limits:\n          cpus: '4'\n          memory: 4G\n        reservations:\n          devices:\n            - driver: nvidia\n              count: 1\n              capabilities: [gpu]\n\n  # Visualization\n  rviz:\n    image: osrf\u002Fros:noetic-desktop-full\n    environment:\n      - DISPLAY=$DISPLAY\n      - ROS_MASTER_URI=http:\u002F\u002Fsensor_sim:11311\n    volumes:\n      - \u002Ftmp\u002F.X11-unix:\u002Ftmp\u002F.X11-unix:rw\n    networks:\n      - vehicle_net\n    depends_on:\n      - adas_perception\n\nnetworks:\n  vehicle_net:\n    driver: bridge\n```\n\n#### Podman for Production (Rootless & Daemonless)\n\n**Why Podman for Automotive:**\n- **Rootless**: Better security, no privileged daemon\n- **Systemd Integration**: Native systemd unit generation\n- **OCI Compliant**: Compatible with Kubernetes\n- **No Daemon**: Reduces attack surface\n\n**Podman Container for Safety-Critical ADAS:**\n```bash\n#!\u002Fbin\u002Fbash\n# Build and run ADAS container with Podman\n\n# Build image\npodman build -t adas-perception:1.0.0 -f Dockerfile.adas .\n\n# Run with systemd integration and resource limits\npodman run -d \\\n  --name adas-safety \\\n  --security-opt label=type:adas_t \\\n  --cap-drop=ALL \\\n  --cap-add=SYS_NICE \\\n  --cpuset-cpus=4-7 \\\n  --memory=4G \\\n  --memory-swap=0 \\\n  --oom-score-adj=-1000 \\\n  --device=\u002Fdev\u002Fnvidia0 \\\n  --device=\u002Fdev\u002Fcan0 \\\n  --volume=\u002Fetc\u002Fadas\u002Fconfig.yaml:\u002Fetc\u002Fadas\u002Fconfig.yaml:ro,Z \\\n  --volume=\u002Fvar\u002Flog\u002Fadas:\u002Fvar\u002Flog\u002Fadas:rw,Z \\\n  --network=host \\\n  --restart=on-failure:3 \\\n  adas-perception:1.0.0\n\n# Generate systemd service\npodman generate systemd --new --name adas-safety \\\n  --restart-policy=always \\\n  --start-timeout=30 \\\n  --stop-timeout=10 \\\n  > \u002Fetc\u002Fsystemd\u002Fsystem\u002Fadas-safety.service\n\nsystemctl enable adas-safety.service\nsystemctl start adas-safety.service\n```\n\n### 3. Kubernetes for Automotive\n\n**Lightweight Kubernetes Distributions:**\n- **K3s**: Minimal Kubernetes (40MB binary) for edge\u002Fembedded\n- **MicroK8s**: Snap-based, fast cluster setup\n- **KubeEdge**: Extends Kubernetes to edge devices\n\n**K3s Installation on Vehicle ECU:**\n```bash\n#!\u002Fbin\u002Fbash\n# Install K3s on automotive HPC (NVIDIA Orin)\n\n# Install K3s server (control plane + worker)\ncurl -sfL https:\u002F\u002Fget.k3s.io | sh -s - \\\n  --disable traefik \\\n  --disable servicelb \\\n  --kubelet-arg=\"cpu-manager-policy=static\" \\\n  --kubelet-arg=\"topology-manager-policy=single-numa-node\" \\\n  --kubelet-arg=\"reserved-cpus=0-1\" \\\n  --kubelet-arg=\"system-reserved=cpu=2,memory=2Gi\" \\\n  --kube-apiserver-arg=\"feature-gates=CPUManager=true,TopologyManager=true\"\n\n# Install NVIDIA GPU device plugin\nkubectl apply -f https:\u002F\u002Fraw.githubusercontent.com\u002FNVIDIA\u002Fk8s-device-plugin\u002Fmain\u002Fnvidia-device-plugin.yml\n\n# Verify installation\nkubectl get nodes\nkubectl describe node $(hostname)\n```\n\n**ADAS Deployment Manifest:**\n```yaml\n# adas-deployment.yaml\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: adas-safety\n  labels:\n    asil: \"d\"\n    safety-critical: \"true\"\n\n---\n# ConfigMap for ADAS configuration\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: adas-config\n  namespace: adas-safety\ndata:\n  config.yaml: |\n    perception:\n      camera_count: 8\n      lidar_enabled: true\n      radar_count: 5\n      fusion_rate_hz: 10\n    planning:\n      algorithm: \"model_predictive_control\"\n      horizon_seconds: 5\n      safety_margin_meters: 2.0\n\n---\n# ADAS Perception Deployment\napiVersion: apps\u002Fv1\nkind: Deployment\nmetadata:\n  name: adas-perception\n  namespace: adas-safety\n  labels:\n    app: adas-perception\n    asil: \"d\"\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: adas-perception\n  template:\n    metadata:\n      labels:\n        app: adas-perception\n        asil: \"d\"\n    spec:\n      # Node affinity for HPC cores\n      affinity:\n        nodeAffinity:\n          requiredDuringSchedulingIgnoredDuringExecution:\n            nodeSelectorTerms:\n            - matchExpressions:\n              - key: node-role.kubernetes.io\u002Fhpc\n                operator: In\n                values:\n                - \"true\"\n\n      # Host networking for low-latency CAN\u002FEthernet\n      hostNetwork: true\n      dnsPolicy: ClusterFirstWithHostNet\n\n      # Security context\n      securityContext:\n        runAsNonRoot: true\n        runAsUser: 1000\n        fsGroup: 1000\n        seccompProfile:\n          type: RuntimeDefault\n\n      containers:\n      - name: perception\n        image: adas-perception:1.0.0\n        imagePullPolicy: IfNotPresent\n\n        # Resource requests\u002Flimits (guaranteed QoS)\n        resources:\n          requests:\n            cpu: \"4\"\n            memory: \"4Gi\"\n            nvidia.com\u002Fgpu: \"1\"\n          limits:\n            cpu: \"4\"\n            memory: \"4Gi\"\n            nvidia.com\u002Fgpu: \"1\"\n\n        # Environment variables\n        env:\n        - name: CUDA_VISIBLE_DEVICES\n          value: \"0\"\n        - name: OMP_NUM_THREADS\n          value: \"4\"\n\n        # Volume mounts\n        volumeMounts:\n        - name: config\n          mountPath: \u002Fetc\u002Fadas\n          readOnly: true\n        - name: models\n          mountPath: \u002Fopt\u002Fmodels\n          readOnly: true\n        - name: logs\n          mountPath: \u002Fvar\u002Flog\u002Fadas\n        - name: dev-can\n          mountPath: \u002Fdev\u002Fcan0\n\n        # Liveness probe\n        livenessProbe:\n          exec:\n            command:\n            - \u002Fusr\u002Flocal\u002Fbin\u002Fhealth-check\n            - --type=liveness\n          initialDelaySeconds: 30\n          periodSeconds: 10\n          timeoutSeconds: 5\n          failureThreshold: 3\n\n        # Readiness probe\n        readinessProbe:\n          exec:\n            command:\n            - \u002Fusr\u002Flocal\u002Fbin\u002Fhealth-check\n            - --type=readiness\n          initialDelaySeconds: 10\n          periodSeconds: 5\n          timeoutSeconds: 3\n\n        # Security capabilities\n        securityContext:\n          allowPrivilegeEscalation: false\n          capabilities:\n            drop:\n            - ALL\n            add:\n            - SYS_NICE  # For RT scheduling\n          readOnlyRootFilesystem: true\n\n      # Volumes\n      volumes:\n      - name: config\n        configMap:\n          name: adas-config\n      - name: models\n        hostPath:\n          path: \u002Fopt\u002Fadas\u002Fmodels\n          type: Directory\n      - name: logs\n        emptyDir:\n          sizeLimit: 1Gi\n      - name: dev-can\n        hostPath:\n          path: \u002Fdev\u002Fcan0\n          type: CharDevice\n\n      # Tolerations for dedicated HPC nodes\n      tolerations:\n      - key: \"hpc\"\n        operator: \"Equal\"\n        value: \"true\"\n        effect: \"NoSchedule\"\n\n      # Priority class for safety-critical workload\n      priorityClassName: safety-critical\n\n---\n# PriorityClass for ASIL-D workloads\napiVersion: scheduling.k8s.io\u002Fv1\nkind: PriorityClass\nmetadata:\n  name: safety-critical\nvalue: 1000000\nglobalDefault: false\ndescription: \"Reserved for ASIL-D safety-critical applications\"\n```\n\n### 4. OTA Container Updates\n\n**Safe OTA Update Strategy:**\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"\nAutomotive OTA Container Update Manager\nImplements A\u002FB partition scheme for safe rollback\n\"\"\"\n\nimport subprocess\nimport json\nimport hashlib\nfrom enum import Enum\nfrom dataclasses import dataclass\nfrom typing import Optional\n\nclass UpdateStatus(Enum):\n    IDLE = \"idle\"\n    DOWNLOADING = \"downloading\"\n    VALIDATING = \"validating\"\n    INSTALLING = \"installing\"\n    TESTING = \"testing\"\n    COMMITTED = \"committed\"\n    ROLLING_BACK = \"rolling_back\"\n    FAILED = \"failed\"\n\n@dataclass\nclass ContainerUpdate:\n    name: str\n    current_version: str\n    target_version: str\n    image_url: str\n    checksum_sha256: str\n    asil_level: str\n\nclass OTAUpdateManager:\n    def __init__(self):\n        self.update_partition = \"B\"  # A=active, B=update\n        self.status = UpdateStatus.IDLE\n\n    def update_container(self, update: ContainerUpdate) -> bool:\n        \"\"\"\n        Perform safe OTA container update with rollback capability\n        \"\"\"\n        try:\n            # 1. Pre-update validation\n            if not self.validate_preconditions(update):\n                return False\n\n            # 2. Download new container image\n            self.status = UpdateStatus.DOWNLOADING\n            if not self.download_image(update):\n                return False\n\n            # 3. Validate checksum\n            self.status = UpdateStatus.VALIDATING\n            if not self.verify_checksum(update):\n                return False\n\n            # 4. Install to inactive partition\n            self.status = UpdateStatus.INSTALLING\n            if not self.install_to_partition(update, self.update_partition):\n                return False\n\n            # 5. Test new version (smoke test)\n            self.status = UpdateStatus.TESTING\n            if not self.smoke_test(update):\n                self.rollback(update)\n                return False\n\n            # 6. Commit update (switch active partition)\n            self.status = UpdateStatus.COMMITTED\n            self.commit_update(update)\n\n            # 7. Monitor for stability (2 minutes)\n            if not self.monitor_stability(update, duration_sec=120):\n                self.rollback(update)\n                return False\n\n            self.status = UpdateStatus.IDLE\n            return True\n\n        except Exception as e:\n            self.status = UpdateStatus.FAILED\n            print(f\"Update failed: {e}\")\n            self.rollback(update)\n            return False\n\n    def validate_preconditions(self, update: ContainerUpdate) -> bool:\n        \"\"\"Check vehicle state before update\"\"\"\n        # Don't update while driving\n        vehicle_speed = self.get_vehicle_speed()\n        if vehicle_speed > 0:\n            print(\"Update blocked: Vehicle in motion\")\n            return False\n\n        # Check battery SOC (>20% for safety)\n        if self.get_battery_soc() \u003C 20.0:\n            print(\"Update blocked: Low battery\")\n            return False\n\n        # Verify parking brake engaged\n        if not self.is_parking_brake_engaged():\n            print(\"Update blocked: Parking brake not engaged\")\n            return False\n\n        return True\n\n    def download_image(self, update: ContainerUpdate) -> bool:\n        \"\"\"Download container image from OTA server\"\"\"\n        print(f\"Downloading {update.name}:{update.target_version}\")\n\n        result = subprocess.run([\n            'podman', 'pull',\n            f'{update.image_url}:{update.target_version}'\n        ], capture_output=True, text=True)\n\n        return result.returncode == 0\n\n    def verify_checksum(self, update: ContainerUpdate) -> bool:\n        \"\"\"Verify image integrity\"\"\"\n        result = subprocess.run([\n            'podman', 'image', 'inspect',\n            f'{update.image_url}:{update.target_version}',\n            '--format', '{{.Id}}'\n        ], capture_output=True, text=True)\n\n        image_id = result.stdout.strip()\n        # Extract SHA256 from image ID (sha256:abc123...)\n        actual_checksum = image_id.split(':')[1][:64]\n\n        if actual_checksum != update.checksum_sha256:\n            print(f\"Checksum mismatch: {actual_checksum} != {update.checksum_sha256}\")\n            return False\n\n        return True\n\n    def install_to_partition(self, update: ContainerUpdate, partition: str) -> bool:\n        \"\"\"Install container to inactive partition\"\"\"\n        # Tag image for specific partition\n        subprocess.run([\n            'podman', 'tag',\n            f'{update.image_url}:{update.target_version}',\n            f'{update.name}:partition-{partition}'\n        ])\n\n        # Create new container (don't start yet)\n        result = subprocess.run([\n            'podman', 'create',\n            '--name', f'{update.name}-{partition}',\n            '--cpuset-cpus', '4-7',\n            '--memory', '4G',\n            f'{update.name}:partition-{partition}'\n        ], capture_output=True, text=True)\n\n        return result.returncode == 0\n\n    def smoke_test(self, update: ContainerUpdate) -> bool:\n        \"\"\"Start container and verify basic functionality\"\"\"\n        container_name = f'{update.name}-{self.update_partition}'\n\n        # Start container\n        subprocess.run(['podman', 'start', container_name])\n\n        # Wait for container to be ready\n        import time\n        time.sleep(5)\n\n        # Check health endpoint\n        result = subprocess.run([\n            'podman', 'exec', container_name,\n            '\u002Fusr\u002Flocal\u002Fbin\u002Fhealth-check'\n        ], capture_output=True)\n\n        if result.returncode != 0:\n            print(\"Smoke test failed: Health check returned error\")\n            subprocess.run(['podman', 'stop', container_name])\n            return False\n\n        # For ASIL-D: Run extended validation\n        if update.asil_level == \"D\":\n            if not self.asil_d_validation(container_name):\n                subprocess.run(['podman', 'stop', container_name])\n                return False\n\n        return True\n\n    def commit_update(self, update: ContainerUpdate):\n        \"\"\"Switch active partition\"\"\"\n        old_container = f'{update.name}-A'\n        new_container = f'{update.name}-{self.update_partition}'\n\n        # Stop old version\n        subprocess.run(['podman', 'stop', old_container])\n\n        # Rename containers (swap partitions)\n        subprocess.run(['podman', 'rename', old_container, f'{update.name}-OLD'])\n        subprocess.run(['podman', 'rename', new_container, old_container])\n\n        # Update systemd service to point to new container\n        subprocess.run(['systemctl', 'restart', f'{update.name}.service'])\n\n    def monitor_stability(self, update: ContainerUpdate, duration_sec: int) -> bool:\n        \"\"\"Monitor container for crashes\u002Ferrors after update\"\"\"\n        import time\n        container_name = f'{update.name}-A'\n\n        start_time = time.time()\n        while time.time() - start_time \u003C duration_sec:\n            # Check if container is still running\n            result = subprocess.run([\n                'podman', 'inspect',\n                '--format', '{{.State.Running}}',\n                container_name\n            ], capture_output=True, text=True)\n\n            if result.stdout.strip() != 'true':\n                print(\"Container crashed during stability monitoring\")\n                return False\n\n            # Check error logs\n            result = subprocess.run([\n                'podman', 'logs', '--tail', '10', container_name\n            ], capture_output=True, text=True)\n\n            if 'FATAL' in result.stdout or 'CRITICAL' in result.stdout:\n                print(\"Critical errors detected in logs\")\n                return False\n\n            time.sleep(10)\n\n        return True\n\n    def rollback(self, update: ContainerUpdate):\n        \"\"\"Rollback to previous version\"\"\"\n        self.status = UpdateStatus.ROLLING_BACK\n        print(f\"Rolling back {update.name} to {update.current_version}\")\n\n        new_container = f'{update.name}-A'\n        old_container = f'{update.name}-OLD'\n\n        # Stop failed new version\n        subprocess.run(['podman', 'stop', new_container])\n\n        # Restore old version\n        subprocess.run(['podman', 'rename', new_container, f'{update.name}-FAILED'])\n        subprocess.run(['podman', 'rename', old_container, new_container])\n        subprocess.run(['podman', 'start', new_container])\n\n        # Restore systemd service\n        subprocess.run(['systemctl', 'restart', f'{update.name}.service'])\n\n    def asil_d_validation(self, container_name: str) -> bool:\n        \"\"\"Extended validation for ASIL-D containers\"\"\"\n        # Run safety test suite\n        result = subprocess.run([\n            'podman', 'exec', container_name,\n            '\u002Fusr\u002Flocal\u002Fbin\u002Fsafety-test-suite'\n        ], capture_output=True)\n\n        return result.returncode == 0\n\n    # Mock functions for vehicle state\n    def get_vehicle_speed(self) -> float:\n        return 0.0  # km\u002Fh\n\n    def get_battery_soc(self) -> float:\n        return 80.0  # %\n\n    def is_parking_brake_engaged(self) -> bool:\n        return True\n\n# Example usage\nif __name__ == '__main__':\n    manager = OTAUpdateManager()\n\n    update = ContainerUpdate(\n        name='adas-perception',\n        current_version='1.0.0',\n        target_version='1.1.0',\n        image_url='registry.oem.com\u002Fadas-perception',\n        checksum_sha256='abc123def456...',\n        asil_level='D'\n    )\n\n    success = manager.update_container(update)\n    print(f\"Update {'successful' if success else 'failed'}\")\n```\n\n### 5. Container Resource Management\n\n**CPU and Memory Isolation:**\n```yaml\n# cgroup v2 configuration for container resource limits\n# \u002Fsys\u002Ffs\u002Fcgroup\u002Fadas-perception.slice\u002Fcpu.max\n# Format: $MAX $PERIOD (microseconds)\n400000 100000  # 4 CPUs worth (4 * 100ms = 400ms per 100ms period)\n\n# \u002Fsys\u002Ffs\u002Fcgroup\u002Fadas-perception.slice\u002Fmemory.max\n4294967296  # 4 GB\n\n# \u002Fsys\u002Ffs\u002Fcgroup\u002Fadas-perception.slice\u002Fmemory.swap.max\n0  # No swap for safety-critical\n\n# \u002Fsys\u002Ffs\u002Fcgroup\u002Fadas-perception.slice\u002Fcpuset.cpus\n4-7  # Pin to CPU cores 4-7\n\n# \u002Fsys\u002Ffs\u002Fcgroup\u002Fadas-perception.slice\u002Fcpuset.mems\n0  # NUMA node 0\n```\n\n## Use Cases\n\n1. **Modular ADAS Updates**: Update perception algorithm without touching planning\u002Fcontrol\n2. **A\u002FB Testing**: Run two algorithm versions side-by-side for validation\n3. **Multi-Tenant ECU**: IVI, telematics, and ADAS on single HPC with isolation\n4. **CI\u002FCD Integration**: Automated testing and deployment pipeline\n\n## Automotive Standards\n\n- **ISO 26262**: Container isolation for FFI compliance\n- **ISO 21434**: Secure container registry and image signing\n- **ASPICE CL3**: Container lifecycle management process\n\n## Tools Required\n\n- **Docker\u002FPodman**: Container runtime\n- **K3s\u002FMicroK8s**: Lightweight Kubernetes\n- **Helm**: Kubernetes package manager\n- **Harbor**: Container registry with security scanning\n- **Notary**: Container image signing (TUF framework)\n\n## Performance Metrics\n\n- **Container Startup**: \u003C2s for ADAS application\n- **Overhead**: \u003C2% CPU, \u003C50MB memory for runtime\n- **Update Time**: \u003C5min for full container replacement\n- **Rollback Time**: \u003C30s to previous version\n\n## References\n\n- CNCF Automotive Edge Computing Whitepaper\n- AGL (Automotive Grade Linux) Container Guidelines\n- Kubernetes for Edge Computing (K3s documentation)\n- \"Containers in Safety-Critical Systems\" (SAE Paper)\n\n---\n\n**Version:** 1.0.0\n**Last Updated:** 2026-03-19\n**Author:** Automotive Claude Code Agents\n\n---\n\n## Hypervisor Virtualization\n\n# Hypervisor Virtualization for Automotive HPC\n\n**Category:** automotive-hpc\n**Version:** 1.0.0\n**Maturity:** production\n**Complexity:** advanced\n\n## Overview\n\nExpert knowledge in automotive hypervisor technologies for High-Performance Computing platforms. Covers QNX Hypervisor, ACRN, Xen, and other automotive-grade virtualization solutions for mixed-criticality systems, safety partitioning, and resource management.\n\n## Core Competencies\n\n### 1. Automotive Hypervisor Technologies\n\n#### QNX Hypervisor 2.2\n- Type 1 bare-metal hypervisor for safety-critical systems\n- ASIL-D certified for ISO 26262 compliance\n- Microkernel architecture with minimal TCB (Trusted Computing Base)\n- Hardware virtualization using ARM VE or Intel VT-x\u002FVT-d\n- Real-time guarantee preservation across VMs\n\n**QNX Hypervisor Configuration Example:**\n```xml\n\u003C?xml version=\"1.0\"?>\n\u003Csystem>\n    \u003Chypervisor>\n        \u003Cname>qnx-hypervisor\u003C\u002Fname>\n        \u003Cversion>2.2\u003C\u002Fversion>\n        \u003Cscheduler type=\"partition\">\n            \u003Cmajor_frame>10ms\u003C\u002Fmajor_frame>\n        \u003C\u002Fscheduler>\n    \u003C\u002Fhypervisor>\n\n    \u003C!-- ASIL-D Safety VM for ADAS -->\n    \u003Cguest id=\"0\" name=\"safety-vm\" asil=\"D\">\n        \u003Cos>qnx-710\u003C\u002Fos>\n        \u003Cvcpus>2\u003C\u002Fvcpus>\n        \u003Cmemory>2GB\u003C\u002Fmemory>\n        \u003Csafety_partition>\n            \u003Cinterference_freedom>guaranteed\u003C\u002Finterference_freedom>\n            \u003Cwatchdog>enabled\u003C\u002Fwatchdog>\n            \u003Cmemory_protection>mpu\u003C\u002Fmemory_protection>\n        \u003C\u002Fsafety_partition>\n        \u003Cschedule>\n            \u003Cpartition_window>6ms\u003C\u002Fpartition_window>\n            \u003Cpriority>255\u003C\u002Fpriority>\n        \u003C\u002Fschedule>\n        \u003Cdevices>\n            \u003Cpci bus=\"0\" dev=\"2\" func=\"0\" \u002F> \u003C!-- CAN controller -->\n            \u003Cinterrupt line=\"45\" \u002F>\n        \u003C\u002Fdevices>\n    \u003C\u002Fguest>\n\n    \u003C!-- QM Non-Safety VM for Infotainment -->\n    \u003Cguest id=\"1\" name=\"infotainment-vm\" asil=\"QM\">\n        \u003Cos>android-automotive-13\u003C\u002Fos>\n        \u003Cvcpus>4\u003C\u002Fvcpus>\n        \u003Cmemory>4GB\u003C\u002Fmemory>\n        \u003Cschedule>\n            \u003Cpartition_window>4ms\u003C\u002Fpartition_window>\n            \u003Cpriority>128\u003C\u002Fpriority>\n        \u003C\u002Fschedule>\n        \u003Cgpu>\n            \u003Cpassthrough device=\"\u002Fdev\u002Fgpu0\" \u002F>\n            \u003Csriov vf=\"1\" \u002F>\n        \u003C\u002Fgpu>\n    \u003C\u002Fguest>\n\u003C\u002Fsystem>\n```\n\n#### ACRN Hypervisor (Intel)\n- Open-source Type 1 hypervisor optimized for IoT and automotive\n- Safety VM (Service VM) + User VMs architecture\n- Device Model for I\u002FO virtualization\n- ACRN-DM (Device Model) for para-virtualized devices\n- Real-time VM support for safety workloads\n\n**ACRN Launch Configuration:**\n```python\n# ACRN VM Launch Script - Safety VM\nimport sys\nimport acrn_vm\n\n# Safety VM Configuration (ASIL-D)\nsafety_vm = acrn_vm.VM({\n    'name': 'RTLinux-Safety',\n    'vcpu_num': 2,\n    'memory_size': '2G',\n    'vm_type': 'RTVM',  # Real-time VM\n    'lapic_passthrough': True,\n    'ivshmem_regions': [\n        {\n            'name': 'sensor-data-region',\n            'size': '64M',\n            'shared_with': ['adas-vm', 'gateway-vm']\n        }\n    ],\n    'cpu_affinity': [0, 1],  # Pin to cores 0-1\n    'vpci_devices': [\n        {'bus': 0, 'dev': 2, 'func': 0, 'type': 'CAN'}\n    ],\n    'boot_args': 'root=\u002Fdev\u002Fsda1 rw console=ttyS0 isolcpus=0,1'\n})\n\n# Configure virtio devices\nsafety_vm.add_virtio_net(\n    tap_device='tap0',\n    mac='52:54:00:12:34:56'\n)\n\nsafety_vm.add_virtio_blk(\n    image_path='\u002Fvar\u002Fvms\u002Fsafety-rootfs.img'\n)\n\n# Launch VM with real-time priority\nsafety_vm.launch(priority='rt', policy='FIFO')\n```\n\n#### Xen Hypervisor (ARM\u002Fx86)\n- Type 1 hypervisor with strong isolation\n- Dom0 (privileged domain) for device drivers\n- DomU (unprivileged domains) for guest VMs\n- PV (paravirtualization) and HVM (hardware virtual machine) modes\n- IOMMU support for device assignment\n\n**Xen VM Configuration (xl toolstack):**\n```python\n# Xen DomU Configuration - ADAS Processing VM\nname = \"adas-processing\"\ntype = \"hvm\"\nmemory = 4096\nvcpus = 4\ncpus = \"4-7\"  # Pin to cores 4-7\n\n# Boot configuration\nkernel = \"\u002Fboot\u002Fvmlinuz-rt\"\nramdisk = \"\u002Fboot\u002Finitrd.img-rt\"\nextra = \"root=\u002Fdev\u002Fxvda1 console=hvc0 isolcpus=4-7\"\n\n# Virtual devices\ndisk = [\n    'phy:\u002Fdev\u002Fvg_vms\u002Fadas-root,xvda1,w',\n    'file:\u002Fvar\u002Fvms\u002Fadas-data.img,xvdb,w'\n]\n\nvif = ['bridge=xenbr0,mac=00:16:3e:12:34:56']\n\n# PCI passthrough for GPU\npci = ['0000:01:00.0']  # NVIDIA GPU\n\n# IOMMU settings\niommu = 1\npermissive = 0\n\n# Virtual framebuffer for display\nvfb = ['vnc=1,vnclisten=0.0.0.0']\n\n# Security settings\non_poweroff = 'destroy'\non_reboot = 'restart'\non_crash = 'coredump-restart'\n```\n\n### 2. Mixed-Criticality System Design\n\n**ASIL Decomposition and Isolation:**\n```cpp\n\u002F\u002F C++14 - Safety Partition Manager\n#include \u003Chypervisor\u002Fpartition.h>\n#include \u003Csafety\u002Fasil.h>\n\nnamespace automotive {\nnamespace hpc {\n\nclass SafetyPartitionManager {\npublic:\n    struct PartitionConfig {\n        std::string name;\n        ASIL asil_level;\n        uint64_t memory_base;\n        uint64_t memory_size;\n        std::vector\u003Cuint32_t> cpu_affinity;\n        uint32_t time_slice_us;\n        bool interference_free;\n    };\n\n    SafetyPartitionManager() : major_frame_us_(10000) {}\n\n    \u002F\u002F Create isolated partition for specific ASIL level\n    bool CreatePartition(const PartitionConfig& config) {\n        \u002F\u002F Validate ASIL requirements\n        if (config.asil_level >= ASIL::D) {\n            if (!ValidateFFI(config)) {\n                LOG_ERROR(\"FFI validation failed for ASIL-D partition\");\n                return false;\n            }\n        }\n\n        \u002F\u002F Configure MPU\u002FMMU for memory isolation\n        if (!ConfigureMemoryProtection(config)) {\n            return false;\n        }\n\n        \u002F\u002F Setup temporal isolation (time partitioning)\n        if (!ConfigureTimeSlice(config)) {\n            return false;\n        }\n\n        \u002F\u002F Register partition\n        partitions_.push_back(config);\n        return true;\n    }\n\n    \u002F\u002F Freedom From Interference validation\n    bool ValidateFFI(const PartitionConfig& config) {\n        \u002F\u002F Check memory interference\n        for (const auto& existing : partitions_) {\n            if (MemoryOverlap(config, existing)) {\n                return false;\n            }\n        }\n\n        \u002F\u002F Check CPU affinity conflicts\n        for (const auto& existing : partitions_) {\n            if (CPUAffinityConflict(config, existing)) {\n                return false;\n            }\n        }\n\n        \u002F\u002F Validate time budget doesn't exceed major frame\n        uint64_t total_time = 0;\n        for (const auto& p : partitions_) {\n            total_time += p.time_slice_us;\n        }\n        if (total_time + config.time_slice_us > major_frame_us_) {\n            return false;\n        }\n\n        return true;\n    }\n\nprivate:\n    std::vector\u003CPartitionConfig> partitions_;\n    uint64_t major_frame_us_;\n\n    bool ConfigureMemoryProtection(const PartitionConfig& config) {\n        \u002F\u002F Setup MPU regions for ARM or EPT for x86\n        return hypervisor_api::SetMemoryRegion(\n            config.memory_base,\n            config.memory_size,\n            MPU_ATTR_NO_ACCESS_FROM_OTHER_PARTITIONS\n        );\n    }\n\n    bool ConfigureTimeSlice(const PartitionConfig& config) {\n        return hypervisor_api::SetPartitionSchedule(\n            config.name,\n            config.time_slice_us,\n            major_frame_us_,\n            SCHEDULE_POLICY_STRICT_PARTITION\n        );\n    }\n\n    bool MemoryOverlap(const PartitionConfig& a, const PartitionConfig& b) {\n        uint64_t a_end = a.memory_base + a.memory_size;\n        uint64_t b_end = b.memory_base + b.memory_size;\n        return !(a_end \u003C= b.memory_base || b_end \u003C= a.memory_base);\n    }\n\n    bool CPUAffinityConflict(const PartitionConfig& a, const PartitionConfig& b) {\n        for (auto cpu_a : a.cpu_affinity) {\n            for (auto cpu_b : b.cpu_affinity) {\n                if (cpu_a == cpu_b && a.asil_level >= ASIL::C && b.asil_level >= ASIL::C) {\n                    return true;  \u002F\u002F ASIL-C\u002FD partitions cannot share CPUs\n                }\n            }\n        }\n        return false;\n    }\n};\n\n} \u002F\u002F namespace hpc\n} \u002F\u002F namespace automotive\n```\n\n### 3. Inter-VM Communication\n\n**IVSHMEM (Inter-VM Shared Memory):**\n```cpp\n\u002F\u002F High-performance zero-copy IPC using shared memory\n#include \u003Civshmem\u002Fshared_region.h>\n#include \u003Catomic>\n#include \u003Ccstring>\n\nnamespace automotive {\nnamespace ipc {\n\n\u002F\u002F Lock-free ring buffer for inter-VM sensor data\ntemplate\u003Ctypename T, size_t Capacity>\nclass IVSHMEMRingBuffer {\npublic:\n    explicit IVSHMEMRingBuffer(void* shmem_base)\n        : region_(static_cast\u003CSharedRegion*>(shmem_base)) {\n        region_->write_idx.store(0, std::memory_order_release);\n        region_->read_idx.store(0, std::memory_order_release);\n    }\n\n    \u002F\u002F Producer: Write sensor data (from sensor VM to ADAS VM)\n    bool Push(const T& item) {\n        size_t current_write = region_->write_idx.load(std::memory_order_relaxed);\n        size_t next_write = (current_write + 1) % Capacity;\n\n        if (next_write == region_->read_idx.load(std::memory_order_acquire)) {\n            return false;  \u002F\u002F Buffer full\n        }\n\n        std::memcpy(&region_->buffer[current_write], &item, sizeof(T));\n        region_->write_idx.store(next_write, std::memory_order_release);\n\n        \u002F\u002F Signal consumer VM via doorbell interrupt\n        SignalDoorbell();\n        return true;\n    }\n\n    \u002F\u002F Consumer: Read sensor data\n    bool Pop(T& item) {\n        size_t current_read = region_->read_idx.load(std::memory_order_relaxed);\n\n        if (current_read == region_->write_idx.load(std::memory_order_acquire)) {\n            return false;  \u002F\u002F Buffer empty\n        }\n\n        std::memcpy(&item, &region_->buffer[current_read], sizeof(T));\n        size_t next_read = (current_read + 1) % Capacity;\n        region_->read_idx.store(next_read, std::memory_order_release);\n        return true;\n    }\n\nprivate:\n    struct SharedRegion {\n        std::atomic\u003Csize_t> write_idx;\n        std::atomic\u003Csize_t> read_idx;\n        alignas(64) T buffer[Capacity];\n    };\n\n    SharedRegion* region_;\n\n    void SignalDoorbell() {\n        \u002F\u002F Write to doorbell register to trigger interrupt in consumer VM\n        volatile uint32_t* doorbell = reinterpret_cast\u003Cuint32_t*>(0xFEDC0000);\n        *doorbell = 1;\n    }\n};\n\n\u002F\u002F Usage example: Camera frame sharing\nstruct CameraFrame {\n    uint64_t timestamp_us;\n    uint32_t frame_id;\n    uint32_t width;\n    uint32_t height;\n    uint8_t data[1920 * 1080 * 3];  \u002F\u002F RGB888\n};\n\n\u002F\u002F In Sensor VM (producer)\nvoid SensorVMMain() {\n    void* shmem = MapIVSHMEM(\"\u002Fdev\u002Fivshmem0\", 128 * 1024 * 1024);\n    IVSHMEMRingBuffer\u003CCameraFrame, 4> frame_queue(shmem);\n\n    while (true) {\n        CameraFrame frame = CaptureCamera();\n        if (!frame_queue.Push(frame)) {\n            LOG_WARN(\"Frame queue full, dropping frame\");\n        }\n    }\n}\n\n\u002F\u002F In ADAS VM (consumer)\nvoid ADASVMMain() {\n    void* shmem = MapIVSHMEM(\"\u002Fdev\u002Fivshmem0\", 128 * 1024 * 1024);\n    IVSHMEMRingBuffer\u003CCameraFrame, 4> frame_queue(shmem);\n\n    CameraFrame frame;\n    while (true) {\n        if (frame_queue.Pop(frame)) {\n            ProcessFrameForObjectDetection(frame);\n        }\n    }\n}\n\n} \u002F\u002F namespace ipc\n} \u002F\u002F namespace automotive\n```\n\n### 4. Resource Management and Scheduling\n\n**CPU Partitioning and Real-Time Scheduling:**\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"\nHPC Platform Resource Manager\nManages CPU, memory, and I\u002FO bandwidth across VMs\n\"\"\"\n\nimport yaml\nfrom dataclasses import dataclass\nfrom typing import List, Dict\nfrom enum import Enum\n\nclass VMType(Enum):\n    SAFETY_CRITICAL = \"safety_critical\"  # ASIL-C\u002FD\n    PERFORMANCE = \"performance\"          # ADAS, autonomous\n    GENERAL_PURPOSE = \"general_purpose\"  # Infotainment, telematics\n\n@dataclass\nclass CPUAllocation:\n    vm_name: str\n    physical_cores: List[int]\n    vcpu_count: int\n    scheduler: str  # 'rt-fifo', 'rt-rr', 'cfs'\n    priority: int\n    cpu_quota_percent: float\n\n@dataclass\nclass MemoryAllocation:\n    vm_name: str\n    size_gb: float\n    numa_node: int\n    hugepages: bool\n    swap_disabled: bool\n\nclass HPCResourceManager:\n    def __init__(self, platform_config: str):\n        with open(platform_config, 'r') as f:\n            self.config = yaml.safe_load(f)\n\n        self.total_cores = self.config['platform']['cpu_cores']\n        self.total_memory_gb = self.config['platform']['memory_gb']\n        self.allocations: Dict[str, Dict] = {}\n\n    def allocate_vm_resources(self, vm_name: str, vm_type: VMType,\n                             cpu_cores: int, memory_gb: float):\n        \"\"\"Allocate resources following ASIL requirements\"\"\"\n\n        if vm_type == VMType.SAFETY_CRITICAL:\n            # ASIL-C\u002FD VMs get dedicated cores\n            cpu_alloc = self._allocate_dedicated_cores(vm_name, cpu_cores)\n            mem_alloc = self._allocate_locked_memory(vm_name, memory_gb)\n        elif vm_type == VMType.PERFORMANCE:\n            # Performance VMs get isolated cores with high priority\n            cpu_alloc = self._allocate_isolated_cores(vm_name, cpu_cores)\n            mem_alloc = self._allocate_hugepages_memory(vm_name, memory_gb)\n        else:\n            # General purpose VMs share remaining cores\n            cpu_alloc = self._allocate_shared_cores(vm_name, cpu_cores)\n            mem_alloc = self._allocate_standard_memory(vm_name, memory_gb)\n\n        self.allocations[vm_name] = {\n            'type': vm_type,\n            'cpu': cpu_alloc,\n            'memory': mem_alloc\n        }\n\n        return cpu_alloc, mem_alloc\n\n    def _allocate_dedicated_cores(self, vm_name: str, count: int) -> CPUAllocation:\n        \"\"\"Dedicated cores for safety-critical VMs (ASIL-D)\"\"\"\n        # Allocate from first available cores\n        available = self._find_available_cores(count, dedicated=True)\n\n        return CPUAllocation(\n            vm_name=vm_name,\n            physical_cores=available,\n            vcpu_count=count,\n            scheduler='rt-fifo',\n            priority=99,  # Highest RT priority\n            cpu_quota_percent=100.0\n        )\n\n    def _allocate_isolated_cores(self, vm_name: str, count: int) -> CPUAllocation:\n        \"\"\"Isolated cores for performance VMs (ADAS)\"\"\"\n        available = self._find_available_cores(count, dedicated=False)\n\n        return CPUAllocation(\n            vm_name=vm_name,\n            physical_cores=available,\n            vcpu_count=count,\n            scheduler='rt-rr',\n            priority=50,\n            cpu_quota_percent=90.0\n        )\n\n    def _allocate_locked_memory(self, vm_name: str, size_gb: float) -> MemoryAllocation:\n        \"\"\"Locked, non-swappable memory for safety VMs\"\"\"\n        return MemoryAllocation(\n            vm_name=vm_name,\n            size_gb=size_gb,\n            numa_node=0,\n            hugepages=True,\n            swap_disabled=True\n        )\n\n    def generate_systemd_config(self, vm_name: str) -> str:\n        \"\"\"Generate systemd unit file with resource limits\"\"\"\n        alloc = self.allocations[vm_name]\n        cpu = alloc['cpu']\n        mem = alloc['memory']\n\n        cores_list = ','.join(map(str, cpu.physical_cores))\n\n        config = f\"\"\"\n[Unit]\nDescription={vm_name} Virtual Machine\nAfter=hypervisor.service\n\n[Service]\nType=simple\nExecStart=\u002Fusr\u002Fbin\u002Fqemu-system-x86_64 \\\\\n    -name {vm_name} \\\\\n    -cpu host \\\\\n    -smp {cpu.vcpu_count} \\\\\n    -m {int(mem.size_gb * 1024)}M \\\\\n    -mem-path \u002Fdev\u002Fhugepages \\\\\n    -mem-prealloc \\\\\n    -rtc base=utc,clock=host \\\\\n    -drive file=\u002Fvar\u002Fvms\u002F{vm_name}.qcow2,if=virtio \\\\\n    -netdev tap,id=net0,ifname=tap-{vm_name},script=no \\\\\n    -device virtio-net-pci,netdev=net0\n\n# CPU affinity\nCPUAffinity={cores_list}\n\n# CPU quota ({cpu.cpu_quota_percent}% of allocated cores)\nCPUQuota={cpu.cpu_quota_percent * cpu.vcpu_count}%\n\n# Memory limits\nMemoryLimit={int(mem.size_gb * 1024)}M\nMemorySwapMax=0\n\n# Real-time scheduling (if safety critical)\n{\"CPUSchedulingPolicy=fifo\" if cpu.scheduler == 'rt-fifo' else \"\"}\n{\"CPUSchedulingPriority=\" + str(cpu.priority) if cpu.scheduler.startswith('rt-') else \"\"}\n\n# Security\nPrivateTmp=yes\nNoNewPrivileges=yes\n\n[Install]\nWantedBy=multi-user.target\n\"\"\"\n        return config\n\n# Example usage\nif __name__ == '__main__':\n    manager = HPCResourceManager('platform_config.yaml')\n\n    # Allocate ASIL-D ADAS VM\n    cpu, mem = manager.allocate_vm_resources(\n        'adas-safety',\n        VMType.SAFETY_CRITICAL,\n        cpu_cores=4,\n        memory_gb=8.0\n    )\n\n    # Generate systemd service\n    config = manager.generate_systemd_config('adas-safety')\n    with open('\u002Fetc\u002Fsystemd\u002Fsystem\u002Fvm-adas-safety.service', 'w') as f:\n        f.write(config)\n\n    print(f\"Allocated cores {cpu.physical_cores} to ADAS VM\")\n    print(f\"Memory: {mem.size_gb}GB, NUMA node: {mem.numa_node}\")\n```\n\n## Use Cases\n\n1. **Centralized ADAS Platform**: Run L3+ autonomous driving workloads in safety VMs alongside infotainment in QM VMs\n2. **Gateway ECU Consolidation**: Combine multiple network domains (CAN, Ethernet, FlexRay) in isolated VMs\n3. **Cockpit Domain Controller**: Instrument cluster, HMI, and Android Automotive on single SoC with GPU sharing\n4. **OTA Update Isolation**: Separate update VM from running system for fail-safe updates\n\n## Automotive Standards\n\n- **ISO 26262**: ASIL-D certification for hypervisor TCB\n- **ISO 21434**: Cybersecurity isolation between VMs\n- **ASPICE CL3**: Process compliance for hypervisor development\n- **AUTOSAR Adaptive**: Ara::exec for VM lifecycle management\n\n## Tools Required\n\n- **QNX Momentics IDE**: For QNX Hypervisor development\n- **ACRN Configuration Tool**: Web-based hypervisor configurator\n- **Xen Orchestra**: Management interface for Xen\n- **libvirt\u002Fvirsh**: VM lifecycle management\n- **perf\u002Fftrace**: Performance profiling and latency analysis\n\n## Constraints\n\n- **Real-time Latency**: \u003C100µs interrupt latency for ASIL-D VMs\n- **Memory Overhead**: \u003C5% hypervisor overhead\n- **FFI Guarantees**: ISO 26262 Part 6 clause 7 compliance\n- **Deterministic Scheduling**: WCET guarantees for safety partitions\n\n## Performance Metrics\n\n- **VM Boot Time**: \u003C500ms for safety VM cold boot\n- **Context Switch**: \u003C5µs VM-to-VM switch\n- **Shared Memory Throughput**: >10GB\u002Fs IVSHMEM bandwidth\n- **Interrupt Delivery**: \u003C20µs doorbell latency\n\n## References\n\n- QNX Hypervisor 2.2 User Guide\n- ACRN Hypervisor Documentation (projectacrn.org)\n- Xen ARM Virtualization Extensions\n- ISO 26262-6:2018 Clause 7 (Freedom from Interference)\n- \"Mixed-Criticality Systems on Multi-core\" (WATERS 2019)\n\n---\n\n**Version:** 1.0.0\n**Last Updated:** 2026-03-19\n**Author:** Automotive Claude Code Agents\n\n---\n\n## Safety Certification Hpc\n\n# Safety Certification for Automotive HPC Platforms\n\n**Category:** automotive-hpc\n**Version:** 1.0.0\n**Maturity:** production\n**Complexity:** advanced\n\n## Overview\n\nComprehensive guide to ISO 26262 safety certification for High-Performance Computing platforms. Covers ASIL-D partitioning, Freedom from Interference (FFI), safety mechanisms, certification strategies, and evidence documentation.\n\n## Core Competencies\n\n### 1. ISO 26262 for HPC Platforms\n\n**ISO 26262 Part 6 - Software Development:**\n- **Clause 7**: Freedom From Interference\n- **Clause 8**: Software Unit Design and Implementation\n- **Clause 9**: Software Unit Testing\n- **Clause 10**: Software Integration and Testing\n\n**ASIL Decomposition on HPC:**\n```\nSingle HPC SoC replacing multiple ECUs:\n┌─────────────────────────────────────────────┐\n│        NVIDIA DRIVE Orin \u002F Snapdragon       │\n├─────────────────────────────────────────────┤\n│ Partition 1: ADAS (ASIL-D)                  │\n│ - Decomposed to: ASIL-B(B) + ASIL-B(B)     │\n│ - Dual-core lockstep execution              │\n│ - E2E protection for inter-core comm        │\n├─────────────────────────────────────────────┤\n│ Partition 2: Instrument Cluster (ASIL-A)   │\n│ - Warning lamps, speedometer                │\n│ - Independent from ADAS partition           │\n├─────────────────────────────────────────────┤\n│ Partition 3: Infotainment (QM)              │\n│ - No safety requirements                    │\n│ - Resource limits enforced by hypervisor    │\n└─────────────────────────────────────────────┘\n```\n\n### 2. ASIL-D Partitioning Strategy\n\n**Hardware Partitioning:**\n```cpp\n\u002F\u002F HPC Safety Partition Configuration\n#include \u003Ciso26262\u002Fpartition_manager.h>\n#include \u003Ciso26262\u002Fffi_validator.h>\n\nnamespace safety {\nnamespace hpc {\n\nenum class ASILLevel {\n    QM,   \u002F\u002F Quality Management\n    A,    \u002F\u002F Lowest ASIL\n    B,\n    C,\n    D     \u002F\u002F Highest ASIL\n};\n\nstruct SafetyPartition {\n    std::string name;\n    ASILLevel asil;\n    std::vector\u003Cuint32_t> cpu_cores;\n    uint64_t memory_base;\n    uint64_t memory_size;\n    std::vector\u003Cuint32_t> allowed_interrupts;\n    bool mpu_enabled;\n    bool ecc_enabled;\n    bool lockstep_enabled;\n};\n\nclass HPC_SafetyPartitionManager {\npublic:\n    HPC_SafetyPartitionManager() {\n        InitializePartitions();\n        ValidateFFI();\n    }\n\n    void InitializePartitions() {\n        \u002F\u002F ASIL-D ADAS Partition (decomposed to 2x ASIL-B)\n        SafetyPartition adas_partition_1 {\n            .name = \"ADAS-Perception-1\",\n            .asil = ASILLevel::B,\n            .cpu_cores = {0, 1},  \u002F\u002F Lockstep pair\n            .memory_base = 0x8000'0000,\n            .memory_size = 2ULL * 1024 * 1024 * 1024,  \u002F\u002F 2GB\n            .allowed_interrupts = {IRQ_CAN0, IRQ_CAMERA0, IRQ_LIDAR},\n            .mpu_enabled = true,\n            .ecc_enabled = true,\n            .lockstep_enabled = true\n        };\n\n        SafetyPartition adas_partition_2 {\n            .name = \"ADAS-Perception-2\",\n            .asil = ASILLevel::B,\n            .cpu_cores = {2, 3},  \u002F\u002F Lockstep pair\n            .memory_base = 0xC000'0000,\n            .memory_size = 2ULL * 1024 * 1024 * 1024,  \u002F\u002F 2GB\n            .allowed_interrupts = {IRQ_CAN1, IRQ_CAMERA1, IRQ_RADAR},\n            .mpu_enabled = true,\n            .ecc_enabled = true,\n            .lockstep_enabled = true\n        };\n\n        \u002F\u002F Configure MPU for spatial isolation\n        ConfigureMPU(adas_partition_1);\n        ConfigureMPU(adas_partition_2);\n\n        \u002F\u002F Enable ECC for temporal fault detection\n        EnableECC(adas_partition_1);\n        EnableECC(adas_partition_2);\n\n        \u002F\u002F Configure lockstep cores for fault detection\n        ConfigureLockstep(adas_partition_1);\n        ConfigureLockstep(adas_partition_2);\n\n        partitions_.push_back(adas_partition_1);\n        partitions_.push_back(adas_partition_2);\n    }\n\n    void ConfigureMPU(const SafetyPartition& partition) {\n        \u002F\u002F MPU Configuration for ARM Cortex-A78\n        \u002F\u002F Region 0: Partition memory (RW, Executable)\n        MPU_RegionConfig region_config {\n            .base_address = partition.memory_base,\n            .size = partition.memory_size,\n            .access_permission = MPU_ACCESS_RW_NONE,  \u002F\u002F No access from other cores\n            .execute_never = false,\n            .shareable = false,\n            .cacheable = true\n        };\n\n        for (auto core : partition.cpu_cores) {\n            SetMPURegion(core, 0, region_config);\n        }\n\n        \u002F\u002F Region 1: Shared communication region (RW, Non-executable)\n        MPU_RegionConfig shared_region {\n            .base_address = 0xE000'0000,\n            .size = 64 * 1024 * 1024,  \u002F\u002F 64MB\n            .access_permission = MPU_ACCESS_RW_RW,\n            .execute_never = true,\n            .shareable = true,\n            .cacheable = false  \u002F\u002F Uncached for inter-partition comm\n        };\n\n        for (auto core : partition.cpu_cores) {\n            SetMPURegion(core, 1, shared_region);\n        }\n    }\n\n    void EnableECC(const SafetyPartition& partition) {\n        \u002F\u002F Enable ECC on LPDDR5 memory for partition\n        for (auto core : partition.cpu_cores) {\n            \u002F\u002F Enable ECC in memory controller\n            WriteMemoryControllerReg(\n                MEMORY_ECC_ENABLE_REG,\n                partition.memory_base,\n                partition.memory_size\n            );\n\n            \u002F\u002F Register ECC error handler\n            RegisterECCHandler(core, [partition](uint64_t error_addr) {\n                HandleECCError(partition, error_addr);\n            });\n        }\n    }\n\n    void ConfigureLockstep(const SafetyPartition& partition) {\n        if (!partition.lockstep_enabled || partition.cpu_cores.size() != 2) {\n            return;\n        }\n\n        \u002F\u002F Configure ARM Split-Lock mode (lockstep)\n        uint32_t primary_core = partition.cpu_cores[0];\n        uint32_t shadow_core = partition.cpu_cores[1];\n\n        \u002F\u002F Enable lockstep mode in SCU (Snoop Control Unit)\n        EnableCoreLockstep(primary_core, shadow_core);\n\n        \u002F\u002F Configure lockstep comparator\n        SetLockstepComparator(primary_core, shadow_core, [](uint32_t core_a, uint32_t core_b) {\n            \u002F\u002F Lockstep mismatch detected\n            LOG_FATAL(\"Lockstep mismatch between core %d and %d\", core_a, core_b);\n            TriggerSafeState();\n        });\n    }\n\n    void ValidateFFI() {\n        FFI_Validator validator;\n\n        \u002F\u002F Validate spatial interference (memory)\n        if (!validator.ValidateMemoryIsolation(partitions_)) {\n            throw std::runtime_error(\"Memory isolation validation failed\");\n        }\n\n        \u002F\u002F Validate temporal interference (CPU time)\n        if (!validator.ValidateTemporalIsolation(partitions_)) {\n            throw std::runtime_error(\"Temporal isolation validation failed\");\n        }\n\n        \u002F\u002F Validate interrupt isolation\n        if (!validator.ValidateInterruptIsolation(partitions_)) {\n            throw std::runtime_error(\"Interrupt isolation validation failed\");\n        }\n\n        LOG_INFO(\"FFI validation passed for all partitions\");\n    }\n\nprivate:\n    std::vector\u003CSafetyPartition> partitions_;\n\n    static void HandleECCError(const SafetyPartition& partition, uint64_t error_addr) {\n        LOG_ERROR(\"ECC error in partition %s at address 0x%lx\",\n                  partition.name.c_str(), error_addr);\n\n        \u002F\u002F For ASIL-B\u002FD: Trigger safe state\n        if (partition.asil >= ASILLevel::B) {\n            TriggerSafeState();\n        }\n    }\n\n    static void TriggerSafeState() {\n        \u002F\u002F Transition vehicle to safe state\n        \u002F\u002F - Reduce speed\n        \u002F\u002F - Activate hazard lights\n        \u002F\u002F - Pull over\n        LOG_FATAL(\"Entering safe state due to safety partition failure\");\n        \u002F\u002F Implementation depends on vehicle platform\n    }\n\n    void SetMPURegion(uint32_t core, uint32_t region, const MPU_RegionConfig& config) {\n        \u002F\u002F Platform-specific MPU configuration\n    }\n\n    void EnableCoreLockstep(uint32_t core_a, uint32_t core_b) {\n        \u002F\u002F Platform-specific lockstep enable\n    }\n\n    void SetLockstepComparator(uint32_t core_a, uint32_t core_b, std::function\u003Cvoid(uint32_t, uint32_t)> handler) {\n        \u002F\u002F Platform-specific lockstep comparator\n    }\n};\n\n} \u002F\u002F namespace hpc\n} \u002F\u002F namespace safety\n```\n\n### 3. Freedom From Interference (FFI)\n\n**FFI Requirements per ISO 26262-6 Clause 7:**\n\n| Interference Type | Mechanism | ASIL-D Requirement |\n|-------------------|-----------|-------------------|\n| **Spatial (Memory)** | MPU\u002FMMU | Hardware isolation |\n| **Temporal (CPU Time)** | Time partitioning | Guaranteed time slots |\n| **Communication** | E2E protection | CRC + alive counter |\n| **Peripheral Access** | Access control list | Exclusive device ownership |\n| **Interrupt** | Interrupt masking | Per-partition IRQ routing |\n\n**End-to-End (E2E) Protection for Inter-Partition Communication:**\n```cpp\n\u002F\u002F ISO 26262 E2E Profile for Inter-Partition Messages\n#include \u003Ciso26262\u002Fe2e_protection.h>\n\nnamespace safety {\nnamespace e2e {\n\n\u002F\u002F E2E Profile 4 (used for AUTOSAR Adaptive)\nstruct E2E_Profile4_Header {\n    uint16_t length;          \u002F\u002F Message length\n    uint16_t counter;         \u002F\u002F Rolling counter (0-65535)\n    uint32_t data_id;         \u002F\u002F Unique message identifier\n    uint32_t crc;             \u002F\u002F CRC-32\n} __attribute__((packed));\n\nclass E2E_Protector {\npublic:\n    E2E_Protector(uint32_t data_id)\n        : data_id_(data_id), counter_(0) {}\n\n    \u002F\u002F Protect outgoing message\n    std::vector\u003Cuint8_t> Protect(const std::vector\u003Cuint8_t>& payload) {\n        std::vector\u003Cuint8_t> protected_msg;\n\n        \u002F\u002F Construct header\n        E2E_Profile4_Header header;\n        header.length = static_cast\u003Cuint16_t>(payload.size());\n        header.counter = counter_++;\n        header.data_id = data_id_;\n\n        \u002F\u002F Compute CRC over header (excluding CRC field) + payload\n        header.crc = ComputeCRC32(header, payload);\n\n        \u002F\u002F Serialize header + payload\n        protected_msg.resize(sizeof(header) + payload.size());\n        std::memcpy(protected_msg.data(), &header, sizeof(header));\n        std::memcpy(protected_msg.data() + sizeof(header), payload.data(), payload.size());\n\n        return protected_msg;\n    }\n\n    \u002F\u002F Check incoming message\n    E2E_CheckResult Check(const std::vector\u003Cuint8_t>& protected_msg) {\n        if (protected_msg.size() \u003C sizeof(E2E_Profile4_Header)) {\n            return E2E_CheckResult::ERROR;\n        }\n\n        \u002F\u002F Deserialize header\n        E2E_Profile4_Header header;\n        std::memcpy(&header, protected_msg.data(), sizeof(header));\n\n        \u002F\u002F Extract payload\n        std::vector\u003Cuint8_t> payload(\n            protected_msg.begin() + sizeof(header),\n            protected_msg.end()\n        );\n\n        \u002F\u002F Verify length\n        if (header.length != payload.size()) {\n            return E2E_CheckResult::ERROR;\n        }\n\n        \u002F\u002F Verify CRC\n        uint32_t expected_crc = header.crc;\n        header.crc = 0;  \u002F\u002F Clear CRC field before computation\n        uint32_t computed_crc = ComputeCRC32(header, payload);\n\n        if (expected_crc != computed_crc) {\n            LOG_ERROR(\"E2E CRC mismatch: expected 0x%08x, got 0x%08x\",\n                     expected_crc, computed_crc);\n            return E2E_CheckResult::ERROR;\n        }\n\n        \u002F\u002F Verify counter (detect loss and duplication)\n        E2E_CheckResult counter_result = CheckCounter(header.counter);\n        if (counter_result != E2E_CheckResult::OK) {\n            return counter_result;\n        }\n\n        last_valid_counter_ = header.counter;\n        return E2E_CheckResult::OK;\n    }\n\nprivate:\n    uint32_t data_id_;\n    uint16_t counter_;\n    uint16_t last_valid_counter_ = 0;\n\n    E2E_CheckResult CheckCounter(uint16_t received_counter) {\n        uint16_t expected_counter = (last_valid_counter_ + 1) % 65536;\n\n        if (received_counter == expected_counter) {\n            return E2E_CheckResult::OK;\n        } else if (received_counter == last_valid_counter_) {\n            return E2E_CheckResult::REPEATED;\n        } else {\n            LOG_WARN(\"E2E counter gap: expected %d, got %d\",\n                    expected_counter, received_counter);\n            return E2E_CheckResult::WRONG_SEQUENCE;\n        }\n    }\n\n    uint32_t ComputeCRC32(const E2E_Profile4_Header& header,\n                         const std::vector\u003Cuint8_t>& payload) {\n        \u002F\u002F CRC-32\u002FAUTOSAR polynomial: 0xF4ACFB13\n        uint32_t crc = 0xFFFFFFFF;\n\n        \u002F\u002F CRC over header (excluding CRC field)\n        const uint8_t* header_bytes = reinterpret_cast\u003Cconst uint8_t*>(&header);\n        for (size_t i = 0; i \u003C offsetof(E2E_Profile4_Header, crc); ++i) {\n            crc = UpdateCRC32(crc, header_bytes[i]);\n        }\n\n        \u002F\u002F CRC over payload\n        for (uint8_t byte : payload) {\n            crc = UpdateCRC32(crc, byte);\n        }\n\n        return crc ^ 0xFFFFFFFF;\n    }\n\n    uint32_t UpdateCRC32(uint32_t crc, uint8_t byte) {\n        \u002F\u002F CRC-32 table lookup (AUTOSAR polynomial)\n        static const uint32_t crc_table[256] = { \u002F* ... *\u002F };\n        return (crc >> 8) ^ crc_table[(crc ^ byte) & 0xFF];\n    }\n};\n\nenum class E2E_CheckResult {\n    OK,\n    ERROR,\n    REPEATED,\n    WRONG_SEQUENCE\n};\n\n} \u002F\u002F namespace e2e\n} \u002F\u002F namespace safety\n```\n\n### 4. Safety Mechanisms for HPC\n\n**Platform-Level Safety Mechanisms:**\n```yaml\n# ISO 26262 Safety Mechanisms for HPC\nsafety_mechanisms:\n  hardware_level:\n    - mechanism: \"CPU Lockstep\"\n      target_fault: \"Random hardware faults\"\n      diagnostic_coverage: 99%\n      asil: D\n\n    - mechanism: \"ECC on LPDDR5\"\n      target_fault: \"Single-bit memory errors\"\n      diagnostic_coverage: 99%\n      asil: C\n\n    - mechanism: \"MPU\u002FMMU Protection\"\n      target_fault: \"Memory corruption\"\n      diagnostic_coverage: 99%\n      asil: D\n\n    - mechanism: \"Watchdog Timer\"\n      target_fault: \"Software hang\"\n      diagnostic_coverage: 90%\n      asil: B\n\n  software_level:\n    - mechanism: \"E2E Protection\"\n      target_fault: \"Communication errors\"\n      diagnostic_coverage: 99%\n      asil: D\n\n    - mechanism: \"Diverse Redundancy\"\n      target_fault: \"Systematic software errors\"\n      diagnostic_coverage: 60%\n      asil: C\n\n    - mechanism: \"Plausibility Checks\"\n      target_fault: \"Sensor data corruption\"\n      diagnostic_coverage: 90%\n      asil: B\n\n    - mechanism: \"Program Flow Monitoring\"\n      target_fault: \"Control flow errors\"\n      diagnostic_coverage: 90%\n      asil: C\n\n  system_level:\n    - mechanism: \"ASIL Decomposition\"\n      target_fault: \"Single point of failure\"\n      diagnostic_coverage: N\u002FA\n      asil: D\n\n    - mechanism: \"Safe State Transition\"\n      target_fault: \"Detected failures\"\n      diagnostic_coverage: 99%\n      asil: D\n```\n\n**Watchdog Supervision:**\n```cpp\n\u002F\u002F Multi-level Watchdog for ASIL-D\n#include \u003Cwatchdog\u002Fsupervisor.h>\n\nnamespace safety {\nnamespace watchdog {\n\nclass ASIL_D_WatchdogSupervisor {\npublic:\n    ASIL_D_WatchdogSupervisor()\n        : expected_alive_period_ms_(100),\n          window_watchdog_min_ms_(80),\n          window_watchdog_max_ms_(120) {\n\n        InitializeHardwareWatchdog();\n        InitializeSoftwareWatchdog();\n    }\n\n    \u002F\u002F Application reports alive\n    void ReportAlive(uint32_t partition_id) {\n        auto now = std::chrono::steady_clock::now();\n\n        \u002F\u002F Check if alive report is within window\n        auto elapsed = std::chrono::duration_cast\u003Cstd::chrono::milliseconds>(\n            now - last_alive_[partition_id]\n        ).count();\n\n        if (elapsed \u003C window_watchdog_min_ms_) {\n            LOG_ERROR(\"Watchdog violation: Alive too early (partition %d)\", partition_id);\n            TriggerWatchdogReset(partition_id);\n            return;\n        }\n\n        if (elapsed > window_watchdog_max_ms_) {\n            LOG_ERROR(\"Watchdog violation: Alive too late (partition %d)\", partition_id);\n            TriggerWatchdogReset(partition_id);\n            return;\n        }\n\n        \u002F\u002F Refresh hardware watchdog\n        RefreshHardwareWatchdog();\n\n        \u002F\u002F Update timestamp\n        last_alive_[partition_id] = now;\n    }\n\n    void MonitorLoop() {\n        while (running_) {\n            auto now = std::chrono::steady_clock::now();\n\n            \u002F\u002F Check each partition\n            for (const auto& [partition_id, last_alive] : last_alive_) {\n                auto elapsed = std::chrono::duration_cast\u003Cstd::chrono::milliseconds>(\n                    now - last_alive\n                ).count();\n\n                if (elapsed > window_watchdog_max_ms_) {\n                    LOG_ERROR(\"Watchdog timeout: Partition %d not responding\", partition_id);\n                    TriggerWatchdogReset(partition_id);\n                }\n            }\n\n            std::this_thread::sleep_for(std::chrono::milliseconds(10));\n        }\n    }\n\nprivate:\n    uint32_t expected_alive_period_ms_;\n    uint32_t window_watchdog_min_ms_;\n    uint32_t window_watchdog_max_ms_;\n    std::map\u003Cuint32_t, std::chrono::steady_clock::time_point> last_alive_;\n    bool running_ = true;\n\n    void InitializeHardwareWatchdog() {\n        \u002F\u002F Configure external watchdog IC (e.g., TI TPS3840)\n        \u002F\u002F Timeout: 200ms\n        ConfigureExternalWatchdog(200);\n    }\n\n    void InitializeSoftwareWatchdog() {\n        \u002F\u002F Start monitoring thread\n        std::thread([this]() { MonitorLoop(); }).detach();\n    }\n\n    void RefreshHardwareWatchdog() {\n        \u002F\u002F Toggle watchdog input pin\n        ToggleWatchdogPin();\n    }\n\n    void TriggerWatchdogReset(uint32_t partition_id) {\n        LOG_FATAL(\"Triggering watchdog reset for partition %d\", partition_id);\n\n        \u002F\u002F Option 1: Reset only the partition (if hypervisor supports it)\n        ResetPartition(partition_id);\n\n        \u002F\u002F Option 2: Reset entire ECU (if ASIL-D requires it)\n        \u002F\u002F TriggerECUReset();\n    }\n\n    void ConfigureExternalWatchdog(uint32_t timeout_ms) {\n        \u002F\u002F Platform-specific\n    }\n\n    void ToggleWatchdogPin() {\n        \u002F\u002F Platform-specific\n    }\n\n    void ResetPartition(uint32_t partition_id) {\n        \u002F\u002F Platform-specific\n    }\n};\n\n} \u002F\u002F namespace watchdog\n} \u002F\u002F namespace safety\n```\n\n### 5. Safety Certification Process\n\n**ISO 26262 V-Model for HPC:**\n```\nDevelopment (Left side):          Verification (Right side):\n┌──────────────────────────┐     ┌──────────────────────────┐\n│ System Requirements      │────>│ System Integration Test  │\n│ (ASIL-D ADAS)            │     │ (HIL, Vehicle)           │\n└──────────────────────────┘     └──────────────────────────┘\n        │                                   ▲\n        ▼                                   │\n┌──────────────────────────┐     ┌──────────────────────────┐\n│ Software Architecture    │────>│ Software Integration Test│\n│ (Partition Design)       │     │ (SIL, Test Bench)        │\n└──────────────────────────┘     └──────────────────────────┘\n        │                                   ▲\n        ▼                                   │\n┌──────────────────────────┐     ┌──────────────────────────┐\n│ Software Detailed Design │────>│ Software Unit Test       │\n│ (C++ Modules)            │     │ (GoogleTest, Coverage)   │\n└──────────────────────────┘     └──────────────────────────┘\n        │                                   ▲\n        ▼                                   │\n┌──────────────────────────┐              │\n│ Implementation (Code)    │──────────────┘\n└──────────────────────────┘\n```\n\n**Safety Case Artifacts:**\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"\nSafety Case Evidence Generator for HPC Platform\nGenerates artifacts required for ISO 26262 certification\n\"\"\"\n\nfrom dataclasses import dataclass\nfrom typing import List\nfrom datetime import datetime\n\n@dataclass\nclass SafetyRequirement:\n    req_id: str\n    description: str\n    asil: str\n    source: str  # ISO 26262 clause\n\n@dataclass\nclass SafetyMechanism:\n    mechanism_id: str\n    name: str\n    target_fault: str\n    diagnostic_coverage: float\n    verification_method: str\n\n@dataclass\nclass TestCase:\n    test_id: str\n    requirement_id: str\n    test_method: str  # Unit, Integration, System\n    pass_criteria: str\n    result: str  # PASS\u002FFAIL\n    evidence_path: str\n\nclass SafetyCaseGenerator:\n    def __init__(self, project_name: str):\n        self.project_name = project_name\n        self.requirements: List[SafetyRequirement] = []\n        self.mechanisms: List[SafetyMechanism] = []\n        self.test_cases: List[TestCase] = []\n\n    def add_requirement(self, req: SafetyRequirement):\n        self.requirements.append(req)\n\n    def add_safety_mechanism(self, mech: SafetyMechanism):\n        self.mechanisms.append(mech)\n\n    def add_test_case(self, test: TestCase):\n        self.test_cases.append(test)\n\n    def generate_safety_case(self, output_file: str):\n        \"\"\"Generate comprehensive safety case document\"\"\"\n        with open(output_file, 'w') as f:\n            f.write(f\"# Safety Case for {self.project_name}\\n\\n\")\n            f.write(f\"Generated: {datetime.now().isoformat()}\\n\\n\")\n\n            # Section 1: Safety Requirements\n            f.write(\"## 1. Safety Requirements\\n\\n\")\n            f.write(\"| Req ID | Description | ASIL | Source |\\n\")\n            f.write(\"|--------|-------------|------|--------|\\n\")\n            for req in self.requirements:\n                f.write(f\"| {req.req_id} | {req.description} | {req.asil} | {req.source} |\\n\")\n\n            # Section 2: Safety Mechanisms\n            f.write(\"\\n## 2. Safety Mechanisms\\n\\n\")\n            f.write(\"| Mechanism ID | Name | Target Fault | DC | Verification |\\n\")\n            f.write(\"|--------------|------|--------------|----|--------------|\\n\")\n            for mech in self.mechanisms:\n                f.write(f\"| {mech.mechanism_id} | {mech.name} | {mech.target_fault} | \"\n                       f\"{mech.diagnostic_coverage*100:.0f}% | {mech.verification_method} |\\n\")\n\n            # Section 3: Verification Results\n            f.write(\"\\n## 3. Verification Results\\n\\n\")\n            f.write(\"| Test ID | Requirement | Method | Pass Criteria | Result | Evidence |\\n\")\n            f.write(\"|---------|-------------|--------|---------------|--------|----------|\\n\")\n            for test in self.test_cases:\n                f.write(f\"| {test.test_id} | {test.requirement_id} | {test.test_method} | \"\n                       f\"{test.pass_criteria} | {test.result} | {test.evidence_path} |\\n\")\n\n            # Section 4: Traceability Matrix\n            f.write(\"\\n## 4. Requirements Traceability\\n\\n\")\n            self._generate_traceability_matrix(f)\n\n            # Section 5: FMEA Results\n            f.write(\"\\n## 5. Failure Modes and Effects Analysis\\n\\n\")\n            self._generate_fmea_table(f)\n\n    def _generate_traceability_matrix(self, f):\n        f.write(\"| Requirement | Safety Mechanism | Test Cases | Coverage |\\n\")\n        f.write(\"|-------------|------------------|------------|----------|\\n\")\n\n        for req in self.requirements:\n            # Find related mechanisms\n            mechanisms = [m.mechanism_id for m in self.mechanisms]\n\n            # Find related tests\n            tests = [t.test_id for t in self.test_cases if t.requirement_id == req.req_id]\n\n            coverage = f\"{len(tests)} tests\" if tests else \"No coverage\"\n            f.write(f\"| {req.req_id} | {', '.join(mechanisms[:2])} | \"\n                   f\"{', '.join(tests[:3])} | {coverage} |\\n\")\n\n    def _generate_fmea_table(self, f):\n        f.write(\"| Failure Mode | Effect | Severity | Detection | Mitigation |\\n\")\n        f.write(\"|--------------|--------|----------|-----------|------------|\\n\")\n        f.write(\"| CPU core failure | Loss of ADAS | S3 | Lockstep | Redundant partition |\\n\")\n        f.write(\"| Memory corruption | Data integrity | S3 | ECC | CRC checks |\\n\")\n        f.write(\"| Hypervisor fault | System crash | S3 | Watchdog | Safe state |\\n\")\n\n# Example usage\nif __name__ == '__main__':\n    generator = SafetyCaseGenerator(\"ADAS HPC Platform\")\n\n    # Add requirements\n    generator.add_requirement(SafetyRequirement(\n        req_id=\"SR-001\",\n        description=\"FFI between ASIL-D and QM partitions\",\n        asil=\"D\",\n        source=\"ISO 26262-6:7.4.2\"\n    ))\n\n    generator.add_requirement(SafetyRequirement(\n        req_id=\"SR-002\",\n        description=\"Diagnostic coverage >99% for hardware faults\",\n        asil=\"D\",\n        source=\"ISO 26262-5:8.4.3\"\n    ))\n\n    # Add safety mechanisms\n    generator.add_safety_mechanism(SafetyMechanism(\n        mechanism_id=\"SM-001\",\n        name=\"CPU Lockstep\",\n        target_fault=\"Random hardware faults in CPU\",\n        diagnostic_coverage=0.99,\n        verification_method=\"Fault injection testing\"\n    ))\n\n    generator.add_safety_mechanism(SafetyMechanism(\n        mechanism_id=\"SM-002\",\n        name=\"Memory ECC\",\n        target_fault=\"Single-bit memory errors\",\n        diagnostic_coverage=0.99,\n        verification_method=\"ECC error injection\"\n    ))\n\n    # Add test cases\n    generator.add_test_case(TestCase(\n        test_id=\"TC-001\",\n        requirement_id=\"SR-001\",\n        test_method=\"Integration Test\",\n        pass_criteria=\"No memory access violations detected\",\n        result=\"PASS\",\n        evidence_path=\"test_results\u002Ftc001_ffi_validation.log\"\n    ))\n\n    # Generate safety case document\n    generator.generate_safety_case(\"safety_case.md\")\n    print(\"Safety case generated: safety_case.md\")\n```\n\n## Use Cases\n\n1. **ASIL-D ADAS Platform Certification**: Certify perception\u002Fplanning on HPC SoC\n2. **Zonal Controller Safety**: Multi-ASIL partitioning for zone ECU\n3. **OTA Update Safety**: Demonstrate safe software updates without re-certification\n4. **Mixed-Criticality Cockpit**: ASIL-A cluster + QM IVI on single platform\n\n## Automotive Standards\n\n- **ISO 26262-6:2018**: Software development at the component level\n- **ISO 26262-8:2018**: Supporting processes (safety analysis)\n- **ISO 26262-9:2018**: ASIL-oriented and safety-oriented analyses\n- **ISO 26262-11:2018**: Application of ISO 26262 to semiconductors\n\n## Tools Required\n\n- **medini analyze**: FMEA and FTA tool\n- **LDRA**: Static analysis and unit test (TÜV certified)\n- **Vector CANoe**: HIL testing with fault injection\n- **QNX Safety Hypervisor**: Pre-certified hypervisor (ASIL-D)\n\n## Performance Metrics\n\n- **Diagnostic Coverage**: >99% for ASIL-D single-point faults\n- **Fault Latency**: \u003C10ms detection and reaction time\n- **Safe State Transition**: \u003C100ms from fault detection to safe state\n- **MPU Overhead**: \u003C1% CPU utilization\n\n## References\n\n- ISO 26262-6:2018 Software Development\n- \"Safety Certification for Multi-Core Automotive Systems\" (SAE Paper 2020-01-0729)\n- NVIDIA DRIVE OS Safety Manual\n- QNX Hypervisor 2.2 Safety Manual (ISO 26262 ASIL-D)\n\n---\n\n**Version:** 1.0.0\n**Last Updated:** 2026-03-19\n**Author:** Automotive Claude Code Agents\n\n---\n\n## Vehicle Compute Platforms\n\n# Vehicle Central Compute Platforms\n\n**Category:** automotive-hpc\n**Version:** 1.0.0\n**Maturity:** production\n**Complexity:** advanced\n\n## Overview\n\nComprehensive guide to automotive High-Performance Computing (HPC) SoC platforms for Software-Defined Vehicles. Covers NVIDIA DRIVE, Qualcomm Snapdragon Ride, NXP S32 family, performance benchmarks, thermal management, and power budgets.\n\n## HPC Platform Comparison\n\n### Platform Overview Table\n\n| Platform | CPU | GPU | NPU\u002FAI | Memory | TOPS | TDP | Use Case |\n|----------|-----|-----|--------|--------|------|-----|----------|\n| **NVIDIA DRIVE Orin** | 12-core ARM Cortex-A78AE | Ampere GPU (2048 CUDA) | 2x DLA | 32GB LPDDR5 | 254 | 60W | L3+ AD, ADAS |\n| **NVIDIA DRIVE Thor** | 16-core Grace CPU | Ada GPU | NvDLA v3 | 128GB | 2000 | 300W | L4\u002FL5 AD |\n| **Qualcomm Snapdragon Ride** | 8-core Kryo 780 | Adreno 740 | Hexagon 780 | 64GB LPDDR5 | 700 | 65W | ADAS, Cockpit |\n| **NXP S32G3** | 8-core Cortex-A53 | PowerVR | - | 16GB DDR4 | - | 12W | Gateway, ADAS |\n| **NXP S32Z\u002FE** | 16-core Cortex-R52 | - | - | 8GB DDR4 | - | 20W | Safety Domain |\n| **Renesas R-Car V4H** | 8-core Cortex-A76 | IMG PowerVR | CNN-IP | 32GB LPDDR4X | 80 | 40W | ADAS, Cockpit |\n| **Intel Atom x7000RE** | 8-core x86 | Xe GPU | VPU | 32GB LPDDR5 | 60 | 35W | IVI, Telematics |\n\n---\n\n## 1. NVIDIA DRIVE Platform\n\n### NVIDIA DRIVE Orin\n\n**Specifications:**\n- **CPU**: 12-core ARM Cortex-A78AE (ISO 26262 ASIL-D)\n- **GPU**: NVIDIA Ampere architecture, 2048 CUDA cores, RT cores\n- **DLA**: 2x Deep Learning Accelerators (70 TOPS each)\n- **AI Performance**: 254 TOPS INT8\n- **Memory**: 32GB LPDDR5, 204.8 GB\u002Fs bandwidth\n- **Video**: 8x 4K60 cameras, H.265 encode\u002Fdecode\n- **Interfaces**: 16-lane PCIe Gen4, 10GbE, CAN-FD\n- **Safety**: ISO 26262 ASIL-D, lockstep CPU cores\n\n**DRIVE OS Software Stack:**\n```\n┌─────────────────────────────────────────────┐\n│      Autonomous Driving Applications        │\n├─────────────────────────────────────────────┤\n│  DriveWorks SDK (Perception, Planning)      │\n│  - Object detection, tracking, fusion       │\n│  - Path planning, behavior prediction       │\n├─────────────────────────────────────────────┤\n│  CUDA, TensorRT, cuDNN (AI Inference)       │\n├─────────────────────────────────────────────┤\n│  DRIVE OS (Linux + RTOS)                    │\n│  - Safety partition (QNX\u002FIntegrity)         │\n│  - Performance partition (Ubuntu)           │\n├─────────────────────────────────────────────┤\n│  Hypervisor (NVIDIA vGPU)                   │\n└─────────────────────────────────────────────┘\n```\n\n**DriveWorks Example - Object Detection:**\n```cpp\n\u002F\u002F NVIDIA DriveWorks - YOLO Object Detection on Orin\n#include \u003Cdw\u002Fcore\u002FContext.h>\n#include \u003Cdw\u002Fsensors\u002Fcamera\u002FCamera.h>\n#include \u003Cdw\u002Fobject\u002FDetector.h>\n#include \u003Cdw\u002Fdnn\u002FDNN.h>\n\nnamespace nvidia {\nnamespace adas {\n\nclass ObjectDetector {\npublic:\n    ObjectDetector() {\n        \u002F\u002F Initialize DriveWorks context\n        dwContextParameters ctx_params{};\n        ctx_params.enableCudaLogging = true;\n        dwInitialize(&context_, DW_VERSION, &ctx_params);\n\n        \u002F\u002F Load DNN model (YOLO) optimized for Orin\n        dwDNNModelHandle_t model;\n        dwDNN_initializeTensorFlowModel(&model, \"\u002Fmodels\u002Fyolo_v5_fp16.trt\", context_);\n\n        \u002F\u002F Create object detector\n        dwObjectDetectorParams detector_params{};\n        detector_params.maxNumObjects = 100;\n        detector_params.enableTracking = true;\n        dwObjectDetector_initialize(&detector_, model, context_);\n\n        \u002F\u002F Initialize camera\n        dwSensorParams camera_params{};\n        camera_params.protocol = \"camera.gmsl\";\n        camera_params.parameters = \"device=0,output-format=yuv420\";\n        dwSAL_createSensor(&camera_, camera_params, sal_);\n    }\n\n    void ProcessFrame() {\n        \u002F\u002F Capture camera frame\n        dwCameraFrameHandle_t frame;\n        dwSensorCamera_getImage(&frame, DW_CAMERA_OUTPUT_CUDA_YUV420, camera_);\n\n        \u002F\u002F Run object detection on DLA\n        dwObjectArray detected_objects;\n        dwObjectDetector_processDeviceAsync(&detected_objects, frame, detector_);\n\n        \u002F\u002F Wait for DLA completion\n        dwObjectDetector_processDeviceSync(detector_);\n\n        \u002F\u002F Process detected objects\n        for (uint32_t i = 0; i \u003C detected_objects.size; ++i) {\n            const auto& obj = detected_objects.objects[i];\n            ProcessDetection(obj);\n        }\n\n        \u002F\u002F Release frame\n        dwSensorCamera_returnImage(&frame, camera_);\n    }\n\n    void ProcessDetection(const dwObject& obj) {\n        std::cout \u003C\u003C \"Object: \" \u003C\u003C GetClassLabel(obj.classLabel)\n                  \u003C\u003C \" Confidence: \" \u003C\u003C obj.confidence\n                  \u003C\u003C \" BBox: (\" \u003C\u003C obj.box.x \u003C\u003C \",\" \u003C\u003C obj.box.y \u003C\u003C \",\"\n                  \u003C\u003C obj.box.width \u003C\u003C \",\" \u003C\u003C obj.box.height \u003C\u003C \")\"\n                  \u003C\u003C std::endl;\n    }\n\n    ~ObjectDetector() {\n        dwObjectDetector_release(detector_);\n        dwSAL_releaseSensor(camera_);\n        dwRelease(context_);\n    }\n\nprivate:\n    dwContextHandle_t context_;\n    dwSALHandle_t sal_;\n    dwSensorHandle_t camera_;\n    dwObjectDetectorHandle_t detector_;\n\n    std::string GetClassLabel(uint32_t label) {\n        static const std::vector\u003Cstd::string> labels = {\n            \"car\", \"truck\", \"pedestrian\", \"bicycle\", \"motorcycle\"\n        };\n        return labels[label];\n    }\n};\n\n} \u002F\u002F namespace adas\n} \u002F\u002F namespace nvidia\n\nint main() {\n    nvidia::adas::ObjectDetector detector;\n\n    \u002F\u002F Process at 30Hz\n    while (true) {\n        detector.ProcessFrame();\n        std::this_thread::sleep_for(std::chrono::milliseconds(33));\n    }\n\n    return 0;\n}\n```\n\n**Performance Benchmarks (NVIDIA Orin):**\n```yaml\n# Orin Performance Profile\nmodel: NVIDIA DRIVE AGX Orin\nsoc: Parker\n\nbenchmarks:\n  yolo_v5_detection:\n    precision: FP16\n    input: 1920x1080\n    accelerator: DLA\n    throughput: 60 FPS\n    latency: 16ms\n    power: 15W\n\n  resnet50_classification:\n    precision: INT8\n    input: 224x224\n    accelerator: DLA\n    throughput: 2000 FPS\n    latency: 0.5ms\n    power: 8W\n\n  pointpillar_lidar:\n    precision: FP16\n    points: 100K\n    accelerator: GPU\n    throughput: 30 FPS\n    latency: 33ms\n    power: 25W\n\n  end_to_end_perception:\n    cameras: 8x 4K\n    lidar: 64-beam\n    radar: 4x continental\n    total_latency: 80ms\n    total_power: 55W\n    tops_utilized: 180\n```\n\n### NVIDIA DRIVE Thor\n\n**Next-Generation Platform (2025+):**\n- **2000 TOPS AI Performance**: 8x Orin capability\n- **Unified Architecture**: Single chip for all vehicle computing\n- **Grace CPU**: ARM Neoverse V2 cores\n- **Ada GPU**: Latest RTX architecture\n- **Consolidated**: Replaces 6-8 ECUs with single SoC\n\n**Thor Use Cases:**\n```python\n# NVIDIA DRIVE Thor - Consolidated Architecture\nplatform = {\n    'soc': 'NVIDIA DRIVE Thor',\n    'consolidated_functions': [\n        {\n            'domain': 'Autonomous Driving',\n            'workloads': ['Perception', 'Planning', 'Control'],\n            'tops_allocated': 1200,\n            'safety_level': 'ASIL-D'\n        },\n        {\n            'domain': 'ADAS',\n            'workloads': ['ACC', 'LKA', 'AEB', 'Parking'],\n            'tops_allocated': 300,\n            'safety_level': 'ASIL-B'\n        },\n        {\n            'domain': 'Cockpit',\n            'workloads': ['IVI', 'Cluster', 'HUD', 'Cameras'],\n            'tops_allocated': 200,\n            'safety_level': 'QM'\n        },\n        {\n            'domain': 'Body\u002FComfort',\n            'workloads': ['Lighting', 'HVAC', 'Access'],\n            'tops_allocated': 50,\n            'safety_level': 'QM'\n        },\n        {\n            'domain': 'Connectivity',\n            'workloads': ['Telematics', 'V2X', 'OTA'],\n            'tops_allocated': 50,\n            'safety_level': 'QM'\n        }\n    ],\n    'isolation': 'Hardware virtualization + Hypervisor',\n    'total_power': '300W @ peak, 150W @ typical'\n}\n```\n\n---\n\n## 2. Qualcomm Snapdragon Ride Platform\n\n**Snapdragon Ride Flex SoC:**\n- **CPU**: Kryo 780 (ARM Cortex-A78 based), 8 cores @ 3.0 GHz\n- **GPU**: Adreno 740 (Vulkan, OpenCL)\n- **AI**: Hexagon 780 DSP, 700 TOPS INT8\n- **ISP**: Spectra 18-bit triple ISP, 12x cameras\n- **Connectivity**: 5G modem, C-V2X, Wi-Fi 6E\n- **Safety**: ISO 26262 ASIL-D support\n\n**Snapdragon Software Stack:**\n```cpp\n\u002F\u002F Qualcomm SNPE (Snapdragon Neural Processing Engine)\n#include \u003CSNPE\u002FSNPE.hpp>\n#include \u003CSNPE\u002FSNPEFactory.hpp>\n#include \u003CDlContainer\u002FIDlContainer.hpp>\n\nnamespace qualcomm {\nnamespace adas {\n\nclass SNPEInference {\npublic:\n    SNPEInference(const std::string& model_path) {\n        \u002F\u002F Load DLC (Deep Learning Container)\n        container_ = zdl::DlContainer::IDlContainer::open(model_path);\n\n        \u002F\u002F Build SNPE network\n        zdl::SNPE::SNPEBuilder builder(container_.get());\n\n        \u002F\u002F Configure runtime (DSP > GPU > CPU)\n        builder.setRuntimeProcessorOrder({\n            zdl::DlSystem::Runtime_t::DSP,\n            zdl::DlSystem::Runtime_t::GPU,\n            zdl::DlSystem::Runtime_t::CPU\n        });\n\n        \u002F\u002F Set performance profile\n        builder.setPerformanceProfile(\n            zdl::DlSystem::PerformanceProfile_t::SUSTAINED_HIGH_PERFORMANCE\n        );\n\n        \u002F\u002F Build network\n        snpe_ = builder.build();\n\n        if (snpe_ == nullptr) {\n            throw std::runtime_error(\"Failed to build SNPE network\");\n        }\n    }\n\n    std::vector\u003Cfloat> Infer(const std::vector\u003Cfloat>& input) {\n        \u002F\u002F Create input tensor\n        auto input_shape = snpe_->getInputDimensions();\n        zdl::DlSystem::ITensor* input_tensor =\n            zdl::SNPE::SNPEFactory::getTensorFactory().createTensor(input_shape);\n\n        \u002F\u002F Copy input data\n        std::copy(input.begin(), input.end(),\n                  input_tensor->begin());\n\n        \u002F\u002F Execute inference on Hexagon DSP\n        snpe_->execute(input_tensor, output_map_);\n\n        \u002F\u002F Extract output\n        zdl::DlSystem::ITensor* output_tensor =\n            output_map_.getTensor(output_map_.getTensorNames()[0]);\n\n        std::vector\u003Cfloat> output(output_tensor->begin(), output_tensor->end());\n        return output;\n    }\n\nprivate:\n    std::unique_ptr\u003Czdl::DlContainer::IDlContainer> container_;\n    std::unique_ptr\u003Czdl::SNPE::SNPE> snpe_;\n    zdl::DlSystem::TensorMap output_map_;\n};\n\n} \u002F\u002F namespace adas\n} \u002F\u002F namespace qualcomm\n```\n\n**Snapdragon Performance:**\n```yaml\nsnapdragon_ride_flex:\n  ai_performance: 700 TOPS INT8\n  camera_support: 12x simultaneous\n  display_output: 4x 4K60\n\n  benchmark_results:\n    mobilenet_v2:\n      precision: INT8\n      accelerator: Hexagon DSP\n      throughput: 5000 FPS\n      latency: 0.2ms\n      power: 3W\n\n    efficientdet_d2:\n      precision: FP16\n      accelerator: Adreno GPU\n      throughput: 45 FPS\n      latency: 22ms\n      power: 12W\n\n    lane_detection:\n      model: Ultra-Fast-Lane\n      accelerator: Hexagon DSP\n      throughput: 90 FPS\n      latency: 11ms\n      power: 5W\n```\n\n---\n\n## 3. NXP S32 Platform Family\n\n### NXP S32G3 (Gateway & Vehicle Networking)\n\n**Specifications:**\n- **CPU**: 8-core ARM Cortex-A53 @ 1.0 GHz\n- **Networking**: 8x Ethernet (up to 10GbE), 16x CAN-FD\n- **Memory**: Up to 16GB DDR4\n- **Safety**: ISO 26262 ASIL-B lockstep cores\n- **HSE**: Hardware Security Engine for secure boot\n\n**S32G3 Gateway Application:**\n```cpp\n\u002F\u002F NXP S32G - Secure Gateway with HSE\n#include \u003Cs32g\u002Fhse_interface.h>\n#include \u003Cs32g\u002Fnetc_driver.h>\n\nnamespace nxp {\nnamespace gateway {\n\nclass SecureGateway {\npublic:\n    SecureGateway() {\n        \u002F\u002F Initialize Hardware Security Engine\n        InitializeHSE();\n\n        \u002F\u002F Configure NETC (Network Controller)\n        InitializeNetworking();\n    }\n\n    void InitializeHSE() {\n        \u002F\u002F HSE firmware installation\n        HSE_InstallFirmware(hse_firmware_bin, firmware_size);\n\n        \u002F\u002F Configure secure boot\n        HSE_ConfigureSecureBoot({\n            .enable_secure_boot = true,\n            .key_store = HSE_KEY_STORE_RAM,\n            .boot_auth_algorithm = HSE_AUTH_SCHEME_RSA2048\n        });\n\n        \u002F\u002F Setup MAC authentication for CAN\u002FEthernet\n        HSE_ConfigureMACGeneration(HSE_MAC_ALGO_CMAC_AES128);\n    }\n\n    void InitializeNetworking() {\n        \u002F\u002F Configure 10GbE for zonal architecture\n        NETC_ConfigureEthernet({\n            .port = NETC_PORT_0,\n            .speed = NETC_SPEED_10G,\n            .mode = NETC_MODE_SWITCH,\n            .vlan_support = true,\n            .time_sync = NETC_PTP_SLAVE  \u002F\u002F IEEE 1588 PTP\n        });\n\n        \u002F\u002F Configure CAN-FD gateway\n        NETC_ConfigureCANGateway({\n            .can_ports = {NETC_CAN_0, NETC_CAN_1, NETC_CAN_2},\n            .routing_rules = LoadRoutingTable(),\n            .frame_authentication = true  \u002F\u002F Use HSE for MAC\n        });\n    }\n\n    void RouteMessage(const CANMessage& msg) {\n        \u002F\u002F Authenticate incoming CAN message using HSE\n        if (!AuthenticateMessage(msg)) {\n            LogSecurityEvent(\"Invalid CAN message authentication\");\n            return;\n        }\n\n        \u002F\u002F Route to appropriate network\n        auto route = routing_table_.Lookup(msg.id);\n        if (route.target_network == NetworkType::ETHERNET) {\n            ForwardToEthernet(msg, route.target_address);\n        } else if (route.target_network == NetworkType::CAN) {\n            ForwardToCAN(msg, route.target_bus);\n        }\n    }\n\nprivate:\n    bool AuthenticateMessage(const CANMessage& msg) {\n        \u002F\u002F Extract MAC from message\n        uint8_t received_mac[16];\n        ExtractMAC(msg, received_mac);\n\n        \u002F\u002F Compute expected MAC using HSE\n        uint8_t expected_mac[16];\n        HSE_ComputeMAC(msg.data, msg.length, expected_mac);\n\n        return std::memcmp(received_mac, expected_mac, 16) == 0;\n    }\n\n    void ForwardToEthernet(const CANMessage& msg, uint32_t target_ip) {\n        \u002F\u002F Encapsulate CAN in SOME\u002FIP or DDS\n        EthernetFrame frame = EncapsulateCANInSOMEIP(msg);\n        NETC_SendEthernetFrame(NETC_PORT_0, frame);\n    }\n\n    RoutingTable routing_table_;\n};\n\n} \u002F\u002F namespace gateway\n} \u002F\u002F namespace nxp\n```\n\n### NXP S32Z\u002FE (Real-Time & Safety)\n\n**Specifications:**\n- **CPU**: 16-core ARM Cortex-R52 @ 800 MHz (lockstep pairs)\n- **Safety**: ISO 26262 ASIL-D\n- **Real-Time**: Deterministic execution, hardware semaphores\n- **Use Cases**: Safety domain controller, real-time control\n\n---\n\n## 4. Thermal Management\n\n**Thermal Control Strategy:**\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"\nHPC Thermal Management for Automotive\nPrevents thermal throttling while maintaining performance\n\"\"\"\n\nimport time\nfrom dataclasses import dataclass\nfrom typing import List\n\n@dataclass\nclass ThermalZone:\n    name: str\n    sensor_path: str\n    trip_points: List[int]  # [warning, critical, shutdown]\n    cooling_devices: List[str]\n\nclass ThermalManager:\n    def __init__(self):\n        self.zones = {\n            'cpu': ThermalZone(\n                name='CPU Package',\n                sensor_path='\u002Fsys\u002Fclass\u002Fthermal\u002Fthermal_zone0\u002Ftemp',\n                trip_points=[85, 95, 105],  # °C\n                cooling_devices=['cpu_fan', 'cpu_freq']\n            ),\n            'gpu': ThermalZone(\n                name='GPU Core',\n                sensor_path='\u002Fsys\u002Fclass\u002Fthermal\u002Fthermal_zone1\u002Ftemp',\n                trip_points=[80, 90, 100],\n                cooling_devices=['gpu_fan', 'gpu_freq']\n            ),\n            'dla': ThermalZone(\n                name='DLA Accelerator',\n                sensor_path='\u002Fsys\u002Fclass\u002Fthermal\u002Fthermal_zone2\u002Ftemp',\n                trip_points=[85, 95, 105],\n                cooling_devices=['system_fan', 'dla_throttle']\n            )\n        }\n\n    def monitor_and_control(self):\n        \"\"\"Main thermal control loop (1Hz)\"\"\"\n        while True:\n            for zone_name, zone in self.zones.items():\n                temp = self.read_temperature(zone)\n\n                if temp >= zone.trip_points[2]:\n                    # Shutdown threshold\n                    self.emergency_shutdown(zone)\n                elif temp >= zone.trip_points[1]:\n                    # Critical: aggressive throttling\n                    self.apply_aggressive_cooling(zone)\n                elif temp >= zone.trip_points[0]:\n                    # Warning: moderate throttling\n                    self.apply_moderate_cooling(zone)\n                else:\n                    # Normal: restore performance\n                    self.restore_performance(zone)\n\n            time.sleep(1.0)\n\n    def read_temperature(self, zone: ThermalZone) -> float:\n        \"\"\"Read temperature from sysfs (in milli-degrees)\"\"\"\n        with open(zone.sensor_path, 'r') as f:\n            temp_millidegrees = int(f.read().strip())\n        return temp_millidegrees \u002F 1000.0\n\n    def apply_aggressive_cooling(self, zone: ThermalZone):\n        \"\"\"Critical temperature: max cooling\"\"\"\n        print(f\"CRITICAL: {zone.name} at {self.read_temperature(zone)}°C\")\n\n        # Set fan to 100%\n        self.set_fan_speed('system_fan', 100)\n\n        # Reduce CPU\u002FGPU frequency to 50%\n        if 'cpu_freq' in zone.cooling_devices:\n            self.set_frequency_limit('cpu', 0.5)\n        if 'gpu_freq' in zone.cooling_devices:\n            self.set_frequency_limit('gpu', 0.5)\n\n        # Throttle DLA workload\n        if 'dla_throttle' in zone.cooling_devices:\n            self.throttle_dla_workload(0.5)\n\n    def apply_moderate_cooling(self, zone: ThermalZone):\n        \"\"\"Warning temperature: moderate cooling\"\"\"\n        print(f\"WARNING: {zone.name} at {self.read_temperature(zone)}°C\")\n\n        # Set fan to 70%\n        self.set_fan_speed('system_fan', 70)\n\n        # Reduce frequency to 80%\n        if 'cpu_freq' in zone.cooling_devices:\n            self.set_frequency_limit('cpu', 0.8)\n        if 'gpu_freq' in zone.cooling_devices:\n            self.set_frequency_limit('gpu', 0.8)\n\n    def restore_performance(self, zone: ThermalZone):\n        \"\"\"Normal temperature: full performance\"\"\"\n        # Fan at baseline (40%)\n        self.set_fan_speed('system_fan', 40)\n\n        # Restore full frequency\n        self.set_frequency_limit('cpu', 1.0)\n        self.set_frequency_limit('gpu', 1.0)\n        self.throttle_dla_workload(1.0)\n\n    def set_fan_speed(self, fan: str, percent: int):\n        \"\"\"Set fan PWM duty cycle\"\"\"\n        pwm_path = f'\u002Fsys\u002Fclass\u002Fhwmon\u002Fhwmon0\u002F{fan}'\n        with open(pwm_path, 'w') as f:\n            f.write(str(int(255 * percent \u002F 100)))\n\n    def set_frequency_limit(self, component: str, ratio: float):\n        \"\"\"Set frequency scaling governor\"\"\"\n        if component == 'cpu':\n            path = '\u002Fsys\u002Fdevices\u002Fsystem\u002Fcpu\u002Fcpufreq\u002Fpolicy0\u002Fscaling_max_freq'\n            max_freq = 2400000  # 2.4 GHz\n        elif component == 'gpu':\n            path = '\u002Fsys\u002Fclass\u002Fdrm\u002Fcard0\u002Fdevice\u002Fpp_dpm_sclk'\n            max_freq = 1500000  # 1.5 GHz\n\n        target_freq = int(max_freq * ratio)\n        with open(path, 'w') as f:\n            f.write(str(target_freq))\n\n    def throttle_dla_workload(self, ratio: float):\n        \"\"\"Reduce DLA workload by skipping frames\"\"\"\n        # Application-level throttling\n        pass\n\n    def emergency_shutdown(self, zone: ThermalZone):\n        \"\"\"Emergency thermal shutdown\"\"\"\n        print(f\"EMERGENCY SHUTDOWN: {zone.name} exceeded safe limits\")\n        # Trigger graceful shutdown\n        import subprocess\n        subprocess.run(['systemctl', 'poweroff'])\n\nif __name__ == '__main__':\n    manager = ThermalManager()\n    manager.monitor_and_control()\n```\n\n## Power Budget Management\n\n**Platform Power Profiles:**\n```yaml\n# Power management for NVIDIA Orin in production vehicle\norin_power_budget:\n  max_tdp: 60W\n  cooling: Liquid cold plate (0.2 °C\u002FW)\n\n  power_states:\n    parking_mode:\n      cpu_cores: 2\n      cpu_freq: 1.2 GHz\n      gpu_active: false\n      dla_active: false\n      power: 8W\n      use_case: \"Parking assist, surround view\"\n\n    driving_mode:\n      cpu_cores: 12\n      cpu_freq: 2.2 GHz\n      gpu_active: true\n      dla_active: true\n      dla_utilization: 80%\n      power: 45W\n      use_case: \"Full ADAS, L3 autonomous\"\n\n    charging_mode:\n      cpu_cores: 4\n      cpu_freq: 1.8 GHz\n      gpu_active: false\n      dla_active: false\n      power: 15W\n      use_case: \"OTA updates, diagnostics\"\n\n  power_optimization:\n    - \"Dynamic Voltage Frequency Scaling (DVFS)\"\n    - \"Clock gating for idle IP blocks\"\n    - \"DLA preferred over GPU (5x power efficiency)\"\n    - \"Camera ISP pipeline optimization\"\n```\n\n## Use Cases\n\n1. **L3+ Autonomous Driving**: NVIDIA Orin for sensor fusion and path planning\n2. **Zonal Architecture Gateway**: NXP S32G3 for network consolidation\n3. **Cockpit Domain Controller**: Qualcomm Snapdragon Ride for IVI + cluster\n4. **Safety Domain**: NXP S32Z\u002FE for ASIL-D real-time control\n\n## References\n\n- NVIDIA DRIVE Orin Product Brief\n- Qualcomm Snapdragon Ride Platform Overview\n- NXP S32 Automotive Platform Family\n- \"Automotive SoC Benchmarks\" (MLPerf Inference)\n\n---\n\n**Version:** 1.0.0\n**Last Updated:** 2026-03-19\n**Author:** Automotive Claude Code Agents\n",{"name":5,"tags":23,"description":25},[24,5],"automotive","Automotive Hpc expertise. Covers 5 topics: Autosar Adaptive, Containerization Orchestration, Hypervisor Virtualization, Safety Certification Hpc, Vehicle Compute Platforms.\n","main","764e05645935fe0d4c219ab3786883289700a063","skills\u002Fautomotive-hpc",3,"https:\u002F\u002Fgithub.com\u002Fpangzhenying2025\u002Fhermes-automotive-skills","https:\u002F\u002Fgithub.com\u002Fpangzhenying2025","2026-05-19 20:41:59",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add pangzhenying2025\u002Fhermes-automotive-skills --skill automotive-hpc",{"tool":39,"command":40},"bunx","bunx skills add pangzhenying2025\u002Fhermes-automotive-skills --skill automotive-hpc",{"tool":42,"command":43},"pnpm","pnpm dlx skills add pangzhenying2025\u002Fhermes-automotive-skills --skill automotive-hpc","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fpangzhenying2025\u002Fhermes-automotive-skills\u002Fblob\u002Fmain\u002Fskills\u002Fautomotive-hpc\u002FSKILL.md",true,[],[48,55,62,69,76,83],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":18},"01M7360ZT6X73B7WX8G9T42MRX","china-sotif","China standard: Sotif. # 中国 SOTIF 标准集 — GB\u002FT 43267 + CSAE 316.1\u002F316.2 + CSAE 336","https:\u002F\u002Fgithub.com\u002Fpangzhenying2025\u002Fhermes-automotive-skills\u002Fblob\u002Fmain\u002Fskills\u002Fchina-sotif\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":18},"01M7360VT7N20KBKD59QG6BEVQ","china-scenario-safety","China standard: Scenario Safety. # 场景安全评估框架 — ISO 34501\u002F34502 + ISO 34503\u002F34504\u002F34505","https:\u002F\u002Fgithub.com\u002Fpangzhenying2025\u002Fhermes-automotive-skills\u002Fblob\u002Fmain\u002Fskills\u002Fchina-scenario-safety\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":18},"01M7360SM9DD8BAECKC7C03ST1","china-odd","China standard: Odd. # 自动驾驶系统设计运行条件（ODD）标准","https:\u002F\u002Fgithub.com\u002Fpangzhenying2025\u002Fhermes-automotive-skills\u002Fblob\u002Fmain\u002Fskills\u002Fchina-odd\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":18},"01M7360QDGZAFVAJ2M2BQY5AAS","china-multi-pillar","China standard: Multi Pillar. # \"多支柱\"标准综合应用指南","https:\u002F\u002Fgithub.com\u002Fpangzhenying2025\u002Fhermes-automotive-skills\u002Fblob\u002Fmain\u002Fskills\u002Fchina-multi-pillar\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":18},"01M7360N6FMFHK17MH5MB96R9Z","china-l3-fusa-sotif","China standard: L3 Fusa Sotif. # L3 有条件自动驾驶系统 功能安全和预期功能安全技术要求","https:\u002F\u002Fgithub.com\u002Fpangzhenying2025\u002Fhermes-automotive-skills\u002Fblob\u002Fmain\u002Fskills\u002Fchina-l3-fusa-sotif\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":18},"01M7360J517TM1JC1YS6M2YX38","china-l2-adas-safety","China standard: L2 Adas Safety. # L2 组合驾驶辅助系统安全要求（强制性国标草案）","https:\u002F\u002Fgithub.com\u002Fpangzhenying2025\u002Fhermes-automotive-skills\u002Fblob\u002Fmain\u002Fskills\u002Fchina-l2-adas-safety\u002FSKILL.md",[],[]]