1# This is still WIP - Not fully validated on any platform.
2
3# When west is installed, Zephyr's CMake invokes west to list and try to
4# compile every Zephyr module that can be found.
5if(CONFIG_SOF)
6
7if(CONFIG_LIBRARY)
8	set(PLATFORM "library")
9	set(ARCH host)
10	zephyr_include_directories(../src/platform/library/include)
11else()
12	# firmware build supports only xtensa arch for now
13	set(ARCH xtensa)
14endif()
15
16# Appends literal with path of the source file relative to the project root
17# It is useful if sources in given target need deterministic relative path
18# to the actually compiled file.
19# __FILE is not always suitable as C standard states that __FILE__ expands to
20# input file name, that usually is absolute path what will cause f.e. .rodata
21# size to be dependent on where project is physically located on the disk.
22function(sof_append_relative_path_definitions target)
23	get_target_property(sources ${target} SOURCES)
24	foreach(src ${sources})
25		get_filename_component(ABS_PATH ${src} ABSOLUTE)
26		file(RELATIVE_PATH rel ${PROJECT_SOURCE_DIR} ${ABS_PATH})
27		set_property(
28			SOURCE ${src}
29			APPEND
30			PROPERTY COMPILE_DEFINITIONS
31			RELATIVE_FILE="${rel}")
32	endforeach()
33endfunction()
34
35# Initial SOF module will contain
36#
37# 1. Application logic - pipeline, audio components, IPC processing, topology
38# 2. IP drivers - SSP, DMIC, PM, IPC will transition to Zephyr directly over
39#                 time and be removed from the SOF repo.
40# 3. Platform IP - PM, init, clocks, IRQs will transition directly to Zephyr
41#                  over time and be removed from SOF repo.
42# 4. RTOS logic - scheduler, allocator, notifier - as with 2 & 3.
43zephyr_interface_library_named(SOF)
44
45# SOF source paths.
46set(SOF_SRC_PATH "../src")
47set(SOF_PLATFORM_PATH "${SOF_SRC_PATH}/platform")
48set(SOF_AUDIO_PATH "${SOF_SRC_PATH}/audio")
49set(SOF_SAMPLES_PATH "${SOF_SRC_PATH}/samples")
50set(SOF_LIB_PATH "${SOF_SRC_PATH}/lib")
51set(SOF_DRIVERS_PATH "${SOF_SRC_PATH}/drivers")
52set(SOF_IPC_PATH "${SOF_SRC_PATH}/ipc")
53set(SOF_DEBUG_PATH "${SOF_SRC_PATH}/debug")
54set(SOF_MATH_PATH "${SOF_SRC_PATH}/math")
55set(SOF_TRACE_PATH "${SOF_SRC_PATH}/trace")
56
57# Save path to rimage configuration files in cmake cache for later use by
58# rimage during the "west sign" stage
59get_filename_component(RIMAGE_CONFIG "../rimage/config" ABSOLUTE)
60set(RIMAGE_CONFIG_PATH ${RIMAGE_CONFIG} CACHE PATH
61    " Path to rimage board configuration files")
62
63include(ExternalProject)
64
65ExternalProject_Add(smex_ep
66	SOURCE_DIR "${ZEPHYR_SOF_MODULE_DIR}/smex/"
67	# The default paths are very "deep"
68	PREFIX     "${PROJECT_BINARY_DIR}/smex_ep"
69	BINARY_DIR "${PROJECT_BINARY_DIR}/smex_ep/build"
70	INSTALL_COMMAND "" # need smex only at build time
71)
72
73ExternalProject_Add(sof_logger_ep
74	SOURCE_DIR "${ZEPHYR_SOF_MODULE_DIR}/tools/"
75	# The default paths are very "deep"
76	PREFIX     "${PROJECT_BINARY_DIR}/sof-logger_ep"
77	BINARY_DIR "${PROJECT_BINARY_DIR}/sof-logger_ep/build"
78	BUILD_COMMAND cmake --build . --target sof-logger
79	INSTALL_COMMAND ""
80)
81
82# default SOF includes
83target_include_directories(SOF INTERFACE ../rimage/src/include)
84target_include_directories(SOF INTERFACE ../zephyr/include)
85target_include_directories(SOF INTERFACE ${SOF_SRC_PATH}/include)
86target_include_directories(SOF INTERFACE ${SOF_SRC_PATH}/arch/${ARCH}/include)
87
88# SOF module init
89zephyr_library_named(modules_sof)
90zephyr_include_directories(
91	include
92)
93
94# SOC level sources
95# Files that are commented may not be needed.
96
97# Intel BYT, CHT, BSW platforms
98if (CONFIG_SOC_SERIES_INTEL_ADSP_BAYTRAIL)
99
100	# Driver sources
101	zephyr_library_sources(
102		${SOF_DRIVERS_PATH}/intel/baytrail/ipc.c
103		${SOF_DRIVERS_PATH}/intel/baytrail/ssp.c
104		${SOF_DRIVERS_PATH}/intel/pmc-ipc.c
105	)
106
107	# Platform sources
108	zephyr_library_sources(
109		${SOF_PLATFORM_PATH}/baytrail/platform.c
110		${SOF_PLATFORM_PATH}/baytrail/lib/dai.c
111		${SOF_PLATFORM_PATH}/baytrail/lib/clk.c
112		${SOF_PLATFORM_PATH}/baytrail/lib/dma.c
113		${SOF_SRC_PATH}/schedule/dma_multi_chan_domain.c
114	)
115
116	# SOF core infrastructure - runs on top of Zephyr
117	zephyr_library_sources(
118		${SOF_SRC_PATH}/schedule/ll_schedule.c
119	)
120
121	set(PLATFORM "baytrail")
122endif()
123
124# Intel HSW, BDW platforms
125if (CONFIG_SOC_SERIES_INTEL_ADSP_BROADWELL)
126	zephyr_library_sources(
127		${SOF_DRIVERS_PATH}/intel/haswell/ipc.c
128		${SOF_DRIVERS_PATH}/intel/haswell/ssp.c
129	)
130
131	# SOF core infrastructure - runs on top of Zephyr
132	zephyr_library_sources(
133		${SOF_SRC_PATH}/schedule/ll_schedule.c
134	)
135
136	set(PLATFORM "haswell")
137endif()
138
139# Intel APL, KBL, SKL CAVS 1.5 platforms
140if (CONFIG_SOC_SERIES_INTEL_CAVS_V15)
141
142	# Driver sources
143	zephyr_library_sources(
144		${SOF_DRIVERS_PATH}/intel/cavs/ipc.c
145		${SOF_DRIVERS_PATH}/intel/cavs/timestamp.c
146	)
147
148	zephyr_library_sources_ifdef(CONFIG_INTEL_HDA
149		${SOF_DRIVERS_PATH}/intel/hda/hda-dma.c
150		${SOF_DRIVERS_PATH}/intel/hda/hda.c
151	)
152
153	zephyr_library_sources_ifdef(CONFIG_INTEL_MN
154		${SOF_DRIVERS_PATH}/intel/ssp/mn.c
155	)
156
157	zephyr_library_sources_ifdef(CONFIG_INTEL_SSP
158		${SOF_DRIVERS_PATH}/intel/ssp/ssp.c
159	)
160
161	zephyr_library_sources_ifdef(CONFIG_INTEL_ALH
162		${SOF_DRIVERS_PATH}/intel/alh.c
163	)
164
165	zephyr_library_sources_ifdef(CONFIG_INTEL_DMIC
166		${SOF_DRIVERS_PATH}/intel/dmic/dmic.c
167	)
168
169	zephyr_library_sources_ifdef(CONFIG_INTEL_DMIC_TPLG_PARAMS
170		${SOF_DRIVERS_PATH}/intel/dmic/dmic_computed.c
171	)
172
173	zephyr_library_sources_ifdef(CONFIG_INTEL_DMIC_NHLT
174		${SOF_DRIVERS_PATH}/intel/dmic/dmic_nhlt.c
175	)
176
177	# Platform sources
178	zephyr_library_sources(
179		${SOF_PLATFORM_PATH}/intel/cavs/platform.c
180		${SOF_PLATFORM_PATH}/intel/cavs/lib/mem_window.c
181		${SOF_PLATFORM_PATH}/intel/cavs/lib/pm_runtime.c
182		${SOF_PLATFORM_PATH}/intel/cavs/lib/pm_memory.c
183		${SOF_PLATFORM_PATH}/intel/cavs/lib/clk.c
184		${SOF_PLATFORM_PATH}/intel/cavs/lib/dai.c
185		${SOF_PLATFORM_PATH}/intel/cavs/lib/dma.c
186		${SOF_PLATFORM_PATH}/apollolake/lib/power_down.S
187		${SOF_PLATFORM_PATH}/apollolake/lib/clk.c
188	)
189
190	# SOF core infrastructure - runs on top of Zephyr
191	zephyr_library_sources(
192		${SOF_SRC_PATH}/schedule/zephyr_ll.c
193	)
194
195	set_source_files_properties(${SOF_PLATFORM_PATH}/apollolake/lib/power_down.S PROPERTIES COMPILE_FLAGS -DASSEMBLY)
196
197	set(PLATFORM "apollolake")
198	zephyr_include_directories(${SOF_PLATFORM_PATH}/intel/cavs/include)
199endif()
200
201# Intel CNL and CAVS 1.8 platfroms
202if (CONFIG_SOC_SERIES_INTEL_CAVS_V18)
203
204	# Driver sources
205	zephyr_library_sources(
206		${SOF_DRIVERS_PATH}/intel/cavs/ipc.c
207		${SOF_DRIVERS_PATH}/intel/cavs/timestamp.c
208	)
209
210	# Sue Creek - S100 only - already in Zephyr.
211	#${SOF_DRIVERS_PATH}/intel/cavs/sue-ipc.c
212	#${SOF_DRIVERS_PATH}/intel/cavs/sue-iomux.c
213
214	zephyr_library_sources_ifdef(CONFIG_INTEL_HDA
215		${SOF_DRIVERS_PATH}/intel/hda/hda-dma.c
216		${SOF_DRIVERS_PATH}/intel/hda/hda.c
217	)
218
219	zephyr_library_sources_ifdef(CONFIG_INTEL_MN
220		${SOF_DRIVERS_PATH}/intel/ssp/mn.c
221	)
222
223	zephyr_library_sources_ifdef(CONFIG_INTEL_SSP
224		${SOF_DRIVERS_PATH}/intel/ssp/ssp.c
225	)
226
227	zephyr_library_sources_ifdef(CONFIG_INTEL_ALH
228		${SOF_DRIVERS_PATH}/intel/alh.c
229	)
230
231	zephyr_library_sources_ifdef(CONFIG_INTEL_DMIC
232		${SOF_DRIVERS_PATH}/intel/dmic/dmic.c
233	)
234
235	zephyr_library_sources_ifdef(CONFIG_INTEL_DMIC_TPLG_PARAMS
236		${SOF_DRIVERS_PATH}/intel/dmic/dmic_computed.c
237	)
238
239	zephyr_library_sources_ifdef(CONFIG_INTEL_DMIC_NHLT
240		${SOF_DRIVERS_PATH}/intel/dmic/dmic_nhlt.c
241	)
242
243	# Platform sources
244	zephyr_library_sources(
245		${SOF_PLATFORM_PATH}/intel/cavs/platform.c
246		${SOF_PLATFORM_PATH}/intel/cavs/lib/mem_window.c
247		${SOF_PLATFORM_PATH}/cannonlake/lib/clk.c
248		${SOF_PLATFORM_PATH}/intel/cavs/lib/power_down.S
249		${SOF_PLATFORM_PATH}/intel/cavs/lib/pm_runtime.c
250		${SOF_PLATFORM_PATH}/intel/cavs/lib/pm_memory.c
251		${SOF_PLATFORM_PATH}/intel/cavs/lib/clk.c
252		${SOF_PLATFORM_PATH}/intel/cavs/lib/dai.c
253		${SOF_PLATFORM_PATH}/intel/cavs/lib/dma.c
254		#${SOF_PLATFORM_PATH}/intel/cavs/lps_pic_restore_vector.S
255	)
256
257	# SOF core infrastructure - runs on top of Zephyr
258	zephyr_library_sources(
259		${SOF_SRC_PATH}/schedule/zephyr_ll.c
260	)
261
262	zephyr_library_sources_ifdef(CONFIG_CAVS_LPS
263		${SOF_PLATFORM_PATH}/intel/cavs/lps_wait.c
264	)
265
266	set_source_files_properties(${SOF_PLATFORM_PATH}/intel/cavs/lib/power_down.S PROPERTIES COMPILE_FLAGS -DASSEMBLY)
267	set_source_files_properties(${SOF_PLATFORM_PATH}/intel/cavs/lps_pic_restore_vector.S PROPERTIES COMPILE_FLAGS -DASSEMBLY)
268
269	set(PLATFORM "cannonlake")
270	zephyr_include_directories(${SOF_PLATFORM_PATH}/intel/cavs/include)
271endif()
272
273# Intel ICL and CAVS 2.0 platforms
274if (CONFIG_SOC_SERIES_INTEL_CAVS_V20)
275
276	# Driver sources
277	zephyr_library_sources(
278		${SOF_DRIVERS_PATH}/intel/cavs/ipc.c
279		${SOF_DRIVERS_PATH}/intel/cavs/timestamp.c
280	)
281
282	zephyr_library_sources_ifdef(CONFIG_INTEL_HDA
283		${SOF_DRIVERS_PATH}/intel/hda/hda-dma.c
284		${SOF_DRIVERS_PATH}/intel/hda/hda.c
285	)
286
287	zephyr_library_sources_ifdef(CONFIG_INTEL_MN
288		${SOF_DRIVERS_PATH}/intel/ssp/mn.c
289	)
290
291	zephyr_library_sources_ifdef(CONFIG_INTEL_SSP
292		${SOF_DRIVERS_PATH}/intel/ssp/ssp.c
293	)
294
295	zephyr_library_sources_ifdef(CONFIG_INTEL_ALH
296		${SOF_DRIVERS_PATH}/intel/alh.c
297	)
298
299	zephyr_library_sources_ifdef(CONFIG_INTEL_DMIC
300		${SOF_DRIVERS_PATH}/intel/dmic/dmic.c
301	)
302
303	zephyr_library_sources_ifdef(CONFIG_INTEL_DMIC_TPLG_PARAMS
304		${SOF_DRIVERS_PATH}/intel/dmic/dmic_computed.c
305	)
306
307	zephyr_library_sources_ifdef(CONFIG_INTEL_DMIC_NHLT
308		${SOF_DRIVERS_PATH}/intel/dmic/dmic_nhlt.c
309	)
310
311	# Platform sources
312	zephyr_library_sources(
313		${SOF_PLATFORM_PATH}/intel/cavs/platform.c
314		${SOF_PLATFORM_PATH}/intel/cavs/lib/mem_window.c
315		${SOF_PLATFORM_PATH}/icelake/lib/clk.c
316		${SOF_PLATFORM_PATH}/intel/cavs/lib/power_down.S
317		${SOF_PLATFORM_PATH}/intel/cavs/lib/pm_runtime.c
318		${SOF_PLATFORM_PATH}/intel/cavs/lib/pm_memory.c
319		${SOF_PLATFORM_PATH}/intel/cavs/lib/clk.c
320		${SOF_PLATFORM_PATH}/intel/cavs/lib/dai.c
321		${SOF_PLATFORM_PATH}/intel/cavs/lib/dma.c
322		#${SOF_PLATFORM_PATH}/intel/cavs/lps_pic_restore_vector.S
323	)
324
325	# SOF core infrastructure - runs on top of Zephyr
326	zephyr_library_sources(
327		${SOF_SRC_PATH}/schedule/zephyr_ll.c
328	)
329
330	zephyr_library_sources_ifdef(CONFIG_CAVS_LPS
331		${SOF_PLATFORM_PATH}/intel/cavs/lps_wait.c
332	)
333
334	set_source_files_properties(${SOF_PLATFORM_PATH}/intel/cavs/lib/power_down.S PROPERTIES COMPILE_FLAGS -DASSEMBLY)
335	set_source_files_properties(${SOF_PLATFORM_PATH}/intel/cavs/lps_pic_restore_vector.S PROPERTIES COMPILE_FLAGS -DASSEMBLY)
336
337	set(PLATFORM "icelake")
338	target_include_directories(SOF INTERFACE ../zephyr/include/cavs20)
339	zephyr_include_directories(${SOF_PLATFORM_PATH}/intel/cavs/include)
340	zephyr_include_directories(../../../../zephyr/soc/xtensa/intel_adsp/common/include)
341endif()
342
343# Intel TGL and CAVS 2.5 platforms
344if (CONFIG_SOC_SERIES_INTEL_CAVS_V25)
345
346	# Driver sources
347	zephyr_library_sources(
348		${SOF_DRIVERS_PATH}/intel/cavs/ipc.c
349		${SOF_DRIVERS_PATH}/intel/cavs/timestamp.c
350	)
351
352	zephyr_library_sources_ifdef(CONFIG_INTEL_HDA
353		${SOF_DRIVERS_PATH}/intel/hda/hda-dma.c
354		${SOF_DRIVERS_PATH}/intel/hda/hda.c
355	)
356
357	zephyr_library_sources_ifdef(CONFIG_INTEL_MN
358		${SOF_DRIVERS_PATH}/intel/ssp/mn.c
359	)
360
361	zephyr_library_sources_ifdef(CONFIG_INTEL_SSP
362		${SOF_DRIVERS_PATH}/intel/ssp/ssp.c
363	)
364
365	zephyr_library_sources_ifdef(CONFIG_INTEL_ALH
366		${SOF_DRIVERS_PATH}/intel/alh.c
367	)
368
369	zephyr_library_sources_ifdef(CONFIG_INTEL_DMIC
370		${SOF_DRIVERS_PATH}/intel/dmic/dmic.c
371	)
372
373	zephyr_library_sources_ifdef(CONFIG_INTEL_DMIC_TPLG_PARAMS
374		${SOF_DRIVERS_PATH}/intel/dmic/dmic_computed.c
375	)
376
377	zephyr_library_sources_ifdef(CONFIG_INTEL_DMIC_NHLT
378		${SOF_DRIVERS_PATH}/intel/dmic/dmic_nhlt.c
379	)
380
381
382	# Platform sources
383	zephyr_library_sources(
384		${SOF_PLATFORM_PATH}/intel/cavs/platform.c
385		${SOF_PLATFORM_PATH}/intel/cavs/lib/mem_window.c
386		${SOF_PLATFORM_PATH}/tigerlake/lib/clk.c
387		${SOF_PLATFORM_PATH}/intel/cavs/lib/power_down.S
388		${SOF_PLATFORM_PATH}/intel/cavs/lib/pm_runtime.c
389		${SOF_PLATFORM_PATH}/intel/cavs/lib/pm_memory.c
390		${SOF_PLATFORM_PATH}/intel/cavs/lib/clk.c
391		${SOF_PLATFORM_PATH}/intel/cavs/lib/dai.c
392		${SOF_PLATFORM_PATH}/intel/cavs/lib/dma.c
393		#${SOF_PLATFORM_PATH}/intel/cavs/lps_pic_restore_vector.S
394	)
395
396	# SOF core infrastructure - runs on top of Zephyr
397	zephyr_library_sources(
398		${SOF_SRC_PATH}/schedule/zephyr_ll.c
399	)
400
401	zephyr_library_sources_ifdef(CONFIG_CAVS_LPS
402		${SOF_PLATFORM_PATH}/intel/cavs/lps_wait.c
403	)
404
405	set_source_files_properties(${SOF_PLATFORM_PATH}/intel/cavs/lib/power_down.S PROPERTIES COMPILE_FLAGS -DASSEMBLY)
406	set_source_files_properties(${SOF_PLATFORM_PATH}/intel/cavs/lps_pic_restore_vector.S PROPERTIES COMPILE_FLAGS -DASSEMBLY)
407
408	set(PLATFORM "tigerlake")
409	target_include_directories(SOF INTERFACE ../zephyr/include/cavs25)
410	zephyr_include_directories(${SOF_PLATFORM_PATH}/intel/cavs/include)
411	zephyr_include_directories(../../../../zephyr/soc/xtensa/intel_adsp/common/include)
412endif()
413
414# NXP IMX8 platforms
415if (CONFIG_SOC_SERIES_NXP_IMX8)
416	zephyr_library_sources(
417		${SOF_DRIVERS_PATH}/generic/dummy-dma.c
418		${SOF_DRIVERS_PATH}/imx/edma.c
419		${SOF_DRIVERS_PATH}/imx/sai.c
420		${SOF_DRIVERS_PATH}/imx/ipc.c
421		${SOF_DRIVERS_PATH}/imx/esai.c
422		${SOF_DRIVERS_PATH}/imx/interrupt-irqsteer.c
423	)
424
425	# Platform sources
426	zephyr_library_sources(
427		${SOF_PLATFORM_PATH}/imx8/platform.c
428		${SOF_PLATFORM_PATH}/imx8/lib/clk.c
429		${SOF_PLATFORM_PATH}/imx8/lib/dai.c
430		${SOF_PLATFORM_PATH}/imx8/lib/dma.c
431		${SOF_PLATFORM_PATH}/imx8/lib/memory.c
432	)
433
434	# SOF core infrastructure - runs on top of Zephyr
435	zephyr_library_sources(
436		${SOF_SRC_PATH}/schedule/ll_schedule.c
437		${SOF_SRC_PATH}/drivers/interrupt.c
438	)
439
440	set(PLATFORM "imx8")
441endif()
442
443if (CONFIG_SOC_SERIES_NXP_IMX8M)
444	zephyr_library_sources(
445		${SOF_DRIVERS_PATH}/generic/dummy-dma.c
446		${SOF_DRIVERS_PATH}/imx/sdma.c
447		${SOF_DRIVERS_PATH}/imx/edma.c
448		${SOF_DRIVERS_PATH}/imx/sai.c
449		${SOF_DRIVERS_PATH}/imx/ipc.c
450		${SOF_DRIVERS_PATH}/imx/esai.c
451	)
452
453	# Platform sources
454	zephyr_library_sources(
455		${SOF_PLATFORM_PATH}/imx8m/platform.c
456		${SOF_PLATFORM_PATH}/imx8m/lib/clk.c
457		${SOF_PLATFORM_PATH}/imx8m/lib/memory.c
458		${SOF_PLATFORM_PATH}/imx8m/lib/dai.c
459		${SOF_PLATFORM_PATH}/imx8m/lib/dma.c
460	)
461
462	set(PLATFORM "imx8m")
463endif()
464
465zephyr_library_sources_ifdef(CONFIG_LIBRARY
466	${SOF_PLATFORM_PATH}/library/platform.c
467	${SOF_PLATFORM_PATH}/library/lib/dai.c
468	${SOF_DRIVERS_PATH}/host/ipc.c
469)
470
471zephyr_include_directories(${SOF_PLATFORM_PATH}/${PLATFORM}/include)
472
473# Mandatory Files used on all platforms.
474# Commented files will be added/removed as integration dictates.
475zephyr_library_sources(
476	${SOF_IPC_PATH}/dma-copy.c
477	${SOF_IPC_PATH}/ipc-common.c
478	${SOF_IPC_PATH}/ipc-helper.c
479	${SOF_IPC_PATH}/ipc3/handler.c
480	${SOF_IPC_PATH}/ipc3/helper.c
481	${SOF_IPC_PATH}/ipc3/dai.c
482	${SOF_IPC_PATH}/ipc3/host-page-table.c
483	${SOF_SRC_PATH}/spinlock.c
484
485	# SOF math utilities
486	${SOF_MATH_PATH}/decibels.c
487	${SOF_MATH_PATH}/numbers.c
488	${SOF_MATH_PATH}/trig.c
489
490	# SOF library - parts to transition to Zephyr over time
491	${SOF_LIB_PATH}/clk.c
492	${SOF_LIB_PATH}/notifier.c
493	${SOF_LIB_PATH}/lib.c
494	${SOF_LIB_PATH}/pm_runtime.c
495	${SOF_LIB_PATH}/wait.c
496	${SOF_LIB_PATH}/dma.c
497	${SOF_LIB_PATH}/dai.c
498
499	# SOF mandatory audio processing
500	${SOF_AUDIO_PATH}/channel_map.c
501	${SOF_AUDIO_PATH}/pcm_converter/pcm_converter_hifi3.c
502	${SOF_AUDIO_PATH}/pcm_converter/pcm_converter.c
503	${SOF_AUDIO_PATH}/pcm_converter/pcm_converter_generic.c
504	${SOF_AUDIO_PATH}/buffer.c
505	${SOF_AUDIO_PATH}/component.c
506	${SOF_AUDIO_PATH}/pipeline/pipeline-graph.c
507	${SOF_AUDIO_PATH}/pipeline/pipeline-params.c
508	${SOF_AUDIO_PATH}/pipeline/pipeline-schedule.c
509	${SOF_AUDIO_PATH}/pipeline/pipeline-stream.c
510	${SOF_AUDIO_PATH}/pipeline/pipeline-xrun.c
511	${SOF_AUDIO_PATH}/host.c
512
513	# SOF core infrastructure - runs on top of Zephyr
514	${SOF_SRC_PATH}/init/init.c
515	${SOF_SRC_PATH}/init/ext_manifest.c
516	${SOF_SRC_PATH}/arch/xtensa/drivers/cache_attr.c
517	${SOF_SRC_PATH}/schedule/zephyr_domain.c
518	${SOF_SRC_PATH}/schedule/schedule.c
519	${SOF_SRC_PATH}/schedule/dma_single_chan_domain.c
520	${SOF_SRC_PATH}/schedule/dma_multi_chan_domain.c
521	${SOF_SRC_PATH}/schedule/zephyr.c
522
523	# Bridge wrapper between SOF and Zephyr APIs - Will shrink over time.
524	wrapper.c
525	edf_schedule.c
526	schedule.c
527)
528
529zephyr_library_sources_ifdef(CONFIG_TRACE
530	${SOF_SRC_PATH}/trace/dma-trace.c
531	${SOF_SRC_PATH}/trace/trace.c
532)
533
534# Optional SOF sources - depends on Kconfig - WIP
535
536zephyr_library_sources_ifdef(CONFIG_COMP_FIR
537	${SOF_AUDIO_PATH}/eq_fir/eq_fir_hifi3.c
538	${SOF_AUDIO_PATH}/eq_fir/eq_fir_hifi2ep.c
539	${SOF_AUDIO_PATH}/eq_fir/eq_fir_generic.c
540	${SOF_AUDIO_PATH}/eq_fir/eq_fir.c
541	${SOF_MATH_PATH}/fir_generic.c
542	${SOF_MATH_PATH}/fir_hifi2ep.c
543	${SOF_MATH_PATH}/fir_hifi3.c
544)
545
546zephyr_library_sources_ifdef(CONFIG_COMP_IIR
547	${SOF_MATH_PATH}/iir_df2t_generic.c
548	${SOF_MATH_PATH}/iir_df2t_hifi3.c
549	${SOF_AUDIO_PATH}/eq_iir/iir.c
550	${SOF_AUDIO_PATH}/eq_iir/eq_iir.c
551)
552
553zephyr_library_sources_ifdef(CONFIG_COMP_ASRC
554	${SOF_AUDIO_PATH}/asrc/asrc.c
555	${SOF_AUDIO_PATH}/asrc/asrc_farrow_hifi3.c
556	${SOF_AUDIO_PATH}/asrc/asrc_farrow.c
557	${SOF_AUDIO_PATH}/asrc/asrc_farrow_generic.c
558)
559
560zephyr_library_sources_ifdef(CONFIG_COMP_DCBLOCK
561	${SOF_AUDIO_PATH}/dcblock/dcblock_generic.c
562	${SOF_AUDIO_PATH}/dcblock/dcblock.c
563)
564
565zephyr_library_sources_ifdef(CONFIG_COMP_SEL
566	${SOF_AUDIO_PATH}/selector/selector_generic.c
567	${SOF_AUDIO_PATH}/selector/selector.c
568)
569
570zephyr_library_sources_ifdef(CONFIG_COMP_KPB
571	${SOF_AUDIO_PATH}/kpb.c
572)
573
574zephyr_library_sources_ifdef(CONFIG_COMP_SWITCH
575	${SOF_AUDIO_PATH}/switch.c
576)
577
578zephyr_library_sources_ifdef(CONFIG_COMP_MIXER
579	${SOF_AUDIO_PATH}/mixer.c
580)
581
582zephyr_library_sources_ifdef(CONFIG_COMP_TONE
583	${SOF_AUDIO_PATH}/tone.c
584)
585
586zephyr_library_sources_ifdef(CONFIG_COMP_DAI
587	${SOF_AUDIO_PATH}/dai.c
588)
589
590zephyr_library_sources_ifdef(CONFIG_SAMPLE_KEYPHRASE
591	${SOF_SAMPLES_PATH}/audio/detect_test.c
592)
593
594zephyr_library_sources_ifdef(CONFIG_COMP_VOLUME
595	${SOF_AUDIO_PATH}/volume/volume_hifi3.c
596	${SOF_AUDIO_PATH}/volume/volume_generic.c
597	${SOF_AUDIO_PATH}/volume/volume.c
598)
599
600zephyr_library_sources_ifdef(CONFIG_COMP_SRC
601	${SOF_AUDIO_PATH}/src/src_hifi2ep.c
602	${SOF_AUDIO_PATH}/src/src_generic.c
603	${SOF_AUDIO_PATH}/src/src_hifi3.c
604	${SOF_AUDIO_PATH}/src/src.c
605)
606
607zephyr_library_sources_ifdef(CONFIG_SAMPLE_SMART_AMP
608	${SOF_SAMPLES_PATH}/audio/smart_amp_test.c
609)
610
611zephyr_library_sources_ifdef(CONFIG_COMP_MUX
612	${SOF_AUDIO_PATH}/mux/mux.c
613	${SOF_AUDIO_PATH}/mux/mux_generic.c
614)
615
616zephyr_library_sources_ifdef(CONFIG_PROBE
617	${SOF_SRC_PATH}/probe/probe.c
618)
619
620zephyr_library_sources_ifdef(CONFIG_MULTICORE
621	${SOF_SRC_PATH}/idc/idc.c
622)
623
624zephyr_library_sources_ifdef(CONFIG_HAVE_AGENT
625	${SOF_LIB_PATH}/agent.c
626)
627
628zephyr_library_sources_ifdef(CONFIG_GDB_DEBUG
629	${SOF_DEBUG_PATH}/gdb/gdb.c
630	${SOF_DEBUG_PATH}/gdb/ringbuffer.c
631)
632
633zephyr_library_sources_ifdef(CONFIG_DW_DMA
634	${SOF_DRIVERS_PATH}/dw/dma.c
635)
636
637zephyr_library_link_libraries(SOF)
638target_link_libraries(SOF INTERFACE zephyr_interface)
639
640# Setup SOF directories
641set(SOF_ROOT_SOURCE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
642set(SOF_ROOT_BINARY_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
643set(GENERATED_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
644file(MAKE_DIRECTORY ${GENERATED_DIRECTORY}/include)
645
646# generated files
647set(VERSION_H_PATH ${GENERATED_DIRECTORY}/include/version.h)
648set(DOT_CONFIG_PATH ${GENERATED_DIRECTORY}/.config)
649
650if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
651	# FindPythonInterp is bugged and may sometimes be unable to find
652	# Python 3 when both Python 2 & 3 are in PATH,
653	# so it's always better to use CMake 3.12+
654	find_package(PythonInterp 3.0)
655	set(PYTHON3 "${PYTHON_EXECUTABLE}")
656else()
657	find_package(Python3 COMPONENTS Interpreter)
658	set(PYTHON3 "${Python3_EXECUTABLE}")
659endif()
660
661# SOF uses GNU C99 extensions. TODO other flags required ?
662target_compile_options(SOF INTERFACE -std=gnu99 -fno-inline-functions)
663
664# Toolchain info
665add_definitions(-DXCC_TOOLS_VERSION="${ZEPHYR_TOOLCHAIN_VARIANT}" -DCC_OPTIMIZE_FLAGS="${OPTIMIZATION_FLAG}")
666
667# create version information
668include(../scripts/cmake/version.cmake)
669add_definitions(-DSOF_MICRO=${SOF_MICRO} -DSOF_MINOR=${SOF_MINOR})
670add_definitions(-DSOF_MAJOR=${SOF_MAJOR} -DSOF_TAG="${SOF_TAG}")
671add_definitions(-DSOF_SRC_HASH=0x${SOF_SRC_HASH} -DSOF_GIT_TAG="${SOF_GIT_TAG}")
672
673# Create Trace realtive file paths
674sof_append_relative_path_definitions(modules_sof)
675
676endif() # CONFIG_SOF
677