| // Copyright 2022 Google LLC. |
| // Copyright lowRISC contributors. |
| // Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| // SPDX-License-Identifier: Apache-2.0 |
| // |
| // Simple SMC program that prints over UART and confirms OTTF testing |
| // capabilities. |
| |
| #include "hw/top_matcha/sw/autogen/top_matcha.h" |
| #include "sw/device/lib/runtime/log.h" |
| #include "sw/device/lib/runtime/print.h" |
| #include "sw/device/lib/testing/test_framework/check.h" |
| #include "sw/device/lib/testing/test_framework/ottf_test_config.h" |
| #include "sw/device/lib/testing/test_framework/status.h" |
| #include "sw/device/lib/testing/test_framework/test_util.h" |
| |
| OTTF_DEFINE_TEST_CONFIG(); |
| |
| static dif_uart_t smc_uart; |
| |
| void _ottf_main(void) { |
| test_status_set(kTestStatusInTest); |
| |
| // Initialize the SMC UART to enable logging for non-DV simulation platforms. |
| if (kDeviceType != kDeviceSimDV) { |
| init_uart(TOP_MATCHA_SMC_UART_BASE_ADDR, &smc_uart); |
| } |
| |
| LOG_INFO("Hello from the SMC!"); |
| |
| // Note: passing a test in the SMC ends the simulation, even if the secure |
| // core is in the middle of a test. |
| test_status_set(kTestStatusPassed); |
| } |