blob: a6ad846537e9732852846d3f5da98e4be80329a9 [file] [log] [blame]
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
# Test status library.
sw_lib_testing_test_status = declare_dependency(
link_with: static_library(
'test_status_ot',
sources: ['status.c'],
dependencies: [
sw_lib_mmio,
sw_lib_runtime_log,
sw_lib_runtime_hart,
],
)
)
# NOP coverage dependencies when coverage is not enabled.
sw_lib_testing_test_coverage = declare_dependency(
link_with: static_library(
'test_coverage_none',
sources: [files('coverage_none.c')],
),
)
collect_coverage = declare_dependency()
if coverage
# Test coverage library that provides runtime functions for LLVM profiling.
sw_lib_testing_test_coverage = declare_dependency(
link_with: static_library(
'test_coverage_llvm',
include_directories: sw_vendor_llvm_clang_rt_inc_dir,
sources: [
sw_vendor_llvm_clang_rt_sources,
files('coverage_llvm.c'),
],
dependencies: [
sw_lib_mem,
sw_lib_dif_uart,
sw_lib_runtime_log,
],
),
)
# Dependency for enabling coverage
collect_coverage = declare_dependency(
compile_args: ['-fprofile-instr-generate', '-fcoverage-mapping'],
dependencies: sw_lib_testing_test_coverage,
)
endif
# OTTF linker parameters.
ottf_linker_script = '@0@/@1@'.format(meson.project_source_root(), files(['ottf.ld'])[0])
ottf_linker_args = [
# The linker script includes an autogenerated definition of the available
# memory regions. The include path is given relative to the source root, so we
# need to add the source root to the linker lookup path (which is the same for
# libraries and linker scripts).
'-Wl,-L,@0@'.format(meson.project_source_root()),
'-Wl,-T,@0@'.format(ottf_linker_script),
# Depending on the compiler and its configuration (*), |--build-id| is passed
# to the linker, causing the insertion of a ".note.gnu.build-id" section into
# the ELF file. We do not use the build ID. Achieve consistent behavior and
# potentially a small improvement in linking time by not computing the build
# ID in the first place.
#
# * GCC built with |--enable-linker-build-id|, clang before 3.9 or built with
# |-DENABLE_LINKER_BUILD_ID|.
'-Wl,--build-id=none',
]
# OTTF startup library. Every OpenTitan (RISC-V) test executable
# should depend on this target.
#
# The crt defines the interrupt vector, the symbols of which are defined in
# in `sw/device/lib/testing/test_framework/ottf_isrs.S`.
ottf_start_lib = declare_dependency(
# The following assembly files need to be included as a source, not a
# static library, so that their custom sections can be picked up when
# linking.
sources: [
'ottf_start.S',
'ottf_isrs.S',
],
link_args: ottf_linker_args,
dependencies: [
freestanding_headers,
sw_lib_crt,
sw_lib_mem,
sw_lib_runtime_hart,
sw_lib_runtime_ibex,
sw_lib_runtime_log,
],
link_with: static_library(
'ottf_start_lib',
sources: [
'ottf_isrs.c',
],
link_depends: [ottf_linker_script],
)
)
# OpenTitan Test Framework (OTTF)
freertos_root = '@0@/@1@'.format(meson.project_source_root(), 'sw/vendor/freertos_freertos_kernel')
freertos_memmang_path = '@0@/@1@'.format(freertos_root, 'portable/MemMang')
freertos_portable_path = '@0@/@1@'.format(freertos_root, 'portable/GCC/RISC-V')
ottf_incdirs = include_directories(
'../../../../vendor/freertos_freertos_kernel/include',
'../../../../vendor/freertos_freertos_kernel/portable/GCC/RISC-V')
ottf_lib = declare_dependency(
link_with: static_library(
'ottf_lib',
sources: [
'ottf_main.c',
'freertos_hooks.c',
'freertos_port.S',
'freertos_port.c',
join_paths(freertos_root ,'tasks.c'),
join_paths(freertos_root ,'queue.c'),
join_paths(freertos_root ,'list.c'),
join_paths(freertos_memmang_path,'heap_1.c'),
],
include_directories: ottf_incdirs,
c_args: [
'-D__riscv_float_abi_soft',
],
dependencies: [
ottf_start_lib,
sw_lib_irq,
sw_lib_mem,
sw_lib_dif_uart,
sw_lib_dif_rv_timer,
sw_lib_runtime_hart,
sw_lib_runtime_log,
sw_lib_runtime_print,
sw_lib_testing_test_status,
sw_lib_testing_test_coverage,
],
)
)