From eaedcece267a768fb3bfd29caf8bb5d109d13301 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Thu, 8 Jun 2023 23:05:57 +0000 Subject: [PATCH 1/4] xtensa/CMakeLists.txt: simplify CONFIG_RENOIR/REMBRANDT logic Use get_filename_component() to get the basename and remove the $platform_folder special case for CONFIG_RENOIR and CONFIG_REMBRANDT. Zero change, binaries are identical. Signed-off-by: Marc Herbert --- src/arch/xtensa/CMakeLists.txt | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/arch/xtensa/CMakeLists.txt b/src/arch/xtensa/CMakeLists.txt index c51dd956491b..a10ace5ee842 100644 --- a/src/arch/xtensa/CMakeLists.txt +++ b/src/arch/xtensa/CMakeLists.txt @@ -12,6 +12,10 @@ elseif(CONFIG_IMX8M) set(platform_folder imx8m) elseif(CONFIG_IMX8ULP) set(platform_folder imx8ulp) +elseif(CONFIG_RENOIR) + set(platform_folder amd/renoir) +elseif(CONFIG_REMBRANDT) + set(platform_folder amd/rembrandt) elseif(CONFIG_MT8186) set(platform_folder mt8186) elseif(CONFIG_MT8188) @@ -22,18 +26,11 @@ endif() set(fw_name ${CONFIG_RIMAGE_SIGNING_SCHEMA}) -set(platform_ld_script ${platform_folder}.x) +# File name without directory +get_filename_component(_plf_ld_script ${platform_folder} NAME) +set(platform_ld_script ${_plf_ld_script}.x) set(platform_rom_ld_script rom.x) -if(CONFIG_RENOIR) - set(platform_folder amd/renoir) - set(platform_ld_script renoir.x) -endif() - -if(CONFIG_REMBRANDT) - set(platform_folder amd/rembrandt) - set(platform_ld_script rembrandt.x) -endif() # includes # None of these should be included if Zephyr strict headers are used. From 3c323c3c9e094f43649a10da8cf2fdf245128f68 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Thu, 8 Jun 2023 22:37:48 +0000 Subject: [PATCH 2/4] scripts/fuzz.sh: cosmetic move list of CONFIG_s to a bash array This saves a lot of backslashes and is easier to read. Zero change. Signed-off-by: Marc Herbert --- scripts/fuzz.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/fuzz.sh b/scripts/fuzz.sh index d5fefa98abb5..9012b6342b2e 100755 --- a/scripts/fuzz.sh +++ b/scripts/fuzz.sh @@ -67,13 +67,17 @@ main() : "${TEST_DURATION:=3}" : "${FUZZER_STDOUT:=/dev/stdout}" # bashism - west build -d build-fuzz -b native_posix "$SOF_TOP"/app/ -- \ - -DCONFIG_ASSERT=y \ - -DCONFIG_SYS_HEAP_BIG_ONLY=y \ - -DCONFIG_ZEPHYR_NATIVE_DRIVERS=y \ - -DCONFIG_ARCH_POSIX_LIBFUZZER=y \ - -DCONFIG_ARCH_POSIX_FUZZ_TICKS=100 \ - -DCONFIG_ASAN=y "$@" + # Move this to a new fuzz.conf overlay file if it grows bigger + local fuzz_configs=( + -DCONFIG_ASSERT=y + -DCONFIG_SYS_HEAP_BIG_ONLY=y + -DCONFIG_ZEPHYR_NATIVE_DRIVERS=y + -DCONFIG_ARCH_POSIX_LIBFUZZER=y + -DCONFIG_ARCH_POSIX_FUZZ_TICKS=100 + -DCONFIG_ASAN=y + ) + + west build -d build-fuzz -b native_posix "$SOF_TOP"/app/ -- "${fuzz_configs[@]}" "$@" mkdir -p ./fuzz_corpus From 71f5fa7f2400761fe9a0c840649191bea8d2421c Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Thu, 8 Jun 2023 22:45:43 +0000 Subject: [PATCH 3/4] scripts/fuzz.sh: add -DCONFIG_ZEPHYR_POSIX Don't rely on some semi-random default value. The final `zephyr/.config` and binaries are strictly identical. Signed-off-by: Marc Herbert --- scripts/fuzz.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/fuzz.sh b/scripts/fuzz.sh index 9012b6342b2e..fa01d8b099b2 100755 --- a/scripts/fuzz.sh +++ b/scripts/fuzz.sh @@ -69,6 +69,7 @@ main() # Move this to a new fuzz.conf overlay file if it grows bigger local fuzz_configs=( + -DCONFIG_ZEPHYR_POSIX=y -DCONFIG_ASSERT=y -DCONFIG_SYS_HEAP_BIG_ONLY=y -DCONFIG_ZEPHYR_NATIVE_DRIVERS=y From 13ae27419c0c0de32b7eb5cbedbdb57e122b5739 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Thu, 8 Jun 2023 00:42:08 +0000 Subject: [PATCH 4/4] Kconfig: don't fall back on CONFIG_TIGERLAKE There's really no reason to fall back on a default "platform" and pick up a bunch of other, totally random settings. Now the following command fails immediately with a useful `platform not defined` error message instead of stopping with a cryptic `platform/trace/trace.h: No such file or directory` after successfully compiling half the .c files in a Frankenstein CONFIG_uration. ``` west build -p --board mimx8mm_evk_a53 modules/audio/sof/app ``` More context in #7192. Signed-off-by: Marc Herbert --- src/arch/xtensa/CMakeLists.txt | 2 ++ src/platform/Kconfig | 4 +++- zephyr/CMakeLists.txt | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/arch/xtensa/CMakeLists.txt b/src/arch/xtensa/CMakeLists.txt index a10ace5ee842..80e3074b8772 100644 --- a/src/arch/xtensa/CMakeLists.txt +++ b/src/arch/xtensa/CMakeLists.txt @@ -22,6 +22,8 @@ elseif(CONFIG_MT8188) set(platform_folder mt8188) elseif(CONFIG_MT8195) set(platform_folder mt8195) +else() + message(FATAL_ERROR "Platform not defined, check your Kconfiguration?") endif() set(fw_name ${CONFIG_RIMAGE_SIGNING_SCHEMA}) diff --git a/src/platform/Kconfig b/src/platform/Kconfig index d1c13c88a1eb..9ee45422b78a 100644 --- a/src/platform/Kconfig +++ b/src/platform/Kconfig @@ -5,7 +5,9 @@ menu "Platform" choice prompt "Platform" default ZEPHYR_POSIX if ARCH_POSIX - default TIGERLAKE + # It's not really 'optional' but no value is much less confusing + # than falling back on a totally random value. + optional config TIGERLAKE bool "Build for Tigerlake" diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 9ca5c053a702..9d92a67db85d 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -363,6 +363,9 @@ zephyr_library_sources_ifdef(CONFIG_LIBRARY ${SOF_DRIVERS_PATH}/host/ipc.c ) +if(NOT DEFINED PLATFORM) + message(FATAL_ERROR "PLATFORM is not defined, check your Kconfiguration?") +endif() zephyr_include_directories(${SOF_PLATFORM_PATH}/${PLATFORM}/include) # Mandatory Files used on all platforms.