mirror of
https://github.com/retroSoC/retroSoC.git
synced 2026-11-04 22:32:36 +00:00
- Updated fault reference documentation to clarify Linux termination behavior and NPU-P6 requirements. - Enhanced Linux runtime section with emphasis on platform setup and kernel handoff processes. - Revised overview section to include detailed descriptions of NPU capabilities and memory configurations. - Improved product use documentation to specify Linux rootfs behavior and acceptance checkpoints. - Clarified reset summary to differentiate between Linux and smoke/NPU-P6 acceptance processes. - Updated software section to reflect changes in Linux image loading and readiness protocols. - Modified build scripts to support RV64 architecture and ensure proper ELF requirements. - Enhanced NPU compiler to support cycle counting for RV64 and RV32 architectures. - Added tests to validate new configurations and ensure compliance with updated publication contracts.
67 lines
2.0 KiB
Python
67 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""Build the minimal hart-1 smoke payload used by HP RTL simulation."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
try:
|
|
from scripts.hp_tools import require_rv64_elf
|
|
except ModuleNotFoundError:
|
|
from hp_tools import require_rv64_elf
|
|
|
|
|
|
def build(args: argparse.Namespace) -> None:
|
|
output = args.output.resolve()
|
|
images = output / "images"
|
|
images.mkdir(parents=True, exist_ok=True)
|
|
elf = output / "hp_smoke.elf"
|
|
compiler = f"{args.cross}gcc"
|
|
objcopy = f"{args.cross}objcopy"
|
|
command = [
|
|
compiler,
|
|
"-march=rv64imafdc_zicbom_zicsr_zifencei",
|
|
"-mabi=lp64d",
|
|
"-nostdlib",
|
|
"-nostartfiles",
|
|
"-ffreestanding",
|
|
"-O3",
|
|
"-Wall",
|
|
"-Wextra",
|
|
"-Werror=implicit-function-declaration",
|
|
"-Werror=return-type",
|
|
"-Wl,--build-id=none",
|
|
f"-Wl,-T,{args.linker.resolve()}",
|
|
"-o",
|
|
str(elf),
|
|
str(args.source.resolve()),
|
|
]
|
|
for include in args.include:
|
|
command.append(f"-I{include.resolve()}")
|
|
command.extend(str(source.resolve()) for source in args.extra_source)
|
|
command.extend(args.define)
|
|
subprocess.run(command, check=True)
|
|
require_rv64_elf(elf)
|
|
subprocess.run(
|
|
[objcopy, "-O", "binary", str(elf), str(images / "hp_smoke.bin")],
|
|
check=True,
|
|
)
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("--source", type=Path, required=True)
|
|
parser.add_argument("--linker", type=Path, required=True)
|
|
parser.add_argument("--output", type=Path, required=True)
|
|
parser.add_argument("--cross", default="riscv64-unknown-elf-")
|
|
parser.add_argument("--extra-source", type=Path, action="append", default=[])
|
|
parser.add_argument("--include", type=Path, action="append", default=[])
|
|
parser.add_argument("--define", action="append", default=[])
|
|
build(parser.parse_args())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|