Expose the existing registers through Modbus and service CAN using one GAS provider only in M95M02 builds. Include the EEPROM layout/driver, LOAD protection and calibration, firmware identity and shared CCS build workflow. Add transport/profile and SCI8 validation tests, documentation and the checked M95M02 firmware image.
42 lines
2.2 KiB
Python
42 lines
2.2 KiB
Python
"""Сборка и запуск исходного регистратора с подменой GPIO/IRQ на Windows.
|
|
|
|
Нужны GCC либо Clang и lld-link в PATH. TEMPLATES_ROOT задаёт библиотеку. Проверяется алгоритм, но не ABI и тайминги TI.
|
|
DLL создаётся во временной папке; исходные .out/.hex прошивки не затрагиваются.
|
|
"""
|
|
import ctypes
|
|
import os
|
|
from pathlib import Path
|
|
import subprocess
|
|
import shutil
|
|
import tempfile
|
|
|
|
root = Path(__file__).resolve().parents[2]
|
|
templates = Path(os.environ.get('TEMPLATES_ROOT', root.parent / 'newProject/SETGUI/third_party/templates'))
|
|
protocol = templates / 'c/set-protocol'
|
|
compiler = os.environ.get('CC') or shutil.which('clang') or shutil.which('gcc')
|
|
if not compiler:
|
|
raise SystemExit('Clang or GCC is required in PATH')
|
|
link_flags = [] if 'gcc' in Path(compiler).name else ['-nostdlib', '-fuse-ld=lld', '-Wl,/noentry,/nodefaultlib']
|
|
with tempfile.TemporaryDirectory(prefix='ump-recorder-') as directory:
|
|
# Exercise the production identity binding too, using a build-local header.
|
|
subprocess.run([
|
|
os.sys.executable, str(root / 'UKSSTMS320F28335/prepare_identity.py'),
|
|
'--project', str(root / 'UKSSTMS320F28335'), '--templates', str(templates),
|
|
'--output', directory,
|
|
], check=True)
|
|
library = Path(directory) / 'recorder_test.dll'
|
|
subprocess.run([
|
|
compiler, '-shared', *link_flags, '-Wno-unknown-pragmas', '-Wno-int-to-pointer-cast',
|
|
'-Itests/ump_logger/stubs', '-ISource/Internal/Include',
|
|
'-I' + str(protocol), '-I' + str(protocol / 'ports/tms320f28335'),
|
|
'-I' + str(templates / 'c/firmware-info/include'), '-I' + directory,
|
|
'tests/ump_logger/recorder_test.c', 'Source/Internal/shared_ump.c', '-o', str(library),
|
|
], cwd=root, check=True)
|
|
# Отдельный процесс освобождает DLL до удаления временной папки Windows.
|
|
subprocess.run([
|
|
os.sys.executable, '-c',
|
|
'import ctypes,sys; r=ctypes.CDLL(sys.argv[1]).run_tests(); '
|
|
'print("PASS" if r==0 else f"FAIL: C line {r}"); sys.exit(bool(r))',
|
|
str(library),
|
|
], check=True)
|