Фронты START/STOP обрабатываются при принятии командного слова CAN/RS, а окончание импульса обслуживается таймером. STOP имеет приоритет, перекрытие выходов исключено, сохранена защита от самопуска при включении. Загрузка параметров больше не подменяет живые команды нагрузки. Добавлены подробные русские комментарии во все собственные C-модули и основные заголовки, описание поведения и host-тест автомата. Обновлены файлы прошивки. Полная сборка TI 22.6.1.LTS и тесты пройдены; проверка на физической плате не выполнялась.
39 lines
1.8 KiB
Python
39 lines
1.8 KiB
Python
"""Host test of the 166 START/STOP controller. Requires Clang/lld or MSVC (Windows).
|
|
|
|
Example: py -3 tests/ump_pulse/run_test.py --compiler "C:/path/to/cl.exe"
|
|
All build products are written to a temporary directory.
|
|
"""
|
|
import argparse
|
|
import os
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
import tempfile
|
|
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('--compiler', default=shutil.which('clang') or shutil.which('cl'))
|
|
args = parser.parse_args()
|
|
if not args.compiler:
|
|
parser.error('Provide --compiler pointing to clang.exe or cl.exe')
|
|
root = Path(__file__).resolve().parents[2]
|
|
with tempfile.TemporaryDirectory(prefix='ump-recorder-') as directory:
|
|
output = Path(directory)
|
|
library = output / 'recorder_test.dll'
|
|
includes = [root / 'Source/Internal/Include']
|
|
source = root / 'tests/ump_pulse/control_test.c'
|
|
if Path(args.compiler).stem.lower() == 'cl':
|
|
command = [args.compiler, '/nologo', '/LD', '/GS-', '/wd4068', '/wd4312',
|
|
*['/I' + str(p) for p in includes], str(source),
|
|
'/Fo' + str(output / 'recorder.obj'), '/link', '/NOENTRY',
|
|
'/NODEFAULTLIB', '/OUT:' + str(library)]
|
|
else:
|
|
command = [args.compiler, '-shared', '-nostdlib', '-fuse-ld=lld',
|
|
'-Wl,/noentry,/nodefaultlib', '-Wno-unknown-pragmas',
|
|
'-Wno-int-to-pointer-cast', *['-I' + str(p) for p in includes],
|
|
str(source), '-o', str(library)]
|
|
subprocess.run(command, cwd=output, check=True)
|
|
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)
|