Skip to content

Commit

Permalink
probe: llext: Enable building probe as loadable llext module
Browse files Browse the repository at this point in the history
To build PROBE as module just set CONFIG_PROBE=m in Kconfig.

Signed-off-by: Jyri Sarha <[email protected]>
  • Loading branch information
Jyri Sarha authored and kv2019i committed Nov 20, 2024
1 parent 9f9b581 commit 7718e43
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/logging/log_backend_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ void probe_logging_init(probe_logging_hook_t fn)
{
probe_hook = fn;
}
EXPORT_SYMBOL(probe_logging_init);

const struct log_backend *log_backend_probe_get(void)
{
Expand Down
8 changes: 7 additions & 1 deletion src/probe/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
menu "Probe"

config PROBE
bool "Probes enabled"
tristate "Probes enabled"
default m if LIBRARY_DEFAULT_MODULAR
default y if CAVS
help
Select for enabling debug probes to extract/inject buffers

if PROBE != n

config PROBE_POINTS_MAX
int "Maximum probe points"
depends on PROBE
Expand All @@ -23,4 +26,7 @@ config PROBE_DMA_MAX
default 0
help
Define maximum number of injection DMAs.

endif

endmenu
6 changes: 6 additions & 0 deletions src/probe/llext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2024 Intel Corporation.
# SPDX-License-Identifier: Apache-2.0

sof_llext_build("probe"
SOURCES ../probe.c
)
10 changes: 10 additions & 0 deletions src/probe/llext/llext.toml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2024 Intel Corporation. All rights reserved.
*/
#include <tools/rimage/config/platform.toml>
#define LOAD_TYPE "2"
#include "../probe.toml"
[module]
count = __COUNTER__
21 changes: 20 additions & 1 deletion src/probe/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1512,4 +1512,23 @@ static const struct module_interface probe_interface = {
DECLARE_MODULE_ADAPTER(probe_interface, PROBE_UUID, pr_tr);
SOF_MODULE_INIT(probe, sys_comp_module_probe_interface_init);

#endif
#if CONFIG_PROBE_MODULE
/* modular: llext dynamic link */

#include <module/module/api_ver.h>
#include <module/module/llext.h>
#include <rimage/sof/user/manifest.h>

#define UUID_PROBE 0x08, 0x08, 0xAD, 0x7C, 0x10, 0xAB, 0x23, 0xCD, 0xEF, 0x45, \
0x12, 0xAB, 0x34, 0xCD, 0x56, 0xEF,

SOF_LLEXT_MOD_ENTRY(probe, &probe_interface);

static const struct sof_man_module_manifest mod_manifest __section(".module") __used =
SOF_LLEXT_MODULE_MANIFEST("PROBE", probe_llext_entry, 1, UUID_PROBE, 40);

SOF_LLEXT_BUILDINFO;

#endif /* CONFIG_COMP_PROBE_MODULE */

#endif /* CONFIG_IPC_MAJOR_4 */
6 changes: 5 additions & 1 deletion src/probe/probe.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#ifndef LOAD_TYPE
#define LOAD_TYPE "0"
#endif

[[module.entry]]
name = "PROBE"
uuid = "7CAD0808-AB10-CD23-EF45-12AB34CD56EF"
affinity_mask = "0x1"
instance_count = "1"
domain_types = "0"
load_type = "0"
load_type = LOAD_TYPE
module_type = "9"
auto_start = "0"
sched_caps = [1, 0x00008000]
Expand Down
10 changes: 7 additions & 3 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1129,9 +1129,13 @@ zephyr_library_sources_ifdef(CONFIG_WAVES_CODEC_STUB
${SOF_AUDIO_PATH}/module_adapter/module/waves/maxx_stub.c
)

zephyr_library_sources_ifdef(CONFIG_PROBE
${SOF_SRC_PATH}/probe/probe.c
)
if(CONFIG_PROBE STREQUAL "m")
add_subdirectory(${SOF_SRC_PATH}/probe/llext
${PROJECT_BINARY_DIR}/probe_llext)
add_dependencies(app probe)
elseif(CONFIG_PROBE)
zephyr_library_sources(${SOF_SRC_PATH}/probe/probe.c)
endif()

zephyr_library_sources_ifdef(CONFIG_MULTICORE
${SOF_SRC_PATH}/idc/idc.c
Expand Down

0 comments on commit 7718e43

Please sign in to comment.