blob: 6c69df8eb5e68df3390e6594aabd711c03f11004 [file] [log] [blame]
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
load("//rules:matcha.bzl", "OPENTITAN_CPU", "sec_flash_binary")
load("//rules:targets.bzl", "get_targets")
TARGETS = get_targets()
sec_flash_binary(
name = "hello_world",
srcs = [
"hello_world.c",
],
copts = [
"-nostdlib",
"-ffreestanding",
# Disable the date-time warning only for the hello world program.
"-Wno-date-time",
],
deps = [
":hello_world_lib",
],
)
cc_library(
name = "hello_world_lib",
target_compatible_with = [OPENTITAN_CPU],
deps = [
"//sw/device/lib/dif:pinmux",
"//sw/device/lib/testing:pinmux_testutils",
"//sw/device/lib/testing/test_framework:ottf_start",
"@lowrisc_opentitan//sw/device/examples:demos",
"@lowrisc_opentitan//sw/device/lib/base:mmio",
"@lowrisc_opentitan//sw/device/lib/crt",
"@lowrisc_opentitan//sw/device/lib/dif:gpio",
"@lowrisc_opentitan//sw/device/lib/dif:spi_device",
"@lowrisc_opentitan//sw/device/lib/dif:uart",
"@lowrisc_opentitan//sw/device/lib/runtime:hart",
"@lowrisc_opentitan//sw/device/lib/runtime:log",
"@lowrisc_opentitan//sw/device/lib/runtime:print",
"@lowrisc_opentitan//sw/device/lib/testing/test_framework:check",
"@lowrisc_opentitan//sw/device/lib/testing/test_framework:ottf_test_config",
"@lowrisc_opentitan//sw/device/silicon_creator/lib:manifest_def",
],
)
# Use shell test to run the interactive verilator test on UART and GPIO
[sh_test(
name = "{}_verilator_hello_world_test".format(target),
timeout = "long",
srcs = [":run_verilator_hello_world.sh"],
args = [
"$(location //hw:{}_verilator)".format(target),
"$(location //sw/device/lib/testing/test_rom:{}_test_rom_sim_verilator_scr_vmem)".format(target),
"$(location :hello_world_sim_verilator_vmem)",
"$(location //hw/top_{}/data:otp_img_rma)".format(target),
],
data = [
":hello_world_sim_verilator_vmem",
":hello_world_test_expected_gpio.txt",
"//hw:{}_verilator".format(target),
"//hw/top_{}/data:otp_img_rma".format(target),
"//sw/device/lib/testing/test_rom:{}_test_rom_sim_verilator_scr_vmem".format(target),
],
tags = [
"verilator",
],
visibility = ["//sw/device/tests:sw_device_test_group"],
) for target in TARGETS]
[sh_test(
name = "{}_verilator_hello_world_gpio_test".format(target),
timeout = "long",
srcs = [":run_verilator_hello_world.sh"],
args = [
"$(location //hw:{}_verilator)".format(target),
"$(location //sw/device/lib/testing/test_rom:{}_test_rom_sim_verilator_scr_vmem)".format(target),
"$(location :hello_world_sim_verilator_vmem)",
"$(location //hw/top_{}/data:otp_img_rma)".format(target),
"gpio_test",
],
data = [
":hello_world_sim_verilator_vmem",
"//hw:{}_verilator".format(target),
"//hw/top_{}/data:otp_img_rma".format(target),
"//sw/device/lib/testing/test_rom:{}_test_rom_sim_verilator_scr_vmem".format(target),
],
tags = [
"verilator",
],
) for target in TARGETS]