From 2ce9d81a8820c2a38517535757f04760f0d54a1e Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Thu, 1 Nov 2018 09:46:00 -0700 Subject: [PATCH] cmake: xcc: fix compile warnings and errors XCC does not support the "-undef" flag so set NOSYSDEF_CFLAGS to empty string to fix compile warning. Also, XCC does not supply the macro __SIZEOF_LONG__ which breaks the build. So define it. Signed-off-by: Daniel Leung --- cmake/toolchain/xcc.cmake | 8 ++++++++ soc/xtensa/intel_s1000/soc.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/cmake/toolchain/xcc.cmake b/cmake/toolchain/xcc.cmake index 56caa3fe261..15fc7fe1b6f 100644 --- a/cmake/toolchain/xcc.cmake +++ b/cmake/toolchain/xcc.cmake @@ -15,4 +15,12 @@ set(OPTIMIZE_FOR_DEBUG_FLAG "-O0") set(CC xcc) set(C++ xc++) +set(NOSYSDEF_CFLAG "") + list(APPEND TOOLCHAIN_C_FLAGS -fms-extensions) + +# xcc doesn't have this, so we need to define it here. +# This is the same as in the xcc toolchain spec files. +list(APPEND TOOLCHAIN_C_FLAGS + -D__SIZEOF_LONG__=4 + ) diff --git a/soc/xtensa/intel_s1000/soc.c b/soc/xtensa/intel_s1000/soc.c index 8eb6de31033..f4416d80090 100644 --- a/soc/xtensa/intel_s1000/soc.c +++ b/soc/xtensa/intel_s1000/soc.c @@ -11,6 +11,8 @@ #include #include +#include "soc.h" + #define LOG_LEVEL CONFIG_SOC_LOG_LEVEL #include LOG_MODULE_REGISTER(soc);