94 lines
3.2 KiB
Makefile
94 lines
3.2 KiB
Makefile
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
# Copyright (C) 2026 David (Corey) Herrera
|
|
# Foundry Blackhole backend — the USERSPACE DRIVER's NoC TRANSPORT, on the card.
|
|
#
|
|
# make -f Makefile.udrvnoc red full rebuild; run nothing
|
|
# sudo ./build-udrvnoc/test_udrv_card_noc rungs 1-2 only, aims nothing
|
|
# sudo ./build-udrvnoc/test_udrv_card_noc write the whole thing
|
|
#
|
|
# THIS BINARY CAN TOUCH THE CARD, which is why it is not in `Makefile.udrv`:
|
|
# that file's whole claim is that its source list cannot reach a device, and a
|
|
# target here would quietly destroy it. It is separate from `Makefile.udrvcard`
|
|
# too, because this one links the tt-kmd BACKEND as well — the oracle transport
|
|
# (ft_tt_read_l1 / ft_tt_read_dram) and the coordinate derivation come from
|
|
# there, and the whole method of the round is that the vendor path validates
|
|
# ours on real silicon before we trust it.
|
|
#
|
|
# `write` is required for anything that aims a window. A run started by muscle
|
|
# memory reads, compares both mappings, and stops.
|
|
#
|
|
# Root is required: /sys/bus/pci/devices/*/resource0 is 0600 root:root.
|
|
#
|
|
# `red` rebuilds from scratch every time — GNU make 3.81's one-second mtime
|
|
# granularity means an incremental mutation loop can be running the PREVIOUS
|
|
# binary (coding-best-practices.md §9).
|
|
|
|
CC ?= cc
|
|
SRC_DIR := ..
|
|
|
|
# The on-card harness opens the card through the product transport seam.
|
|
include hardware_session_sources.mk
|
|
BUILD := build-udrvnoc
|
|
|
|
CFLAGS := -std=c99 -O1 -g \
|
|
-Wall -Wextra -Werror -pedantic \
|
|
-Wshadow -Wconversion -Wstrict-prototypes -Wformat=2 \
|
|
-fstack-protector-strong \
|
|
-I$(SRC_DIR) -I.
|
|
|
|
DEPFLAGS := -MMD -MP
|
|
|
|
# The oracle transport really has to reach the card, so the Phase 1b fence is open.
|
|
CFLAGS += -DFT_TT_PHASE1B_NOC_ENABLED
|
|
|
|
# The tt-kmd backend — the ORACLE half. Coordinates from live ARC telemetry,
|
|
# and ft_tt_read_l1 / ft_tt_read_dram as the independent readback path.
|
|
BACKEND := $(SRC_DIR)/ft_tt_kmd.c \
|
|
$(SRC_DIR)/ft_tt_arch.c \
|
|
$(SRC_DIR)/ft_tt_arch_blackhole.c \
|
|
$(SRC_DIR)/ft_tt_device.c \
|
|
$(SRC_DIR)/ft_tt_tlb.c \
|
|
$(SRC_DIR)/ft_tt_arc_telemetry.c \
|
|
$(SRC_DIR)/ft_tt_coord.c \
|
|
$(SRC_DIR)/ft_tt_noc.c \
|
|
$(SRC_DIR)/ft_tt_buffer.c \
|
|
$(SRC_DIR)/ft_tt_elf.c \
|
|
$(SRC_DIR)/ft_tt_kernel_blob.c \
|
|
$(SRC_DIR)/ft_tt_udrv_claim.c \
|
|
$(SRC_DIR)/ft_tt_tensix_claim.c \
|
|
$(SRC_DIR)/ft_tt_launch.c
|
|
|
|
# The userspace driver — the half under test.
|
|
UDRV := $(SRC_DIR)/ft_tt_udrv_pci_sysfs.c \
|
|
$(SRC_DIR)/ft_tt_udrv_tlb_encode.c \
|
|
$(SRC_DIR)/ft_tt_udrv_noc.c
|
|
|
|
SUPPORT := ft_tt_test_report.c $(HARDWARE_SESSION_SOURCES)
|
|
|
|
SOURCES := $(BACKEND) $(UDRV) $(SUPPORT) test_udrv_card_noc.c
|
|
OBJECTS := $(sort $(addprefix $(BUILD)/,$(notdir $(SOURCES:.c=.o))))
|
|
TARGET := $(BUILD)/test_udrv_card_noc
|
|
|
|
.PHONY: all red clean
|
|
|
|
all: $(TARGET)
|
|
|
|
$(BUILD):
|
|
mkdir -p $(BUILD)
|
|
|
|
$(BUILD)/%.o: $(SRC_DIR)/%.c | $(BUILD)
|
|
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
|
|
|
|
$(BUILD)/%.o: %.c | $(BUILD)
|
|
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
|
|
|
|
$(TARGET): $(OBJECTS)
|
|
$(CC) $(CFLAGS) $(OBJECTS) -o $@
|
|
|
|
red: clean $(TARGET)
|
|
|
|
clean:
|
|
rm -rf $(BUILD)
|
|
|
|
-include $(wildcard $(BUILD)/*.d)
|