《电子技术应用》
您所在的位置:首页 > 嵌入式技术 > 设计应用 > 基于UDSonCAN协议的车载ECU Bootloader开发
基于UDSonCAN协议的车载ECU Bootloader开发
电子技术应用
邹敏捷,刘帅,马闻铎,唐天宇,张佳淼,杨博,刘兵
摘要: 针对车载ECU软件规模激增与漏洞频发的现状,以及传统刷写依赖物理拆卸及私有协议导致的效率低下、成本高等问题,基于UDS相关协议(ISO 14229-1, ISO 15765-2)在NXP S32K144微控制器上设计并开发了CAN总线下标准化的Bootloader程序。系统整合了UDS应用层关键服务与传输层多帧分包机制,构建了包含预编程、编程和后编程三阶段的完整刷写流程。采用严格的Flash分区策略及硬件保护机制,并结合程序CRC校验,确保启动可靠性与更新安全性。在此基础上,自主开发了基于Delphi的客户端工具,并进行了一系列Bootloader刷写测试。测试结果表明,该方案实现了高效、稳定的ECU软件的更新升级功能,并在ECU掉电、CAN通信中断等异常情况下展现出良好的鲁棒性与可靠恢复能力。本方案为汽车关键ECU提供了标准化、高可靠的软件的更新及升级能力,为未来ECU软件开发、优化、标定、升级奠定基础,也为同类ECU的软件升级开发提供了一个详实的工程参考。
中图分类号:U463.6 文献标志码:A DOI: 10.16157/j.issn.0258-7998.257259
中文引用格式: 邹敏捷,刘帅,马闻铎,等. 基于UDSonCAN协议的车载ECU Bootloader开发[J]. 电子技术应用,2026,52(3):98-105.
英文引用格式: Zou Minjie,Liu Shuai,Ma Wenduo,et al. Development of ECU Bootloader based on UDSonCAN protocol[J]. Application of Electronic Technique,2026,52(3):98-105.
Development of ECU Bootloader based on UDSonCAN protocol
Zou Minjie,Liu Shuai,Ma Wenduo,Tang Tianyu,Zhang Jiamiao,Yang Bo,Liu Bing
School of Energy and Power Engineering, Xi’an Jiaotong University
Abstract: In response to the challenges of exponential growth in software complexity and frequent vulnerability in vehicle electronic control units (ECUs), coupled with the inefficiencies and cost challenges associated with traditional physical disassembly-dependent flashing methods utilizing proprietary protocols, this study proposes a standardized CAN bus based Bootloader solution which is implemented on the NXP S32K144 microcontroller with adherence to UDS protocol specifications (ISO 14229-1 and ISO 15765-2). The developed framework incorporates critical UDS application layer services and transport layer packet segmentation mechanisms to establish a comprehensive three-phase firmware update process encompassing pre-programming, programming, and post-programming phases. Through rigorous Flash partitioning architecture, hardware-based protection mechanisms, and cyclic redundancy check (CRC) verification protocols, the system ensures robust boot reliability and secure update operations. Based on this, a self-developed Delphi-based client tool was designed and extensive Bootloader programming testing was conducted. Experimental results demonstrate the solution's capacity for efficient and reliable ECU software updates, exhibiting exceptional robustness and reliable recovery capabilities even under adverse conditions including power interruptions and CAN communication failures. This implementation establishes a standardized and highly reliable software update and upgrade framework for automotive critical ECUs, providing fundamental technical bases for future ECU software development, optimization, calibration, and upgrade. The proposed methodology also offers a comprehensive engineering reference for software upgrade development of similar ECUs.
Key words : UDS protocol;Bootloader;CAN bus;S32K144;ECU

引言

随着“软件定义汽车”(Software Defined Vehicle, SDV)理念成为行业共识,汽车功能的迭代、性能优化及安全漏洞修复日益依赖于高效、可靠的软件在线升级能力[1]。在此背景下,电子控制单元(Electronic Control Unit, ECU)软件规模与复杂度呈爆发式增长,当前高端车型代码量已达数亿行,各类漏洞(如协议缺陷、加密漏洞、逻辑错误)难以避免[2-3]。因此,构建支持安全、高效的软件更新的底层机制,特别是标准化、鲁棒的Bootloader,已成为实现SDV愿景的关键基石。

传统的ECU软件更新依赖物理拆卸与专用设备进行离线烧录,存在耗时长、成本高昂、操作繁琐且对人员专业性要求高等显著弊端[4]。早期厂商ECU软件更新采用的私有化协议虽部分解决了专用设备依赖,却导致不同ECU需配套独立的客户端工具,大幅增加了整车厂供应链管理复杂度与工具开发成本。

为系统化解决上述痛点,基于统一诊断服务(Unified Diagnostic Services, UDS)协议的Bootloader应运而生。UDS作为汽车电子领域广泛应用的标准诊断协议,其定义的安全访问(Security Access)、数据传输(Data Transfer)、例程控制(Routine Control)等服务,为Bootloader提供了跨平台、跨供应商的标准化安全校验与数据写入机制。这不仅显著降低了开发与维护成本,也为后续远程升级奠定了基础[5-6]。

而随着汽车智能化与网联化的飞速发展,空中下载(Over The Air, OTA)技术已成为信息娱乐系统(In-Vehicle Infotainment, IVI)及高级驾驶辅助系统(Advanced Driving Assistance System, ADAS)软件更新的重要手段[7-8]。然而,对于实时性、安全性要求极高的动力系统、底盘系统等关键ECU,控制器局域网络(Controller Area Network, CAN)总线仍是主流通信方式[9],其底层Bootloader的安全性与可靠性是支撑更高层级OTA功能的核心前提。尽管UDS Bootloader的理念已较为成熟,但在主流微控制器(MCU)平台(如广泛应用的ARM Cortex-M系列)上,实现兼顾严格安全要求、强鲁棒性与资源高效利用的详细工程方案,公开文献或开源参考数量仍显不足。

因此,本研究选择基于ARM Cortex-M4内核的NXP S32K144 MCU作为硬件平台,以S32 Design Studio为集成开发环境,依据ISO 14229-1及ISO 15765-2等协议标准,设计并实现了一套完整的Bootloader程序。进而,在Windows平台下自主开发了配套的客户端刷写工具,并进行了详尽的刷写流程验证,旨在提供一个经过充分工程实践检验、可复用的参考实现。


本文详细内容请下载:

https://www.chinaaet.com/resource/share/2000007012


作者信息:

邹敏捷,刘帅,马闻铎,唐天宇,张佳淼,杨博,刘兵

(西安交通大学 能源与动力工程学院,陕西 西安 710049)

2.jpg

此内容为AET网站原创,未经授权禁止转载。