1# Copyright (c) 2021, Intel Corporation 2# 3# SPDX-License-Identifier: Apache-2.0 4 5if (CONFIG_PERCEPIO_TRACERECORDER OR CONFIG_PERCEPIO_DFM) 6 zephyr_library() 7endif() 8 9if(CONFIG_PERCEPIO_TRACERECORDER) 10 11 set(TRACERECORDER_DIR ${ZEPHYR_CURRENT_MODULE_DIR}/TraceRecorder) 12 13 zephyr_library_sources_ifdef( 14 CONFIG_PERCEPIO_TRACERECORDER 15 ${TRACERECORDER_DIR}/kernelports/Zephyr/trcKernelPort.c 16 ${TRACERECORDER_DIR}/trcAssert.c 17 ${TRACERECORDER_DIR}/trcCounter.c 18 ${TRACERECORDER_DIR}/trcDiagnostics.c 19 ${TRACERECORDER_DIR}/trcEntryTable.c 20 ${TRACERECORDER_DIR}/trcError.c 21 ${TRACERECORDER_DIR}/trcEvent.c 22 ${TRACERECORDER_DIR}/trcEventBuffer.c 23 ${TRACERECORDER_DIR}/trcExtension.c 24 ${TRACERECORDER_DIR}/trcHardwarePort.c 25 ${TRACERECORDER_DIR}/trcHeap.c 26 ${TRACERECORDER_DIR}/trcInternalEventBuffer.c 27 ${TRACERECORDER_DIR}/trcInterval.c 28 ${TRACERECORDER_DIR}/trcISR.c 29 ${TRACERECORDER_DIR}/trcMultiCoreEventBuffer.c 30 ${TRACERECORDER_DIR}/trcObject.c 31 ${TRACERECORDER_DIR}/trcPrint.c 32 ${TRACERECORDER_DIR}/trcStackMonitor.c 33 ${TRACERECORDER_DIR}/trcStateMachine.c 34 ${TRACERECORDER_DIR}/trcStaticBuffer.c 35 ${TRACERECORDER_DIR}/trcStreamingRecorder.c 36 ${TRACERECORDER_DIR}/trcString.c 37 ${TRACERECORDER_DIR}/trcTask.c 38 ${TRACERECORDER_DIR}/trcTimestamp.c 39 ${TRACERECORDER_DIR}/trcDependency.c 40 ${TRACERECORDER_DIR}/trcRunnable.c 41 ) 42 43 if(CONFIG_PERCEPIO_TRC_CFG_STREAM_PORT_RTT) 44 zephyr_library_sources( 45 ${TRACERECORDER_DIR}/streamports/Jlink_RTT/trcStreamPort.c 46 ) 47 48 zephyr_include_directories( 49 ${TRACERECORDER_DIR}/kernelports/Zephyr/streamports/Jlink_RTT/config/ 50 ${TRACERECORDER_DIR}/streamports/Jlink_RTT/include/ 51 ) 52 endif() 53 54 if(CONFIG_PERCEPIO_TRC_CFG_STREAM_PORT_ITM) 55 zephyr_library_sources( 56 ${TRACERECORDER_DIR}/streamports/ARM_ITM/trcStreamPort.c 57 ) 58 59 zephyr_include_directories( 60 ${TRACERECORDER_DIR}/kernelports/Zephyr/streamports/ARM_ITM/config/ 61 ${TRACERECORDER_DIR}/streamports/ARM_ITM/include/ 62 ) 63 endif() 64 65 if(CONFIG_PERCEPIO_TRC_CFG_STREAM_PORT_RINGBUFFER) 66 zephyr_library_sources( 67 ${TRACERECORDER_DIR}/streamports/RingBuffer/trcStreamPort.c 68 ) 69 70 zephyr_include_directories( 71 ${TRACERECORDER_DIR}/kernelports/Zephyr/streamports/RingBuffer/config/ 72 ${TRACERECORDER_DIR}/streamports/RingBuffer/include/ 73 ) 74 endif() 75 76 if(CONFIG_PERCEPIO_TRC_CFG_STREAM_PORT_FILE) 77 zephyr_library_sources( 78 ${TRACERECORDER_DIR}/streamports/File/trcStreamPort.c 79 ) 80 81 zephyr_include_directories( 82 ${TRACERECORDER_DIR}/kernelports/Zephyr/streamports/File/config/ 83 ${TRACERECORDER_DIR}/streamports/File/include/ 84 ) 85 endif() 86 87 if (CONFIG_PERCEPIO_TRC_CFG_STREAM_PORT_ZEPHYR_SEMIHOST) 88 zephyr_library_sources( 89 ${TRACERECORDER_DIR}/kernelports/Zephyr/streamports/Semihost/trcStreamPort.c 90 ) 91 92 zephyr_include_directories( 93 ${TRACERECORDER_DIR}/kernelports/Zephyr/streamports/Semihost/config 94 ${TRACERECORDER_DIR}/kernelports/Zephyr/streamports/Semihost/include 95 ) 96 endif() 97 98 99 zephyr_include_directories( 100 ${TRACERECORDER_DIR}/kernelports/Zephyr/include 101 ${TRACERECORDER_DIR}/kernelports/Zephyr/config 102 ${TRACERECORDER_DIR}/kernelports/Zephyr/config/core 103 ${TRACERECORDER_DIR}/include 104 ) 105 106 set_property(GLOBAL APPEND PROPERTY extra_post_build_commands 107 COMMAND ${PYTHON_EXECUTABLE} ${TRACERECORDER_DIR}/kernelports/Zephyr/scripts/tz_parse_syscalls.py ${CMAKE_BINARY_DIR} ${ZEPHYR_BASE} 108 ) 109 110endif() 111 112if(CONFIG_PERCEPIO_DFM) 113 114 set(DFM_DIR ${ZEPHYR_CURRENT_MODULE_DIR}/DFM) 115 116 zephyr_library_sources( 117 ${DFM_DIR}/dfm.c 118 ${DFM_DIR}/dfmAlert.c 119 ${DFM_DIR}/dfmCloud.c 120 ${DFM_DIR}/dfmEntry.c 121 ${DFM_DIR}/dfmSession.c 122 ${DFM_DIR}/dfmStorage.c 123 ${DFM_DIR}/dfmRetainedMemory.c 124 ${DFM_DIR}/kernelports/Zephyr/dfmKernelPort.c 125 ) 126 127 if(CONFIG_PERCEPIO_DFM_CFG_STORAGEPORT_NONE) 128 zephyr_library_sources( 129 ${DFM_DIR}/storageports/Dummy/dfmStoragePort.c 130 ) 131 132 zephyr_include_directories( 133 ${DFM_DIR}/storageports/Dummy/include/ 134 ) 135 endif() 136 137 if(CONFIG_PERCEPIO_DFM_CFG_STORAGEPORT_FLASH) 138 zephyr_library_sources( 139 ${DFM_DIR}/kernelports/Zephyr/storageports/Flash/dfmStoragePort.c 140 ) 141 142 zephyr_include_directories( 143 ${DFM_DIR}/kernelports/Zephyr/storageports/Flash/include/ 144 ) 145 endif() 146 147 if(CONFIG_PERCEPIO_DFM_CFG_STORAGEPORT_FILESYSTEM) 148 zephyr_library_sources( 149 ${DFM_DIR}/kernelports/Zephyr/storageports/Filesystem/dfmStoragePort.c 150 ) 151 152 zephyr_include_directories( 153 ${DFM_DIR}/kernelports/Zephyr/storageports/Filesystem/include/ 154 ) 155 endif() 156 157 if(CONFIG_PERCEPIO_DFM_CFG_CLOUDPORT_NONE) 158 zephyr_library_sources( 159 ${DFM_DIR}/cloudports/Dummy/dfmCloudPort.c 160 ) 161 162 zephyr_include_directories( 163 ${DFM_DIR}/cloudports/Dummy/include/ 164 ) 165 endif() 166 167 if(CONFIG_PERCEPIO_DFM_CFG_CLOUDPORT_SERIAL) 168 zephyr_library_sources( 169 ${DFM_DIR}/kernelports/Zephyr/cloudports/Serial/dfmCloudPort.c 170 ) 171 172 zephyr_include_directories( 173 ${DFM_DIR}/kernelports/Zephyr/cloudports/Serial/config/ 174 ${DFM_DIR}/kernelports/Zephyr/cloudports/Serial/include/ 175 ) 176 endif() 177 178 if(CONFIG_PERCEPIO_DFM_CFG_RETAINED_MEMORY) 179 zephyr_library_sources( 180 ${DFM_DIR}/kernelports/Zephyr/dfmRetainedMemoryPort.c 181 ) 182 endif() 183 184 zephyr_include_directories( 185 ${DFM_DIR}/kernelports/Zephyr/config 186 ${DFM_DIR}/kernelports/Zephyr/include 187 ${DFM_DIR}/include 188 ) 189 190endif() 191