Software APIs
support.c
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #include <stddef.h>
6 
10 #include "sw/device/lib/testing/test_framework/check.h"
11 #include "sw/device/lib/testing/test_framework/status.h"
12 
14 
15 // These symbopls are provided by the riscv-compliance libraries.
16 extern void run_rvc_test(void);
17 extern volatile uint32_t begin_signature[];
18 extern volatile uint32_t end_signature[];
19 
20 static dif_uart_t uart0;
21 
22 int opentitan_compliance_main(int argc, char **argv) {
23  CHECK_DIF_OK(dif_uart_init(
25  CHECK_DIF_OK(
27  .baudrate = kUartBaudrate,
28  .clk_freq_hz = kClockFreqPeripheralHz,
29  .parity_enable = kDifToggleDisabled,
30  .parity = kDifUartParityEven,
31  .tx_enable = kDifToggleEnabled,
32  .rx_enable = kDifToggleEnabled,
33  }));
34  base_uart_stdout(&uart0);
35 
36  run_rvc_test();
37 
38  ptrdiff_t size = end_signature - begin_signature;
39  for (int i = 0; i < size; ++i) {
40  base_printf("SIG: %08x\r\n", begin_signature[i]);
41  }
42 
43  // Above values are checked for correctness externally post-simulation.
44  test_status_set(kTestStatusPassed);
45 
46  // Unreachable code.
47  return 0;
48 }