1# 2# Copyright 2018, 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(libsel4camkes C ASM) 16 17set(configure_string "") 18 19config_string( 20 CAmkESDefaultHeapSize 21 CAMKES_DEFAULT_HEAP_SIZE 22 "Heap size to allocate per-component, in bytes." 23 DEFAULT 24 1048576 25 UNQUOTE 26) 27 28config_choice( 29 CAmkESErrorHandlingMode 30 CAMKES_ERROR_HANDLING_MODE 31 "Select the mode of error handling used in the glue code. It should only 32 be necessary to adjust this setting if you are doing verification. 33 Otherwise, the default error handling mechanism allows for 34 configuration at runtime. 35 36 Standard -> Standard error handling mechanism, that is configurable by the user at 37 runtime. See the documentation for details of the API for this. 38 39 Guards -> Use verification-visible guards at the site of each potential error. 40 Note that this assumes that none of the error conditions are possible. 41 If you are trying to verify code, you will be forced to prove that none 42 of the error conditions can ever actually occur. 43 44 Abort -> Call 'abort' inline when an error occurs. For debugging purposes, this 45 is probably not the behaviour you want as it will give you no 46 information about the error. The standard error handling mechanism has 47 a nicer default for debugging. This mode is primarily useful when you 48 want to verify code whose error handlers are unreachable for 49 non-trivial reasons. 50 51 Discard -> Perform the 'discard' action on any error that occurs. The advantage of 52 this over simply configuring this behaviour via the standard mechanism 53 is that you will not need to reason about any of the complicated error 54 handling structures or control flow. This has no implementation 55 advantages over the standard mechanism." 56 "Standard;CAmkESErrorHandlingConfigurable;CAMKES_ERROR_HANDLER_CONFIGURABLE" 57 "Guards;CAmkESErrorHandlingGuard;CAMKES_ERROR_HANDLER_GUARD" 58 "Abort;CAmkESErrorHandlingAbort;CAMKES_ERROR_HANDLER_ABORT" 59 "Discard;CAmkESErrorHandlingDiscard;CAMKES_ERROR_HANDLER_DISCARD" 60) 61 62config_option( 63 CAmkESConnectorTiming 64 CAMKES_CONNECTOR_TIMING 65 "Enable timing points within connector templates that take cycle counter 66 values as they are passed. This timing data can then be retrieved after 67 execution." 68 DEFAULT 69 OFF 70) 71 72config_choice( 73 CAmkESTLSModel 74 CAMKES_TLS_MODEL 75 "The CAmkES glue code uses thread-local variables for marshalling and 76 unmarshalling of RPC parameters. This setting controls how this thread- 77 local storage is implemented. 78 79 standard -> Allocate thread-local variables on the stack or the heap as appropriate. 80 This is the default and will hold the fewest surprises for C 81 programmers. 82 83 per-thread -> Allocate per-thread global variables for use as thread-local storage. 84 The main purpose of this implementation is to avoid taking the address 85 of local variables, an idiom that cannot be handled by the verification 86 C parser." 87 "standard;CAmkESTLSStandard;CAMKES_TLS_STANDARD" 88 "per-thread;CAmkESTLSPerThreadGlobal;CAMKES_TLS_PTG" 89) 90 91add_config_library(sel4camkes "${configure_string}") 92 93set(adjusted_seL4_arch "${KernelSel4Arch}") 94if("${KernelSel4Arch}" STREQUAL "arm_hyp") 95 set(adjusted_seL4_arch "aarch32") 96endif() 97 98file( 99 GLOB 100 deps 101 src/*.c 102 src/arch/${KernelArch}/*.c 103 src/sel4_arch/${adjusted_seL4_arch}/*.c 104 src/sel4_arch/${adjusted_seL4_arch}/gdb_server/*.c 105 src/arch/${KernelArch}/*.S 106 src/arch/${KernelArch}/*.c 107 src/sel4_arch/${adjusted_seL4_arch}/*.S 108) 109 110list(SORT deps) 111 112add_library(sel4camkes STATIC EXCLUDE_FROM_ALL ${deps}) 113target_include_directories(sel4camkes PUBLIC include) 114target_include_directories(sel4camkes PRIVATE src/arch_include) 115target_link_libraries( 116 sel4camkes 117 muslc 118 sel4 119 sel4debug 120 platsupport 121 sel4muslcsys 122 sel4sync 123 virtqueue 124 sel4camkes_Config 125 sel4runtime_Config 126 sel4_autoconf 127) 128