blob: 850cc5aad1cee4426721970ba1abf2c081444e7e [file] [log] [blame]
Adrian Danisdbe802b2017-03-30 16:37:58 +11001#
2# Copyright 2017, Data61
3# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4# ABN 41 687 119 230.
5#
6# This software may be distributed and modified according to the terms of
7# the BSD 2-Clause license. Note that NO WARRANTY is provided.
8# See "LICENSE_BSD2.txt" for details.
9#
10# @TAG(DATA61_BSD)
11#
12
13cmake_minimum_required(VERSION 3.7.2)
14
15project(libsel4debug C ASM)
16
17set(configure_string "")
18
Kent McLeod11062d02019-04-16 07:50:03 +100019config_string(
20 LibSel4DebugAllocBufferEntries
21 LIBSEL4DEBUG_ALLOC_BUFFER_ENTRIES
Adrian Danisdbe802b2017-03-30 16:37:58 +110022 "Pointer tracking buffer entries \
23 Size of buffer to use for tracking memory allocations within \
24 instrumentation. This setting has no effect if you are not using the \
25 allocation instrumentation. Setting this value to 0 disables pointer \
26 tracking."
Kent McLeod11062d02019-04-16 07:50:03 +100027 DEFAULT
28 0
Adrian Danisdbe802b2017-03-30 16:37:58 +110029 UNQUOTE
30)
31
Kent McLeod11062d02019-04-16 07:50:03 +100032config_choice(
33 LibSel4DebugFunctionInstrumentation
34 LIB_SEL4_DEBUG_FUNCTION_INSTRUMENTAITON
Adrian Danisdbe802b2017-03-30 16:37:58 +110035 "Function instrumentation to apply to function calls. This setting will only have \
36 an effect when your CFLAGS include -finstrument-functions, in which \
37 case __cyg_profile_func_enter will be called on every function entry \
38 and __cyg_profile_func_exit will be called on every function exit. The \
39 value of this setting determines the implementation of \
40 __cyg_profile_func_enter and __cyg_profile_func_exit supplied by this \
41 library. Regardless of the option you select, you can always override \
42 the implementation by providing your own in your application. \
43 none -> \
44 No implementation of __cyg_profile_func_enter and \
45 __cyg_profile_func_exit are provided. \
46 printf -> \
47 Print entry and exit of every function call. This option is useful for \
48 a very coarse and noisy description of what your code is doing. \
49 backtrace -> \
50 Track function calls for the purposes of a backtrace. You will need to \
51 enable this option if you want to retrieve programmatic backtraces."
52 "none;LibSel4DebugFunctionInstrumentationNone;LIBSEL4DEBUG_FUNCTION_INSTRUMENTATION_NONE"
53 "printf;LibSel4DebugFunctionInstrumentationPrintf;LIBSEL4DEBUG_FUNCTION_INSTRUMENTATION_TRACE"
James Ye878ad372018-12-06 16:15:13 +110054 "backtrace;LibSel4DebugFunctionInstrumentationBacktrace;LIBSEL4DEBUG_FUNCTION_INSTRUMENTATION_BACKTRACE"
Adrian Danisdbe802b2017-03-30 16:37:58 +110055)
Kent McLeod6b2bbe62019-04-16 07:51:44 +100056mark_as_advanced(LibSel4DebugAllocBufferEntries LibSel4DebugFunctionInstrumentation)
Adrian Danisdbe802b2017-03-30 16:37:58 +110057add_config_library(sel4debug "${configure_string}")
58
Kent McLeod11062d02019-04-16 07:50:03 +100059file(
60 GLOB
61 deps
62 src/*.c
63 src/sel4_arch/${KernelSel4Arch}/*.c
64 src/plat/${KernelPlatform}/*.c
65 src/sel4_arch/${KernelSel4Arch}/*.S
66)
Adrian Danisdbe802b2017-03-30 16:37:58 +110067
68list(SORT deps)
69
70add_library(sel4debug STATIC EXCLUDE_FROM_ALL ${deps})
Kent McLeod11062d02019-04-16 07:50:03 +100071target_include_directories(
72 sel4debug
Yu Houe9a9ff42019-07-18 17:26:01 +100073 PUBLIC include "arch_include/${KernelArch}" sel4_arch_include/${KernelSel4Arch}
Kent McLeod11062d02019-04-16 07:50:03 +100074)
Yu Houc18523b2019-07-19 03:01:28 +100075target_link_libraries(sel4debug PUBLIC muslc sel4 utils PRIVATE sel4debug_Config sel4_autoconf)