| # Copyright Google LLC 2023 |
| # 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", |
| "ASIC_CORE_TARGETS", |
| "NEXUS_CORE_TARGETS", |
| "matcha_extflash_tar", |
| "sec_flash_binary", |
| "smc_flash_binary", |
| ) |
| |
| # At the moment, this is only set up to run on the fpga_nexus target. |
| sec_flash_binary( |
| name = "hps_demo", |
| srcs = [ |
| "hps_demo_sc.c", |
| ], |
| copts = [ |
| "-nostdlib", |
| "-ffreestanding", |
| ], |
| per_device_deps = { |
| "fpga_nexus": [NEXUS_CORE_TARGETS.get("secure_core")], |
| "asic": [ASIC_CORE_TARGETS.get("secure_core")], |
| }, |
| deps = [ |
| ":hps_demo_smc_h", |
| "//hw/top_matcha/ip/ml_top/data:ml_top_regs", |
| "//sw/device/lib/dif:rv_plic_sec", |
| "//sw/device/lib/dif:smc_ctrl", |
| "//sw/device/lib/dif:tlul_mailbox", |
| "//sw/device/lib/spi_to_host", |
| "//sw/device/tests:test_lib", |
| ], |
| ) |
| |
| smc_flash_binary( |
| name = "hps_demo_smc", |
| srcs = [ |
| "hps_demo_smc.c", |
| "//sw/device/examples/testdata:kelvin_model_ml_bin.h", |
| ], |
| copts = [ |
| "-nostdlib", |
| "-ffreestanding", |
| ], |
| per_device_deps = { |
| "fpga_nexus": [NEXUS_CORE_TARGETS.get("smc")], |
| "asic": [ASIC_CORE_TARGETS.get("smc")], |
| }, |
| deps = [ |
| "//hw/top_matcha/ip/ml_top/data:ml_top_regs", |
| "//sw/device/lib:camera_hm01b0", |
| "//sw/device/lib/dif:isp_wrapper", |
| "//sw/device/lib/dif:ml_top", |
| "//sw/device/lib/dif:rv_plic_smc", |
| "//sw/device/lib/spi_display", |
| "//sw/device/tests:test_lib_smc", |
| "@lowrisc_opentitan//sw/device/lib/dif:rv_timer", |
| ], |
| ) |
| |
| cc_library( |
| name = "hps_demo_smc_h", |
| hdrs = select({ |
| "//rules:sparrow_platform": [ |
| "hps_demo_smc_asic_bin_c.h", |
| ], |
| "//conditions:default": [ |
| "hps_demo_smc_fpga_nexus_bin_c.h", |
| ], |
| }), |
| ) |
| |
| matcha_extflash_tar( |
| name = "hps_demo_asic_extflash", |
| sc_binary = ":hps_demo_asic_bin", |
| ) |
| |
| matcha_extflash_tar( |
| name = "hps_demo_fpga_nexus_extflash", |
| sc_binary = ":hps_demo_fpga_nexus_bin", |
| ) |
| |