Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SPDX-License-Identifier: BSD-3-Clause

# Code that only runs in kernel mode, see scripts/kernel_user_partition.txt.

is_zephyr(zephyr)
if(zephyr)
# Build everything below into the sof_kernel library created in
# zephyr/CMakeLists.txt instead of modules_sof. This only sets the
# variable for this directory and its subdirectories.
set(ZEPHYR_CURRENT_LIBRARY sof_kernel)
endif()

add_subdirectory(init)
File renamed without changes.
8 changes: 4 additions & 4 deletions src/init/README.md → src/kernel/init/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# DSP Initialization (`src/init`)
# DSP Initialization (`src/kernel/init`)

> **Runs in:** Kernel-only — boot and bring-up code runs in supervisor context; no path here
> executes directly in a user thread. See
> [User/kernel split](../include/sof/userspace/README.md).
> [User/kernel split](../../include/sof/userspace/README.md).

The `src/init` directory contains the generic digital signal processor (DSP) initialization code and firmware metadata structures for Sound Open Firmware (SOF). It acts as the bridge between the underlying RTOS (Zephyr) boot phase and the SOF-specific task scheduling and processing pipelines.
The `src/kernel/init` directory contains the generic digital signal processor (DSP) initialization code and firmware metadata structures for Sound Open Firmware (SOF). It acts as the bridge between the underlying RTOS (Zephyr) boot phase and the SOF-specific task scheduling and processing pipelines.

## Architecture and Boot Flow

Expand All @@ -19,7 +19,7 @@ The primary entry point for SOF system initialization is `sof_init()`, registere
```mermaid
sequenceDiagram
participant Zephyr as Zephyr RTOS
participant sof_init as sof_init (src/init.c)
participant sof_init as sof_init (src/kernel/init/init.c)
participant primary_core as primary_core_init
participant trace as trace_init
participant notify as init_system_notify
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions test/ztest/unit/common/sof_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
//
// Minimal SOF context for standalone ztest applications that link SOF code
// calling sof_get(), for example src/audio/component.c, but do not link
// src/init/init.c. The context is created on first use and only its component
// driver list is initialised, which is what buffer_new() and the component
// infrastructure need.
// src/kernel/init/init.c. The context is created on first use and only its
// component driver list is initialised, which is what buffer_new() and the
// component infrastructure need.

#include <rtos/sof.h>
#include <sof/audio/component_ext.h>
Expand Down
10 changes: 9 additions & 1 deletion zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ target_include_directories(SOF INTERFACE ${SOF_SRC_PATH}/arch/${ARCH}/include)
target_include_directories(SOF INTERFACE ${sof_top_dir}/third_party/include)
target_include_directories(SOF INTERFACE ${sof_top_dir}/zephyr/include)

# Code that only runs in kernel mode, from src/kernel. It is built as a
# library of its own so that it can later be given kernel-only include
# directories. Created before modules_sof so that modules_sof stays the
# current library here; src/kernel/CMakeLists.txt switches to this one.
zephyr_library_named(sof_kernel)
zephyr_library_link_libraries(SOF)

# SOF module init
zephyr_library_named(modules_sof)

Expand Down Expand Up @@ -231,8 +238,8 @@ add_subdirectory(../src/math/ math_unused_install/)
add_subdirectory(../src/audio/ audio_unused_install/)
add_subdirectory(../src/debug/ debug_unused_install/)
add_subdirectory(../src/idc/ idc_unused_install/)
add_subdirectory(../src/init/ init_unused_install/)
add_subdirectory(../src/ipc/ ipc_unused_install/)
add_subdirectory(../src/kernel/ kernel_unused_install/)
add_subdirectory(../src/lib/ lib_unused_install/)
add_subdirectory(../src/library_manager/ library_manager_unused_install/)
add_subdirectory(../src/logging/ logging_unused_install/)
Expand Down Expand Up @@ -665,5 +672,6 @@ include(../scripts/cmake/uuid-registry.cmake)

# Create Trace realtive file paths
sof_append_relative_path_definitions(modules_sof)
sof_append_relative_path_definitions(sof_kernel)

endif() # CONFIG_SOF_FULL_ZEPHYR_APPLICATION
Loading