blob: b9b2189dde4c40d27a5105f46081918d7fb4ca02 [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")
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",
timeout = "long",
srcs = [":run_verilator_hello_world.sh"],
args = [
"$(location //hw:verilator)",
"$(location //sw/device/lib/testing/test_rom:test_rom_sim_verilator_scr_vmem)",
"$(location :hello_world_sim_verilator_vmem)",
"$(location //hw/top_matcha/data:otp_img_rma)",
],
data = [
":hello_world_sim_verilator_vmem",
":hello_world_test_expected_gpio.txt",
"//hw:verilator",
"//hw/top_matcha/data:otp_img_rma",
"//sw/device/lib/testing/test_rom:test_rom_sim_verilator_scr_vmem",
],
tags = [
"verilator",
],
visibility = ["//sw/device/tests:sw_device_test_group"],
)
sh_test(
name = "verilator_hello_world_gpio_test",
timeout = "long",
srcs = [":run_verilator_hello_world.sh"],
args = [
"$(location //hw:verilator)",
"$(location //sw/device/lib/testing/test_rom:test_rom_sim_verilator_scr_vmem)",
"$(location :hello_world_sim_verilator_vmem)",
"$(location //hw/top_matcha/data:otp_img_rma)",
"gpio_test",
],
data = [
":hello_world_sim_verilator_vmem",
"//hw:verilator",
"//hw/top_matcha/data:otp_img_rma",
"//sw/device/lib/testing/test_rom:test_rom_sim_verilator_scr_vmem",
],
tags = [
"verilator",
],
)