mirror of
https://github.com/retroSoC/retroSoC.git
synced 2026-11-04 22:32:36 +00:00
- Introduced for handling QSPI flash memory operations, including command and address handling. - Added to interface with the C++ flash memory implementation, allowing for read operations via DPI-C. - Created for the flash memory implementation, supporting initialization, reading, and memory copying. - Updated to integrate the new QSPI Flash module and connect it with the existing system. - Refactored file paths in various filelists and scripts to accommodate the new directory structure under . - Enhanced the Python scripts for generating memory maps and preparing the environment for the new structure. - Adjusted test scripts to reflect changes in the directory structure and ensure compatibility with the new modules.
79 lines
2.2 KiB
Python
79 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Build and run host tests for deterministic SDK utilities."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
from pathlib import Path
|
|
|
|
|
|
TEST_SOURCES = (
|
|
"crt/arch/riscv/libgcc/clzsi2.c",
|
|
"crt/arch/riscv/libgcc/divdi3.c",
|
|
"crt/arch/riscv/libgcc/ffssi2.c",
|
|
"crt/arch/riscv/libgcc/udivdi3.c",
|
|
"crt/arch/riscv/libgcc/umoddi3.c",
|
|
"crt/src/lib/printf.c",
|
|
"crt/src/lib/stdlib.c",
|
|
"crt/src/lib/string.c",
|
|
"app/media/src/video_player.c",
|
|
"app/media/src/wav_audio.c",
|
|
"tests/c/test_runtime.c",
|
|
)
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("--root", type=Path, required=True)
|
|
parser.add_argument("--cc", default="clang")
|
|
args = parser.parse_args()
|
|
|
|
compiler = shutil.which(args.cc)
|
|
if compiler is None:
|
|
raise SystemExit(f"host C compiler not found: {args.cc}")
|
|
|
|
root = args.root.resolve()
|
|
with tempfile.TemporaryDirectory(prefix="retrosoc-c-tests-") as temporary_directory:
|
|
temporary_root = Path(temporary_directory)
|
|
memory_map_root = temporary_root / "memory_map"
|
|
subprocess.run(
|
|
[
|
|
sys.executable,
|
|
str(root / "rtl/mini/address_map/generate_memory_map.py"),
|
|
"--map",
|
|
str(root / "rtl/mini/address_map/memory_map.json"),
|
|
"--output-dir",
|
|
str(memory_map_root),
|
|
],
|
|
check=True,
|
|
)
|
|
executable = temporary_root / "runtime_tests"
|
|
command = [
|
|
compiler,
|
|
"-std=c11",
|
|
"-Wall",
|
|
"-Wextra",
|
|
"-Werror",
|
|
"-fno-builtin",
|
|
"-I",
|
|
str(memory_map_root / "include"),
|
|
"-I",
|
|
str(root / "crt/include"),
|
|
"-I",
|
|
str(root / "app/media/include"),
|
|
"-o",
|
|
str(executable),
|
|
*(str(root / source) for source in TEST_SOURCES),
|
|
]
|
|
subprocess.run(command, check=True)
|
|
subprocess.run([str(executable)], check=True)
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|