pyxcp 0.23.4__tar.gz → 0.23.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyxcp might be problematic. Click here for more details.

Files changed (125) hide show
  1. pyxcp-0.23.7/PKG-INFO +339 -0
  2. {pyxcp-0.23.4 → pyxcp-0.23.7}/build_ext.py +160 -157
  3. pyxcp-0.23.7/docs/README.rst +300 -0
  4. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyproject.toml +2 -2
  5. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/__init__.py +1 -1
  6. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/cmdline.py +1 -1
  7. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/config/__init__.py +74 -20
  8. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/daq_stim/__init__.py +61 -1
  9. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/run_daq.py +1 -1
  10. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/master/errorhandler.py +116 -11
  11. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/master/master.py +18 -1
  12. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/__init__.py +3 -6
  13. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/unfolder.hpp +67 -55
  14. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/wrap.cpp +0 -6
  15. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/transport/base.py +144 -6
  16. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/transport/can.py +59 -6
  17. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/transport/eth.py +23 -5
  18. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/utils.py +2 -2
  19. pyxcp-0.23.4/PKG-INFO +0 -219
  20. pyxcp-0.23.4/README.md +0 -180
  21. {pyxcp-0.23.4 → pyxcp-0.23.7}/CMakeLists.txt +0 -0
  22. {pyxcp-0.23.4 → pyxcp-0.23.7}/LICENSE +0 -0
  23. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/aml/EtasCANMonitoring.a2l +0 -0
  24. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/aml/EtasCANMonitoring.aml +0 -0
  25. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/aml/XCP_Common.aml +0 -0
  26. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/aml/XCPonCAN.aml +0 -0
  27. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/aml/XCPonEth.aml +0 -0
  28. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/aml/XCPonFlx.aml +0 -0
  29. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/aml/XCPonSxI.aml +0 -0
  30. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/aml/XCPonUSB.aml +0 -0
  31. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/aml/ifdata_CAN.a2l +0 -0
  32. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/aml/ifdata_Eth.a2l +0 -0
  33. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/aml/ifdata_Flx.a2l +0 -0
  34. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/aml/ifdata_SxI.a2l +0 -0
  35. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/aml/ifdata_USB.a2l +0 -0
  36. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/asam/__init__.py +0 -0
  37. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/asam/types.py +0 -0
  38. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/asamkeydll.c +0 -0
  39. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/asamkeydll.sh +0 -0
  40. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/checksum.py +0 -0
  41. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/config/legacy.py +0 -0
  42. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/constants.py +0 -0
  43. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/cpp_ext/__init__.py +0 -0
  44. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/cpp_ext/bin.hpp +0 -0
  45. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/cpp_ext/blockmem.hpp +0 -0
  46. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/cpp_ext/daqlist.hpp +0 -0
  47. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/cpp_ext/event.hpp +0 -0
  48. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/cpp_ext/extension_wrapper.cpp +0 -0
  49. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/cpp_ext/helper.hpp +0 -0
  50. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/cpp_ext/mcobject.hpp +0 -0
  51. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/cpp_ext/tsqueue.hpp +0 -0
  52. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/daq_stim/optimize/__init__.py +0 -0
  53. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/daq_stim/optimize/binpacking.py +0 -0
  54. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/daq_stim/scheduler.cpp +0 -0
  55. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/daq_stim/scheduler.hpp +0 -0
  56. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/daq_stim/stim.cpp +0 -0
  57. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/daq_stim/stim.hpp +0 -0
  58. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/daq_stim/stim_wrapper.cpp +0 -0
  59. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/dllif.py +0 -0
  60. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/errormatrix.py +0 -0
  61. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/conf_can.toml +0 -0
  62. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/conf_can_user.toml +0 -0
  63. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/conf_can_vector.json +0 -0
  64. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/conf_can_vector.toml +0 -0
  65. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/conf_eth.toml +0 -0
  66. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/conf_nixnet.json +0 -0
  67. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/conf_socket_can.toml +0 -0
  68. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/conf_sxi.json +0 -0
  69. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/conf_sxi.toml +0 -0
  70. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/xcp_policy.py +0 -0
  71. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/xcp_read_benchmark.py +0 -0
  72. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/xcp_skel.py +0 -0
  73. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/xcp_unlock.py +0 -0
  74. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/xcp_user_supplied_driver.py +0 -0
  75. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/xcphello.py +0 -0
  76. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/examples/xcphello_recorder.py +0 -0
  77. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/master/__init__.py +0 -0
  78. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/py.typed +0 -0
  79. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/build_clang.cmd +0 -0
  80. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/build_clang.sh +0 -0
  81. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/build_gcc.cmd +0 -0
  82. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/build_gcc.sh +0 -0
  83. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/build_gcc_arm.sh +0 -0
  84. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/converter/__init__.py +0 -0
  85. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/lz4.c +0 -0
  86. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/lz4.h +0 -0
  87. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/lz4hc.c +0 -0
  88. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/lz4hc.h +0 -0
  89. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/mio.hpp +0 -0
  90. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/reader.hpp +0 -0
  91. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/reco.py +0 -0
  92. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/recorder.rst +0 -0
  93. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/rekorder.cpp +0 -0
  94. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/rekorder.hpp +0 -0
  95. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/setup.py +0 -0
  96. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/test_reko.py +0 -0
  97. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/recorder/writer.hpp +0 -0
  98. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/scripts/__init__.py +0 -0
  99. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/scripts/pyxcp_probe_can_drivers.py +0 -0
  100. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/scripts/xcp_examples.py +0 -0
  101. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/scripts/xcp_fetch_a2l.py +0 -0
  102. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/scripts/xcp_id_scanner.py +0 -0
  103. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/scripts/xcp_info.py +0 -0
  104. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/scripts/xcp_profile.py +0 -0
  105. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/scripts/xmraw_converter.py +0 -0
  106. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/stim/__init__.py +0 -0
  107. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/tests/test_asam_types.py +0 -0
  108. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/tests/test_binpacking.py +0 -0
  109. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/tests/test_can.py +0 -0
  110. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/tests/test_checksum.py +0 -0
  111. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/tests/test_daq.py +0 -0
  112. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/tests/test_daq_opt.py +0 -0
  113. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/tests/test_frame_padding.py +0 -0
  114. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/tests/test_master.py +0 -0
  115. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/tests/test_transport.py +0 -0
  116. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/tests/test_utils.py +0 -0
  117. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/timing.py +0 -0
  118. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/transport/__init__.py +0 -0
  119. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/transport/base_transport.hpp +0 -0
  120. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/transport/sxi.py +0 -0
  121. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/transport/transport_wrapper.cpp +0 -0
  122. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/transport/usb_transport.py +0 -0
  123. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/types.py +0 -0
  124. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/vector/__init__.py +0 -0
  125. {pyxcp-0.23.4 → pyxcp-0.23.7}/pyxcp/vector/map.py +0 -0
pyxcp-0.23.7/PKG-INFO ADDED
@@ -0,0 +1,339 @@
1
+ Metadata-Version: 2.3
2
+ Name: pyxcp
3
+ Version: 0.23.7
4
+ Summary: Universal Calibration Protocol for Python
5
+ License: LGPLv3
6
+ Keywords: automotive,ecu,xcp,asam,autosar
7
+ Author: Christoph Schueler
8
+ Author-email: cpu.gems@googlemail.com
9
+ Requires-Python: >=3.10,<4.0
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
13
+ Classifier: License :: Other/Proprietary License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Scientific/Engineering
21
+ Classifier: Topic :: Software Development
22
+ Requires-Dist: bandit (>=1.7.8,<2.0.0)
23
+ Requires-Dist: chardet (>=5.2.0,<6.0.0)
24
+ Requires-Dist: construct (>=2.10.68,<3.0.0)
25
+ Requires-Dist: line-profiler-pycharm (>=1.1.0,<2.0.0)
26
+ Requires-Dist: mako (>=1.2.4,<2.0.0)
27
+ Requires-Dist: pyserial (>=3.5,<4.0)
28
+ Requires-Dist: python-can (>=4.2.2,<5.0.0)
29
+ Requires-Dist: pytz (>=2025.2,<2026.0)
30
+ Requires-Dist: pyusb (>=1.2.1,<2.0.0)
31
+ Requires-Dist: rich (>=14.0.0,<15.0.0)
32
+ Requires-Dist: toml (>=0.10.2,<0.11.0)
33
+ Requires-Dist: tomlkit (>=0.13.3,<0.14.0)
34
+ Requires-Dist: traitlets (<=5.11.2)
35
+ Requires-Dist: uptime (>=3.0.1,<4.0.0)
36
+ Project-URL: Homepage, https://github.com/christoph2/pyxcp
37
+ Description-Content-Type: text/x-rst
38
+
39
+ Readme
40
+ ======
41
+
42
+ .. image:: pyxcp_social.jpg
43
+ :align: center
44
+
45
+ Reliable Python tooling for the ASAM MCD-1 XCP protocol (measurement,
46
+ calibration, flashing) with multiple transports (CAN, Ethernet, USB,
47
+ Serial) and handy CLI utilities.
48
+
49
+ |PyPI| |Python Versions| |License: LGPL v3+| |Code style: black|
50
+
51
+ ``pyXCP`` is a production-ready Python library for communicating with
52
+ XCP-enabled devices, most commonly automotive ECUs. Use it to take
53
+ measurements, adjust parameters (calibration), stream DAQ/STIM, and
54
+ program devices during development.
55
+
56
+ Highlights:
57
+
58
+ - Transports: Ethernet (TCP/IP), CAN, USB, Serial (SxI)
59
+ - Cross-platform: Windows, Linux, macOS
60
+ - Rich CLI tools for common XCP tasks
61
+ - Extensible architecture and layered design
62
+
63
+ --------------
64
+
65
+ Installation
66
+ ------------
67
+
68
+ The easiest way is from PyPI:
69
+
70
+ .. code:: shell
71
+
72
+ pip install pyxcp
73
+
74
+ To install from the main branch:
75
+
76
+ .. code:: shell
77
+
78
+ pip install git+https://github.com/christoph2/pyxcp.git
79
+
80
+ Requirements
81
+ ~~~~~~~~~~~~
82
+
83
+ - Python >= 3.10
84
+ - Building from source requires a working C/C++ toolchain (native
85
+ extensions are used for performance). Wheels are provided for common
86
+ platforms and Python versions; if a wheel is not available, pip will
87
+ build from source.
88
+ - An XCP slave device (or simulator)
89
+
90
+ Quick start
91
+ -----------
92
+
93
+ The tutorial walks you through typical tasks end-to-end: see `tutorial <tutorial.rst>`_.
94
+
95
+ Minimal example using the built-in argument parser and context manager:
96
+
97
+ .. code:: python
98
+
99
+ from pyxcp.cmdline import ArgumentParser
100
+
101
+ ap = ArgumentParser(description="pyXCP hello world")
102
+
103
+ with ap.run() as x:
104
+ x.connect()
105
+ identifier = x.identifier(0x01)
106
+ print(f"ID: {identifier!r}")
107
+ print(x.slaveProperties)
108
+ x.disconnect()
109
+
110
+ Configuration
111
+ ~~~~~~~~~~~~~
112
+
113
+ ``pyXCP`` supports a
114
+ `traitlets <https://github.com/ipython/traitlets>`__\-based configuration system.
115
+
116
+ - Recommended Python config example and generator: `tutorial <tutorial.rst>`__ and `configuration <configuration.rst>`__
117
+ - Legacy TOML examples remain available for compatibility.
118
+
119
+ Command‑line tools
120
+ ~~~~~~~~~~~~~~~~~~
121
+
122
+ Installed entry points (see pyproject.toml):
123
+
124
+ - xcp-info — print capabilities and properties
125
+ - xcp-id-scanner — scan for slave identifiers
126
+ - xcp-fetch-a2l — retrieve A2L from target (if supported)
127
+ - xcp-profile — generate/convert config files
128
+ - xcp-examples — launch assorted demos/examples
129
+ - xmraw-converter — convert recorder .xmraw data
130
+ - pyxcp-probe-can-drivers — list available CAN interfaces
131
+
132
+ Run any tool with -h for options.
133
+
134
+ Features
135
+ --------
136
+
137
+ - Multiple transport layers: Ethernet (TCP), CAN, USB, SxI (serial/UART)
138
+ - Data Acquisition (DAQ) and Stimulation (STIM)
139
+ - Calibration (read/write parameters)
140
+ - Flashing/programming workflows
141
+ - A2L (ASAM MCD‑2 MC) support
142
+ - Recorder utilities and converters (see `recorder <recorder.rst>`__)
143
+ - Extensible architecture for custom transports
144
+
145
+ Documentation
146
+ -------------
147
+
148
+ - Getting started tutorial: `tutorial <tutorial.rst>`__
149
+ - Configuration: `configuration <configuration.rst>`__
150
+ - CAN driver setup and troubleshooting: `howto_can_driver <howto_can_driver.rst>`__
151
+ - Recorder: `recorder <recorder.rst>`__
152
+ - Troubleshooting: `troubleshooting <troubleshooting.rst>`__
153
+ - Troubleshooting matrix (common errors, root causes, fixes):
154
+ `troubleshooting_matrix <troubleshooting_matrix.rst>`__
155
+
156
+ To build the Sphinx documentation locally:
157
+
158
+ 1. Install doc requirements:
159
+ ``pip install -r docs/requirements.txt``
160
+ 2. Build:
161
+ ``sphinx-build -b html docs docs/_build/html``
162
+ 3. Open
163
+ ``docs/_build/html/index.html``
164
+
165
+ Compatibility
166
+ -------------
167
+
168
+ - Operating systems: Windows, Linux, macOS
169
+ - Python: 3.10 - 3.14, CPython wheels where available
170
+ - CAN backends: python-can compatible drivers (see `howto_can_driver <howto_can_driver.rst>`__)
171
+
172
+ Contributing
173
+ ------------
174
+
175
+ Contributions are welcome! Please: - Read `CODE_OF_CONDUCT <../CODE_OF_CONDUCT.md>`__ - Open an
176
+ issue or discussion before large changes - Use
177
+ `pre-commit <https://github.com/pre-commit/pre-commit>`__ to run linters
178
+ and tests locally
179
+
180
+ License
181
+ -------
182
+
183
+ GNU Lesser General Public License v3 or later (LGPLv3+). See LICENSE for
184
+ details.
185
+
186
+ References
187
+ ----------
188
+
189
+ - ASAM MCD‑1 XCP standard:
190
+ https://www.asam.net/standards/detail/mcd-1-xcp/
191
+
192
+ About ASAM MCD‑1 XCP
193
+ --------------------
194
+
195
+ XCP (Universal Measurement and Calibration Protocol) is an ASAM standard
196
+ defining a vendor‑neutral protocol to access internal data of electronic
197
+ control units (ECUs) for measurement, calibration (parameter tuning),
198
+ and programming. XCP decouples the protocol from the physical transport,
199
+ so the same command set can be carried over different buses such as CAN,
200
+ FlexRay, Ethernet, USB, or Serial.
201
+
202
+ - Roles: An XCP Master (this library) communicates with an XCP Slave
203
+ (your device/ECU or simulator).
204
+ - Layered concept: XCP defines an application layer and transport
205
+ layers. ``pyXCP`` implements the application layer and multiple transport
206
+ bindings.
207
+ - Use cases:
208
+
209
+ - Measurement: Read variables from the ECU in real‑time, including
210
+ high‑rate DAQ streaming.
211
+ - Calibration: Read/write parameters (calibration data) in RAM/flash.
212
+ - Programming: Download new program/data to flash (where the slave
213
+ supports it).
214
+
215
+ For the authoritative description, see the ASAM page:
216
+ https://www.asam.net/standards/detail/mcd-1-xcp/
217
+
218
+ XCP in a nutshell
219
+ -----------------
220
+
221
+ - Connect/Session: The master establishes a connection, negotiates
222
+ capabilities/features, and optionally unlocks protected functions via
223
+ seed & key.
224
+ - Addressing: Memory is accessed via absolute or segment‑relative
225
+ addresses. Addressing modes are described in the associated A2L file
226
+ (ASAM MCD‑2 MC), which maps symbolic names to addresses, data types,
227
+ and conversion rules.
228
+ - Events: The slave exposes events (e.g., “1 ms task”, “Combustion
229
+ cycle”), which trigger DAQ sampling. The master assigns signals (ODTs)
230
+ to these events for time‑aligned acquisition.
231
+ - DAQ/STIM: DAQ = Data Acquisition (slave → master), STIM = Stimulation
232
+ (master → slave). Both use event‑driven lists for deterministic
233
+ timing.
234
+ - Timestamps: DAQ may carry timestamps from the slave for precise time
235
+ correlation.
236
+ - Security: Access to sensitive commands (e.g., programming,
237
+ calibration) can be protected by a seed & key algorithm negotiated at
238
+ runtime.
239
+ - Checksums: XCP defines checksum services useful for verifying memory
240
+ regions (e.g., after flashing).
241
+
242
+ Relation to A2L (ASAM MCD‑2 MC)
243
+ -------------------------------
244
+
245
+ While XCP defines the protocol, the A2L file describes the measurement
246
+ and calibration objects (characteristics, measurements), data types,
247
+ conversion rules, and memory layout. In practice, you use ``pyXCP`` together
248
+ with an A2L to: - Resolve symbolic names to addresses and data types. -
249
+ Configure DAQ lists from human‑readable signal names. - Interpret raw
250
+ values using the appropriate conversion methods.
251
+
252
+ ``pyXCP`` provides utilities to fetch A2L data when supported by the slave
253
+ and to work with A2L‑described objects. See also
254
+ `pya2ldb <https://github.com/christoph2/pya2l>`__!
255
+
256
+ Transports and addressing
257
+ -------------------------
258
+
259
+ XCP is transport‑agnostic. ``pyXCP`` supports multiple transports and
260
+ addressing schemes: - CAN (XCP on CAN): Robust and ubiquitous in
261
+ vehicles; limited payload and bandwidth; suited for many calibration
262
+ tasks and moderate DAQ rates. - Ethernet (XCP on TCP/UDP): High
263
+ bandwidth with low latency; well suited for rich DAQ and programming
264
+ workflows. - USB: High throughput for lab setups; requires device
265
+ support. - Serial/SxI: Simple point‑to‑point links for embedded targets
266
+ and simulators.
267
+
268
+ The exact capabilities (e.g., max CTO/DTO, checksum types, timestamping)
269
+ are negotiated at connect time and depend on the slave and transport.
270
+
271
+ Supported features (overview)
272
+ -----------------------------
273
+
274
+ The scope of features depends on the connected slave. At the library
275
+ level, ``pyXCP`` provides: - Session management: CONNECT/DISCONNECT,
276
+ GET_STATUS/SLAVE_PROPERTIES, communication mode setup, error handling. -
277
+ Memory access: Upload/short upload, Download/Download Next,
278
+ verifications, optional paged memory where supported. - DAQ/STIM:
279
+ Configuration of DAQ lists/ODTs, event assignment, data streaming,
280
+ timestamp handling when available. - Programming helpers: Building
281
+ blocks for program/erase/write flows (exact sequence per slave’s flash
282
+ algorithm and A2L description). - Security/Seed & Key: Pluggable
283
+ seed‑to‑key resolution including 32↔64‑bit bridge on Windows. -
284
+ Utilities: Identifier scanning, A2L helpers, recorder and converters.
285
+
286
+ Refer to `tutorial <tutorial.rst>`__ and `configuration <configuration.rst>`__ for feature usage,
287
+ and xcp-info for a capability dump of your target.
288
+
289
+ Compliance and versions
290
+ -----------------------
291
+
292
+ ``pyXCP`` aims to be compatible with commonly used parts of ASAM MCD‑1 XCP.
293
+ Specific optional features are enabled when a slave advertises them
294
+ during CONNECT. Because implementations vary across vendors and ECU
295
+ projects, always consult your A2L and use xcp-info to confirm negotiated
296
+ options (e.g., checksum type, timestamp unit, max DTO size, address
297
+ granularity).
298
+
299
+ If you rely on a particular XCP feature/profile not mentioned here,
300
+ please open an issue with details about your slave and A2L so we can
301
+ clarify support and—if feasible—add coverage.
302
+
303
+ Safety, performance, and limitations
304
+ ------------------------------------
305
+
306
+ - Safety‑critical systems: XCP is a development and testing protocol. Do
307
+ not enable measurement/calibration on safety‑critical systems in the
308
+ field unless your system‑level safety case covers it.
309
+ - Performance: Achievable DAQ rates depend on transport bandwidth, ECU
310
+ event rates, DTO sizes, and host processing. Ethernet typically yields
311
+ the highest throughput.
312
+ - Latency/jitter: Event scheduling in the slave and OS scheduling on the
313
+ host can affect determinism. Use timestamps to correlate data
314
+ precisely.
315
+ - Access control: Seed & key protects sensitive functions; your
316
+ organization’s policy should govern algorithm distribution and access.
317
+
318
+ Further resources
319
+ -----------------
320
+
321
+ - ASAM MCD‑1 XCP standard (overview and membership):
322
+ https://www.asam.net/standards/detail/mcd-1-xcp/
323
+ - ASAM MCD‑2 MC (A2L) for object descriptions:
324
+ https://www.asam.net/standards/detail/mcd-2-mc/
325
+ - Introduction to DAQ/STIM concepts (ASAM publications and vendor docs)
326
+ - Related: CCP (legacy predecessor to XCP), ASAM MDF for measurement
327
+ data storage
328
+
329
+ .. |CI| image:: https://github.com/christoph2/pyxcp/workflows/Python%20application/badge.svg
330
+ :target: https://github.com/christoph2/pyxcp/actions
331
+ .. |PyPI| image:: https://img.shields.io/pypi/v/pyxcp.svg
332
+ :target: https://pypi.org/project/pyxcp/
333
+ .. |Python Versions| image:: https://img.shields.io/pypi/pyversions/pyxcp.svg
334
+ :target: https://pypi.org/project/pyxcp/
335
+ .. |License: LGPL v3+| image:: https://img.shields.io/badge/License-LGPL%20v3%2B-blue.svg
336
+ :target: https://www.gnu.org/licenses/lgpl-3.0
337
+ .. |Code style: black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
338
+ :target: https://github.com/psf/black
339
+
@@ -1,157 +1,160 @@
1
- #!/usr/bin/env python
2
-
3
- import multiprocessing as mp
4
- import os
5
- import platform
6
- import re
7
- import subprocess # nosec
8
- import sys
9
- import sysconfig
10
- from pathlib import Path
11
- from tempfile import TemporaryDirectory
12
-
13
-
14
- TOP_DIR = Path(__file__).parent
15
-
16
- print("Platform", platform.system())
17
- uname = platform.uname()
18
- if uname.system == "Darwin":
19
- os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.13"
20
-
21
- VARS = sysconfig.get_config_vars()
22
-
23
-
24
- def get_python_base() -> str:
25
- # Applies in this form only to Windows.
26
- if "base" in VARS and VARS["base"]:
27
- return VARS["base"]
28
- if "installed_base" in VARS and VARS["installed_base"]:
29
- return VARS["installed_base"]
30
-
31
-
32
- def alternate_libdir(pth: str):
33
- base = Path(pth).parent
34
- libdir = Path(base) / "libs"
35
- if libdir.exists():
36
- # available_libs = os.listdir(libdir)
37
- return str(libdir)
38
- else:
39
- return ""
40
-
41
-
42
- def get_py_config() -> dict:
43
- pynd = VARS["py_version_nodot"] # Should always be present.
44
- include = sysconfig.get_path("include") # Seems to be cross-platform.
45
- if uname.system == "Windows":
46
- base = get_python_base()
47
- library = f"python{pynd}.lib"
48
- libdir = Path(base) / "libs"
49
- if libdir.exists():
50
- available_libs = os.listdir(libdir)
51
- if library in available_libs:
52
- libdir = str(libdir)
53
- else:
54
- libdir = ""
55
- else:
56
- libdir = alternate_libdir(include)
57
- else:
58
- library = VARS["LIBRARY"]
59
- DIR_VARS = ("LIBDIR", "BINLIBDEST", "DESTLIB", "LIBDEST", "MACHDESTLIB", "DESTSHARED", "LIBPL")
60
- arch = None
61
- if uname.system == "Linux":
62
- arch = VARS.get("MULTIARCH", "")
63
- found = False
64
- for dir_var in DIR_VARS:
65
- if found:
66
- break
67
- dir_name = VARS.get(dir_var)
68
- if not dir_name:
69
- continue
70
- if uname.system == "Darwin":
71
- full_path = [Path(dir_name) / library]
72
- elif uname.system == "Linux":
73
- full_path = [Path(dir_name) / arch / library, Path(dir_name) / library]
74
- else:
75
- print("PF?", uname.system)
76
- for fp in full_path:
77
- print(f"Trying '{fp}'")
78
- if fp.exists():
79
- print(f"found Python library: '{fp}'")
80
- libdir = str(fp.parent)
81
- found = True
82
- break
83
- if not found:
84
- print("Could NOT locate Python library.")
85
- return dict(exe=sys.executable, include=include, libdir="", library=library)
86
- return dict(exe=sys.executable, include=include, libdir=libdir, library=library)
87
-
88
-
89
- def banner(msg: str) -> None:
90
- print("=" * 80)
91
- print(str.center(msg, 80))
92
- print("=" * 80)
93
-
94
-
95
- def get_env_int(name: str, default: int = 0) -> int:
96
- return int(os.environ.get(name, default))
97
-
98
-
99
- def get_env_bool(name: str, default: int = 0) -> bool:
100
- return get_env_int(name, default)
101
-
102
-
103
- def build_extension(debug: bool = False, use_temp_dir: bool = False) -> None:
104
- print("build_ext::build_extension()")
105
-
106
- use_temp_dir = use_temp_dir or get_env_bool("BUILD_TEMP")
107
- debug = debug or get_env_bool("BUILD_DEBUG")
108
-
109
- cfg = "Debug" if debug else "Release"
110
- print(f" BUILD-TYPE: {cfg!r}")
111
-
112
- py_cfg = get_py_config()
113
-
114
- cmake_args = [
115
- f"-DPython3_EXECUTABLE={py_cfg['exe']}",
116
- f"-DPython3_INCLUDE_DIR={py_cfg['include']}",
117
- f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm
118
- ]
119
- if py_cfg["libdir"]:
120
- cmake_args.append(f"-DPython3_LIBRARY={str(Path(py_cfg['libdir']) / Path(py_cfg['library']))}")
121
-
122
- build_args = ["--config Release", "--verbose"]
123
- # cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 /path/to/src
124
-
125
- if sys.platform.startswith("darwin"):
126
- # Cross-compile support for macOS - respect ARCHFLAGS if set
127
- archs = re.findall(r"-arch (\S+)", os.environ.get("ARCHFLAGS", ""))
128
- if archs:
129
- cmake_args += ["-DCMAKE_OSX_ARCHITECTURES={}".format(";".join(archs))]
130
-
131
- if use_temp_dir:
132
- build_temp = Path(TemporaryDirectory(suffix=".build-temp").name) / "extension_it_in"
133
- else:
134
- build_temp = Path(".")
135
- # print("cwd:", os.getcwd(), "build-dir:", build_temp, "top:", str(TOP_DIR))
136
- if not build_temp.exists():
137
- build_temp.mkdir(parents=True)
138
-
139
- banner("Step #1: Configure")
140
- # cmake_args += ["--debug-output"]
141
- subprocess.run(["cmake", "-S", str(TOP_DIR), *cmake_args], cwd=build_temp, check=True) # nosec
142
-
143
- cmake_args += [f"--parallel {mp.cpu_count()}"]
144
-
145
- banner("Step #2: Build")
146
- # build_args += ["-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"]
147
- subprocess.run(["cmake", "--build", str(build_temp), *build_args], cwd=TOP_DIR, check=True) # nosec
148
-
149
- banner("Step #3: Install")
150
- # subprocess.run(["cmake", "--install", "."], cwd=build_temp, check=True) # nosec
151
- subprocess.run(["cmake", "--install", build_temp], cwd=TOP_DIR, check=True) # nosec
152
-
153
-
154
- if __name__ == "__main__":
155
- includes = subprocess.getoutput("pybind11-config --cmakedir") # nosec
156
- os.environ["pybind11_DIR"] = includes
157
- build_extension(use_temp_dir=False)
1
+ #!/usr/bin/env python
2
+
3
+ import multiprocessing as mp
4
+ import os
5
+ import platform
6
+ import re
7
+ import subprocess # nosec
8
+ import sys
9
+ import sysconfig
10
+ from pathlib import Path
11
+ from tempfile import TemporaryDirectory
12
+
13
+
14
+ TOP_DIR = Path(__file__).parent
15
+
16
+ print("Platform", platform.system())
17
+ uname = platform.uname()
18
+ if uname.system == "Darwin":
19
+ os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.13"
20
+
21
+ VARS = sysconfig.get_config_vars()
22
+
23
+
24
+ def get_python_base() -> str:
25
+ # Applies in this form only to Windows.
26
+ if "base" in VARS and VARS["base"]:
27
+ return VARS["base"]
28
+ if "installed_base" in VARS and VARS["installed_base"]:
29
+ return VARS["installed_base"]
30
+
31
+
32
+ def alternate_libdir(pth: str):
33
+ base = Path(pth).parent
34
+ libdir = Path(base) / "libs"
35
+ if libdir.exists():
36
+ # available_libs = os.listdir(libdir)
37
+ return str(libdir)
38
+ else:
39
+ return ""
40
+
41
+
42
+ def get_py_config() -> dict:
43
+ pynd = VARS["py_version_nodot"] # Should always be present.
44
+ include = sysconfig.get_path("include") # Seems to be cross-platform.
45
+ if uname.system == "Windows":
46
+ base = get_python_base()
47
+ library = f"python{pynd}.lib"
48
+ libdir = Path(base) / "libs"
49
+ if libdir.exists():
50
+ available_libs = os.listdir(libdir)
51
+ if library in available_libs:
52
+ libdir = str(libdir)
53
+ else:
54
+ libdir = ""
55
+ else:
56
+ libdir = alternate_libdir(include)
57
+ else:
58
+ library = VARS["LIBRARY"]
59
+ DIR_VARS = ("LIBDIR", "BINLIBDEST", "DESTLIB", "LIBDEST", "MACHDESTLIB", "DESTSHARED", "LIBPL")
60
+ arch = None
61
+ if uname.system == "Linux":
62
+ arch = VARS.get("MULTIARCH", "")
63
+ found = False
64
+ for dir_var in DIR_VARS:
65
+ if found:
66
+ break
67
+ dir_name = VARS.get(dir_var)
68
+ if not dir_name:
69
+ continue
70
+ if uname.system == "Darwin":
71
+ full_path = [Path(dir_name) / library]
72
+ elif uname.system == "Linux":
73
+ full_path = [Path(dir_name) / arch / library, Path(dir_name) / library]
74
+ else:
75
+ print("PF?", uname.system)
76
+ for fp in full_path:
77
+ print(f"Trying '{fp}'")
78
+ if fp.exists():
79
+ print(f"found Python library: '{fp}'")
80
+ libdir = str(fp.parent)
81
+ found = True
82
+ break
83
+ if not found:
84
+ print("Could NOT locate Python library.")
85
+ return dict(exe=sys.executable, include=include, libdir="", library=library)
86
+ return dict(exe=sys.executable, include=include, libdir=libdir, library=library)
87
+
88
+
89
+ def banner(msg: str) -> None:
90
+ print("=" * 80)
91
+ print(str.center(msg, 80))
92
+ print("=" * 80)
93
+
94
+
95
+ def get_env_int(name: str, default: int = 0) -> int:
96
+ return int(os.environ.get(name, default))
97
+
98
+
99
+ def get_env_bool(name: str, default: int = 0) -> bool:
100
+ return get_env_int(name, default)
101
+
102
+
103
+ def build_extension(debug: bool = False, use_temp_dir: bool = False) -> None:
104
+ print("build_ext::build_extension()")
105
+
106
+ use_temp_dir = use_temp_dir or get_env_bool("BUILD_TEMP")
107
+ debug = debug or get_env_bool("BUILD_DEBUG")
108
+
109
+ cfg = "Debug" if debug else "Release"
110
+ bits, linkage = platform.architecture()
111
+ print(f"Bits: {bits!r} Linkage: {linkage!r} Build-Type: {cfg!r}")
112
+
113
+ if bits == "32bit" and linkage == "ELF":
114
+ cmake_args = []
115
+ else:
116
+ py_cfg = get_py_config()
117
+ cmake_args = [
118
+ f"-DPython3_EXECUTABLE={py_cfg['exe']}",
119
+ f"-DPython3_INCLUDE_DIR={py_cfg['include']}",
120
+ f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm
121
+ ]
122
+ if py_cfg["libdir"]:
123
+ cmake_args.append(f"-DPython3_LIBRARY={str(Path(py_cfg['libdir']) / Path(py_cfg['library']))}")
124
+
125
+ build_args = ["--config Release", "--verbose"]
126
+ # cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 /path/to/src
127
+
128
+ if sys.platform.startswith("darwin"):
129
+ # Cross-compile support for macOS - respect ARCHFLAGS if set
130
+ archs = re.findall(r"-arch (\S+)", os.environ.get("ARCHFLAGS", ""))
131
+ if archs:
132
+ cmake_args += ["-DCMAKE_OSX_ARCHITECTURES={}".format(";".join(archs))]
133
+
134
+ if use_temp_dir:
135
+ build_temp = Path(TemporaryDirectory(suffix=".build-temp").name) / "extension_it_in"
136
+ else:
137
+ build_temp = Path(".")
138
+ # print("cwd:", os.getcwd(), "build-dir:", build_temp, "top:", str(TOP_DIR))
139
+ if not build_temp.exists():
140
+ build_temp.mkdir(parents=True)
141
+
142
+ banner("Step #1: Configure")
143
+ # cmake_args += ["--debug-output"]
144
+ subprocess.run(["cmake", "-S", str(TOP_DIR), *cmake_args], cwd=build_temp, check=True) # nosec
145
+
146
+ cmake_args += [f"--parallel {mp.cpu_count()}"]
147
+
148
+ banner("Step #2: Build")
149
+ # build_args += ["-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"]
150
+ subprocess.run(["cmake", "--build", str(build_temp), *build_args], cwd=TOP_DIR, check=True) # nosec
151
+
152
+ banner("Step #3: Install")
153
+ # subprocess.run(["cmake", "--install", "."], cwd=build_temp, check=True) # nosec
154
+ subprocess.run(["cmake", "--install", build_temp], cwd=TOP_DIR, check=True) # nosec
155
+
156
+
157
+ if __name__ == "__main__":
158
+ includes = subprocess.getoutput("pybind11-config --cmakedir") # nosec
159
+ os.environ["pybind11_DIR"] = includes
160
+ build_extension(use_temp_dir=False)