Adrian Danis | dbe802b | 2017-03-30 16:37:58 +1100 | [diff] [blame] | 1 | # |
| 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 | |
| 13 | cmake_minimum_required(VERSION 3.7.2) |
| 14 | |
| 15 | project(libsel4debug C ASM) |
| 16 | |
| 17 | set(configure_string "") |
| 18 | |
Kent McLeod | 11062d0 | 2019-04-16 07:50:03 +1000 | [diff] [blame] | 19 | config_string( |
| 20 | LibSel4DebugAllocBufferEntries |
| 21 | LIBSEL4DEBUG_ALLOC_BUFFER_ENTRIES |
Adrian Danis | dbe802b | 2017-03-30 16:37:58 +1100 | [diff] [blame] | 22 | "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 McLeod | 11062d0 | 2019-04-16 07:50:03 +1000 | [diff] [blame] | 27 | DEFAULT |
| 28 | 0 |
Adrian Danis | dbe802b | 2017-03-30 16:37:58 +1100 | [diff] [blame] | 29 | UNQUOTE |
| 30 | ) |
| 31 | |
Kent McLeod | 11062d0 | 2019-04-16 07:50:03 +1000 | [diff] [blame] | 32 | config_choice( |
| 33 | LibSel4DebugFunctionInstrumentation |
| 34 | LIB_SEL4_DEBUG_FUNCTION_INSTRUMENTAITON |
Adrian Danis | dbe802b | 2017-03-30 16:37:58 +1100 | [diff] [blame] | 35 | "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 Ye | 878ad37 | 2018-12-06 16:15:13 +1100 | [diff] [blame] | 54 | "backtrace;LibSel4DebugFunctionInstrumentationBacktrace;LIBSEL4DEBUG_FUNCTION_INSTRUMENTATION_BACKTRACE" |
Adrian Danis | dbe802b | 2017-03-30 16:37:58 +1100 | [diff] [blame] | 55 | ) |
Kent McLeod | 6b2bbe6 | 2019-04-16 07:51:44 +1000 | [diff] [blame] | 56 | mark_as_advanced(LibSel4DebugAllocBufferEntries LibSel4DebugFunctionInstrumentation) |
Adrian Danis | dbe802b | 2017-03-30 16:37:58 +1100 | [diff] [blame] | 57 | add_config_library(sel4debug "${configure_string}") |
| 58 | |
Kent McLeod | 11062d0 | 2019-04-16 07:50:03 +1000 | [diff] [blame] | 59 | file( |
| 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 Danis | dbe802b | 2017-03-30 16:37:58 +1100 | [diff] [blame] | 67 | |
| 68 | list(SORT deps) |
| 69 | |
| 70 | add_library(sel4debug STATIC EXCLUDE_FROM_ALL ${deps}) |
Kent McLeod | 11062d0 | 2019-04-16 07:50:03 +1000 | [diff] [blame] | 71 | target_include_directories( |
| 72 | sel4debug |
Yu Hou | e9a9ff4 | 2019-07-18 17:26:01 +1000 | [diff] [blame] | 73 | PUBLIC include "arch_include/${KernelArch}" sel4_arch_include/${KernelSel4Arch} |
Kent McLeod | 11062d0 | 2019-04-16 07:50:03 +1000 | [diff] [blame] | 74 | ) |
Yu Hou | c18523b | 2019-07-19 03:01:28 +1000 | [diff] [blame] | 75 | target_link_libraries(sel4debug PUBLIC muslc sel4 utils PRIVATE sel4debug_Config sel4_autoconf) |