Skip to content

Commit

Permalink
zephyr: namespace the generated version.h
Browse files Browse the repository at this point in the history
Zephyr's build time generated `version.h` is now in the
`zephyr` to provide proper namespace, update the includes of
this module accordingly.

Signed-off-by: Yong Cong Sin <[email protected]>
  • Loading branch information
ycsin committed May 24, 2024
1 parent 5081044 commit ce4a18e
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright(c) 2023 Meta
#
# Author: Yong Cong Sin <[email protected]>

menu "Compatibility"

config SOF_COMPAT_INCLUDES
bool "Use legacy include path"
default n
help
Use legacy Zephyr generated include paths,
i.e. `#include <version.h> instead of:
`#include <zephyr/version.h>`

endmenu

source "Kconfig"
3 changes: 3 additions & 0 deletions app/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ CONFIG_HEAP_MEM_POOL_SIZE=2048
CONFIG_LLEXT=y
CONFIG_LLEXT_STORAGE_WRITABLE=y
CONFIG_MODULES=y

# To be able to use Zephyr legacy include paths
CONFIG_SOF_COMPAT_INCLUDES=y
4 changes: 4 additions & 0 deletions src/init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
#include <zephyr/logging/log_ctrl.h>
#include <user/abi_dbg.h>
#include <sof_versions.h>
#ifdef CONFIG_SOF_COMPAT_INCLUDES
#include <version.h>
#else
#include <zephyr/version.h>
#endif
#endif
#include <sof/lib/ams.h>

Expand Down
4 changes: 4 additions & 0 deletions src/trace/dma-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
#include <sof_versions.h>

#ifdef __ZEPHYR__
#ifdef CONFIG_SOF_COMPAT_INCLUDES
#include <version.h>
#else
#include <zephyr/version.h>
#endif
#endif

#include <errno.h>
Expand Down
4 changes: 4 additions & 0 deletions zephyr/lib/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
#include <zephyr/init.h>
#include <zephyr/kernel.h>
#include <zephyr/pm/policy.h>
#ifdef CONFIG_SOF_COMPAT_INCLUDES
#include <version.h>
#else
#include <zephyr/version.h>
#endif
#include <zephyr/sys/__assert.h>
#include <zephyr/cache.h>

Expand Down
4 changes: 4 additions & 0 deletions zephyr/lib/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
#include <rtos/alloc.h>

/* Zephyr includes */
#ifdef CONFIG_SOF_COMPAT_INCLUDES
#include <version.h>
#else
#include <zephyr/version.h>
#endif
#include <zephyr/kernel.h>
#include <zephyr/kernel/smp.h>
#include <zephyr/device.h>
Expand Down
4 changes: 4 additions & 0 deletions zephyr/wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
#include <zephyr/kernel_structs.h>
#include <zephyr/kernel.h>
#include <zephyr/pm/policy.h>
#ifdef CONFIG_SOF_COMPAT_INCLUDES
#include <version.h>
#else
#include <zephyr/version.h>
#endif
#include <zephyr/sys/__assert.h>
#include <zephyr/logging/log_ctrl.h>
#include <zephyr/logging/log.h>
Expand Down

0 comments on commit ce4a18e

Please sign in to comment.