Commit 1d92e8e 1 parent 24f3160 commit 1d92e8e Copy full SHA for 1d92e8e
File tree 13 files changed +48
-14
lines changed
13 files changed +48
-14
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,8 @@ if(BUILD_LIBRARY)
126
126
127
127
add_subdirectory (src)
128
128
129
+ sof_append_relative_path_definitions(sof)
130
+
129
131
get_target_property (incdirs sof_public_headers INTERFACE_INCLUDE_DIRECTORIES )
130
132
131
133
# we append slash at the end to make CMake copy contents of directories
@@ -176,3 +178,5 @@ target_link_libraries(sof PRIVATE sof_static_libraries)
176
178
sof_add_build_counter_rule()
177
179
178
180
add_subdirectory (src)
181
+
182
+ sof_append_relative_path_definitions(sof)
Original file line number Diff line number Diff line change @@ -231,6 +231,7 @@ if(build_bootloader)
231
231
target_link_libraries (bootloader PRIVATE "-lgcc" )
232
232
target_link_libraries (bootloader PRIVATE "-T${PROJECT_BINARY_DIR} /${platform_bootldr_ld_script} " )
233
233
sof_add_ld_script(bootloader ${platform_bootldr_ld_script} )
234
+ sof_append_relative_path_definitions(bootloader)
234
235
235
236
add_custom_target (
236
237
bootloader_dump
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ function(sof_audio_add_module lib_name compile_flags)
74
74
target_link_libraries (${lib_name} PRIVATE -Wl,--export-dynamic)
75
75
target_compile_options (${lib_name} PRIVATE ${compile_flags} )
76
76
add_local_sources(${lib_name} ${ARGN} )
77
+ sof_append_relative_path_definitions(${lib_name} )
77
78
install (TARGETS ${lib_name} DESTINATION lib)
78
79
endfunction ()
79
80
Original file line number Diff line number Diff line change 21
21
#include <stddef.h>
22
22
#include <stdint.h>
23
23
24
+ #ifndef RELATIVE_FILE
25
+ #error "This file requires RELATIVE_FILE to be defined. " \
26
+ "Add it to CMake's target with sof_append_relative_path_definitions."
27
+ #endif
28
+
24
29
#if CONFIG_DEBUG
25
30
26
31
#include <sof/lib/mailbox.h>
37
42
#define dbg () \
38
43
do { \
39
44
volatile uint32_t *__m = (uint32_t *)mailbox_get_debug_base(); \
40
- *(__m++) = (__FILE__[0] << 24) + (__FILE__[1] << 16) +\
41
- (__FILE__[2] << 8) + (__FILE__[3]); \
45
+ *(__m++) = (RELATIVE_FILE[0] << 24) + \
46
+ (RELATIVE_FILE[1] << 16) + \
47
+ (RELATIVE_FILE[2] << 8) + (RELATIVE_FILE[3]); \
42
48
*(__m++) = (__func__[0] << 24) + (__func__[1] << 16) + \
43
49
(__func__[2] << 8) + (__func__[3]); \
44
50
*__m = __LINE__; \
49
55
do { \
50
56
volatile uint32_t *__m = \
51
57
(uint32_t *)mailbox_get_debug_base() + __x; \
52
- *(__m++) = (__FILE__[0] << 24) + (__FILE__[1] << 16) +\
53
- (__FILE__[2] << 8) + (__FILE__[3]); \
58
+ *(__m++) = (RELATIVE_FILE[0] << 24) + \
59
+ (RELATIVE_FILE[1] << 16) + \
60
+ (RELATIVE_FILE[2] << 8) + (RELATIVE_FILE[3]); \
54
61
*(__m++) = (__func__[0] << 24) + (__func__[1] << 16) + \
55
62
(__func__[2] << 8) + (__func__[3]); \
56
63
*__m = __LINE__; \
Original file line number Diff line number Diff line change 12
12
#include <ipc/trace.h>
13
13
#include <stdint.h>
14
14
15
+ #ifndef RELATIVE_FILE
16
+ #error "This file requires RELATIVE_FILE to be defined. " \
17
+ "Add it to CMake's target with sof_append_relative_path_definitions."
18
+ #endif
19
+
15
20
void dump_panicinfo (void * addr , struct sof_ipc_panic_info * panic_info );
16
21
void panic_rewind (uint32_t p , uint32_t stack_rewind_frames ,
17
22
struct sof_ipc_panic_info * panic_info , uintptr_t * data );
18
23
void __panic (uint32_t p , char * filename , uint32_t linenum );
19
24
20
25
/* panic dump filename and linenumber of the call */
21
- #define panic (x ) __panic((x), (__FILE__ ), (__LINE__))
26
+ #define panic (x ) __panic((x), (RELATIVE_FILE ), (__LINE__))
22
27
23
28
/* runtime assertion */
24
29
#define assert (cond ) (void)((cond) || (panic(SOF_IPC_PANIC_ASSERT), 0))
Original file line number Diff line number Diff line change 10
10
#ifndef __SOF_TRACE_TRACE_H__
11
11
#define __SOF_TRACE_TRACE_H__
12
12
13
+ #ifndef RELATIVE_FILE
14
+ #error "This file requires RELATIVE_FILE to be defined. " \
15
+ "Add it to CMake's target with sof_append_relative_path_definitions."
16
+ #endif
17
+
13
18
#if CONFIG_TRACE
14
19
#include <platform/trace/trace.h>
15
20
#endif
@@ -229,17 +234,17 @@ void trace_init(struct sof *sof);
229
234
uint32_t line_idx; \
230
235
uint32_t file_name_len; \
231
236
uint32_t text_len; \
232
- const char file_name[sizeof(__FILE__ )]; \
237
+ const char file_name[sizeof(RELATIVE_FILE )]; \
233
238
const char text[sizeof(format)]; \
234
239
} log_entry = { \
235
240
lvl, \
236
241
comp_class, \
237
242
ids, \
238
243
params, \
239
244
__LINE__, \
240
- sizeof(__FILE__ ), \
245
+ sizeof(RELATIVE_FILE ), \
241
246
sizeof(format), \
242
- __FILE__ , \
247
+ RELATIVE_FILE , \
243
248
format \
244
249
}
245
250
@@ -282,17 +287,17 @@ do { \
282
287
uint32_t line_idx; \
283
288
uint32_t file_name_len; \
284
289
uint32_t text_len; \
285
- const char file_name[sizeof(__FILE__ )]; \
290
+ const char file_name[sizeof(RELATIVE_FILE )]; \
286
291
const char text[sizeof(format)]; \
287
292
} log_entry = { \
288
293
lvl, \
289
294
comp_class, \
290
295
ids, \
291
296
params, \
292
297
__LINE__, \
293
- sizeof(__FILE__ ), \
298
+ sizeof(RELATIVE_FILE ), \
294
299
sizeof(format), \
295
- __FILE__ , \
300
+ RELATIVE_FILE , \
296
301
format \
297
302
}
298
303
#endif
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ SET(arch_src ${PROJECT_SOURCE_DIR}/src/arch/xtensa/idc.c)
57
57
add_library (universal_mock STATIC ${PROJECT_SOURCE_DIR} /test /cmocka/src/universal_mocks.c)
58
58
target_link_libraries (universal_mock PRIVATE sof_options)
59
59
link_libraries (universal_mock)
60
+ sof_append_relative_path_definitions(universal_mock)
60
61
61
62
# creates exectuable for new test and adds it as test for ctest
62
63
function (cmocka_test test_name)
@@ -74,6 +75,8 @@ function(cmocka_test test_name)
74
75
target_compile_definitions (${test_name} PRIVATE -D_UINTPTR_T_DEFINED)
75
76
76
77
add_test (NAME ${test_name} COMMAND xt-run --exit_with_target_code ${test_name} )
78
+
79
+ sof_append_relative_path_definitions(${test_name} )
77
80
endfunction ()
78
81
79
82
add_subdirectory (src)
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ add_library(
13
13
${PROJECT_SOURCE_DIR} /src/audio/mux/mux_generic.c
14
14
${PROJECT_SOURCE_DIR} /src/audio/component .c
15
15
)
16
+ sof_append_relative_path_definitions(audio_mux)
16
17
17
18
target_link_libraries (audio_mux PRIVATE sof_options)
18
19
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ if(CONFIG_SMP)
10
10
link_libraries (-Wl,--gc-sections)
11
11
12
12
add_library (pipeline_lib STATIC ${arch_src} )
13
+ sof_append_relative_path_definitions(pipeline_lib)
13
14
14
15
target_link_libraries (pipeline_lib PRIVATE sof_options)
15
16
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ add_library(audio_for_selector STATIC
12
12
${PROJECT_SOURCE_DIR} /src/audio/selector/selector.c
13
13
${PROJECT_SOURCE_DIR} /src/audio/selector/selector_generic.c
14
14
)
15
+ sof_append_relative_path_definitions(audio_for_selector)
15
16
16
17
target_link_libraries (audio_for_selector PRIVATE sof_options)
17
18
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ add_library(audio_for_volume STATIC
13
13
${PROJECT_SOURCE_DIR} /src/audio/volume/volume_generic.c
14
14
${PROJECT_SOURCE_DIR} /src/audio/volume/volume_hifi3.c
15
15
)
16
+ sof_append_relative_path_definitions(audio_for_volume)
16
17
17
18
target_link_libraries (audio_for_volume PRIVATE sof_options)
18
19
Original file line number Diff line number Diff line change @@ -42,17 +42,17 @@ static void test_debugability_macros_declare_log_entry(void **state)
42
42
"uint32_t line_idx; "
43
43
"uint32_t file_name_len; "
44
44
"uint32_t text_len; "
45
- "const char file_name[sizeof(\"" __FILE__ "\")]; "
45
+ "const char file_name[sizeof(\"" RELATIVE_FILE "\")]; "
46
46
"const char text[sizeof(\"Message\")]; "
47
47
"} log_entry = { "
48
48
"1"
49
49
"(6 << 24)"
50
50
"1"
51
51
"1"
52
52
"32"
53
- "sizeof(\"" __FILE__ "\")"
53
+ "sizeof(\"" RELATIVE_FILE "\")"
54
54
"sizeof(\"Message\")"
55
- "\"" __FILE__ "\""
55
+ "\"" RELATIVE_FILE "\""
56
56
"\"Message\" "
57
57
"}" ;
58
58
(void )state ;
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ cmake_minimum_required(VERSION 3.10)
4
4
5
5
project (SOF_TESTBENCH C)
6
6
7
+ include (../../scripts/cmake/misc.cmake)
8
+
7
9
add_executable (testbench
8
10
testbench.c
9
11
alloc.c
@@ -18,6 +20,8 @@ add_executable(testbench
18
20
trace.c
19
21
)
20
22
23
+ sof_append_relative_path_definitions(testbench)
24
+
21
25
target_include_directories (testbench PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} /include )
22
26
23
27
target_compile_options (testbench PRIVATE -g -O3 -Wall -Werror -Wl,-EL -Wmissing-prototypes -Wimplicit-fallthrough=3)
You can’t perform that action at this time.
0 commit comments