Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include xtensa-types.h header file to support the ACP_7_0 platform's build. #9413

Closed
wants to merge 2 commits into from

Conversation

saisurya-ch
Copy link
Member

Add the inclusion of xtensa-types.h header file to accommodate the definition of macro UINT32_C which is required by the core file tie.h in platform ACP_7_0. ACP7_0 uses the new xt-clang compiler.

@marc-hb
Copy link
Collaborator

marc-hb commented Aug 28, 2024

Can we just do the ugly #ifndef UINT32_C dance with zero #include and zero #ifdef __SOMETHING? In other words, just drop #if defined(__ZEPHYR__) from src/arch/xtensa/include/xtensa/config/core.h and that's it?

@dbaluta, @LaurentiuM1234 the #if defined(__ZEPHYR__) was added by @paulstelian97 in https://github.com/thesofproject/sof/pull/7538/files#r1180483103 because of "conflicts" but he never said what those "conflicts" were. So can we just drop it?

@saisurya-ch
Copy link
Member Author

saisurya-ch commented Aug 29, 2024

@saisurya-ch
Copy link
Member Author

saisurya-ch commented Aug 29, 2024

Can we just do the ugly #ifndef UINT32_C dance with zero #include and zero #ifdef __SOMETHING? In other words, just drop #if defined(__ZEPHYR__) from src/arch/xtensa/include/xtensa/config/core.h and that's it?

@dbaluta, @LaurentiuM1234 the #if defined(__ZEPHYR__) was added by @paulstelian97 in https://github.com/thesofproject/sof/pull/7538/files#r1180483103 because of "conflicts" but he never said what those "conflicts" were. So can we just drop it?

Please observe that no other platform's tie.h file has used macro UINT32_C. Only the new platform ACP_7_0 tie.h has it. So, we have declared the definition of UINT32_C under the platform specific macro (CONFIG_ACP_7_0).

Even dropping #if defined(__ZEPHYR__) don't work because platform ACP_7_0's tie.h file is expecting the definition of macro to be this way #define UINT32_C(x) x. But here under the condition #if defined(__ZEPHYR__), macro definition has U appending to the x. This is raising the build error that Error: found 'U', expected: ')'.

@paulstelian97 Can we make the line 48 #define __UINT32_C(x) x ## U in core.h to #define __UINT32_C(x) x and remove the condition #if defined(__ZEPHYR__).

@dcpleung
Copy link
Contributor

I wonder if using __ASSEMBLY__ to separate the two definitions would work. If it is compiled under assembly rules, skip U, otherwise includes U.

@marc-hb
Copy link
Collaborator

marc-hb commented Aug 29, 2024

because platform ACP_7_0's tie.h file is expecting the definition of macro to be this way #define UINT32_C(x) x.

This looks just wrong. UINT32_C() is part of the C99 standard with a well defined meaning. It's as far from platform-dependent as can be.

But here under the condition #if defined(__ZEPHYR__), macro definition has U appending to the x.

Yes: as defined in the C99 standard.

This is raising the build error that Error: found 'U', expected: ')'.

Please share more about this. We're discussing a PR to fix an issue that most people don't know about: this is what makes this fix almost impossible to review.

Please share the small bit of code that does not compile and the complete error trace. Is it not C code but assembly as just guessed by @dcpleung ? If yes then his solution of replacing ZEPHYR with ASSEMBLY is probably the best. We are already using ASSEMBLY, take a look at: git grep -C5 if.*ASSEMBLY

One example:

posix/include/rtos/bit.h:#if ASSEMBLY
posix/include/rtos/bit.h-#define BIT(b)                 (1 << (b))
posix/include/rtos/bit.h-#else
posix/include/rtos/bit.h-#define BIT(b)                 (1UL << (b))
posix/include/rtos/bit.h-#endif
posix/include/rtos/bit.h-

Copy link
Contributor

@andyross andyross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Driving by: are we sure this isn't just a missing stdint.h somewhere?

Basically: UINT32_C is an API provided by stdint.h. That's provided by the toolchain, not SOF. And it seems from the comment that the Cadence headers in the same toolchain are using it without including the relevant header. That's likely a toolchain bug (and as mentioned, details on the failure would be helpful). But if it works on other platforms and not this one it's probably because the platform layers include stdint.h higher up the include tree, which would IMHO be a better fix.

-1 for now pending details that explain why it's not as simple as I think it should be.

@saisurya-ch
Copy link
Member Author

I wonder if using __ASSEMBLY__ to separate the two definitions would work. If it is compiled under assembly rules, skip U, otherwise includes U.

Even under the macro ASSEMBLY, build is getting failed (that means it couldn't find the definition of UINT32_C ).

@saisurya-ch
Copy link
Member Author

saisurya-ch commented Sep 3, 2024

When the code in file core.h is as following ( just removed the line 45 in core.h (#if defined(__ZEPHYR__))):

 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */


#ifndef XTENSA_CONFIG_CORE_H
#define XTENSA_CONFIG_CORE_H

/*
 * This define is used by the new 2023 xt-clang toolchain and, while there are a few definitions
 * (identical to this one) in various implementations such as newlib, none of them is in use when
 * building SOF with Zephyr and XtensaTools.
 */


#ifndef __UINT32_C
#define __UINT32_C(x) x ## U
#endif

#ifndef UINT32_C
#define UINT32_C(x) __UINT32_C(x)
#endif


/*  CONFIGURATION INDEPENDENT DEFINITIONS:  */
#ifdef __XTENSA__
#include <xtensa/hal.h>
#include <xtensa/xtensa-versions.h>
#else
#include "../hal.h"
#include "../xtensa-versions.h"
#endif

/*  CONFIGURATION SPECIFIC DEFINITIONS:  */
#ifdef __XTENSA__
#include <xtensa/config/core-isa.h>
#include <xtensa/config/core-matmap.h>
#include <xtensa/config/tie.h>
#else
#include "core-isa.h"
#include "core-matmap.h"
#include "tie.h"
#endif

#if defined (_ASMLANGUAGE) || defined (__ASSEMBLER__)
#ifdef __XTENSA__
#include <xtensa/config/tie-asm.h>
#else
#include "tie-asm.h"
#endif
#endif /*_ASMLANGUAGE or __ASSEMBLER__*/

below is the console's error output:

   ------
   acp_7_0
   ------

XTENSA_SYSTEM=/home/sai_surya/workspace/tools/acp_7_0/RI-2023.11-linux/ACP_7_0_HiFi5_NNE_PROD/config
Build in build_acp_7_0_xcc
PATH=/home/sai_surya/workspace/tools/acp_7_0/RI-2023.11-linux/XtensaTools/bin:/home/sai_surya/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/bin/remote-cli:/home/sai_surya/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
+ cmake -DTOOLCHAIN=xt -DSOF_CC_BASE=clang -DROOT_DIR=/home/sai_surya/workspace/tools/acp_7_0/RI-2023.11-linux/ACP_7_0_HiFi5_NNE_PROD/xtensa-elf -DMEU_OPENSSL= '' '' -DINIT_CONFIG=acp_7_0_defconfig -DEXTRA_CFLAGS= /home/sai_surya/workspace/sof_7_0_final
CMake Warning:
  Ignoring empty string ("") provided on the command line.


CMake Warning:
  Ignoring empty string ("") provided on the command line.


-- Found Python3: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter
-- Preparing Xtensa toolchain
-- The C compiler identification is Clang 10.0.1
-- The ASM compiler identification is GNU
-- Found assembler: /home/sai_surya/workspace/tools/acp_7_0/RI-2023.11-linux/XtensaTools/bin/xt-clang
-- Found Git: /usr/bin/git (found version "2.34.1")
-- SOF version.cmake starting at 2024-09-03T16:12:22Z UTC
-- /home/sai_surya/workspace/sof_7_0_final is at git commit with parent(s):
commit e50055e8a29805ba1a87f79a8d4111474754c231 7cf57e65b4b7d880f2f519b565fa58d624d0094c (HEAD -> main, origin/main, origin/HEAD)
Author: SaiSurya Ch <saisurya.chakkaveeravenkatanaga@amd.com>
Date:   Wed Aug 14 14:55:35 2024 +0530

    amd: Remove inclusion of unrequired header files.
    
    amd: Remove inclusion of unrequired header files.
    
    Signed-off-by: SaiSurya Ch <saisurya.chakkaveeravenkatanaga@amd.com>
fatal: No names found, cannot describe anything.
CMake Warning at scripts/cmake/version.cmake:70 (message):
  git describe found / nothing starting with 'v'.  Shallow clone?
Call Stack (most recent call first):
  CMakeLists.txt:101 (include)


-- GIT_TAG / GIT_LOG_HASH : v0.0-0-g0000 / e50055e8a
-- Source content hash: 29d3d00b. Notes:
  - by design, source hash is broken by Kconfig changes. See #3890.
  - Source hash is also broken by _asymmetric_ autocrlf=input, see
    #5917 and reverted #5920.
-- Generated new /home/sof/build_acp_7_0_xcc/generated/include/sof_versions.h
-- (Re-)generating /home/sof/build_acp_7_0_xcc/generated/.config
   and /home/sof/build_acp_7_0_xcc/generated/include/autoconfig.h
   from /home/sof/src/arch/xtensa/configs/acp_7_0_defconfig
warning: the int symbol CORE_COUNT (defined at src/platform/Kconfig:278) has a non-int default MP_MAX_NUM_CPUS (undefined)
-- Done, future changes to /home/sof/src/arch/xtensa/configs/acp_7_0_defconfig
   will be IGNORED by this build directory! The primary .config
   file is now 'generated/.config' in the build directory.
-- Configuring done (6.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/sof/build_acp_7_0_xcc
[  0%] cmake -P /home/sof/scripts/cmake/version.cmake
[  1%] Generating generated/include/uuid-registry.h
[  1%] Built target genconfig
[  1%] Built target bin_extras
-- SOF version.cmake starting at 2024-09-03T16:12:22Z UTC
-- /home/sai_surya/workspace/sof_7_0_final is at git commit with parent(s):
commit e50055e8a29805ba1a87f79a8d4111474754c231 7cf57e65b4b7d880f2f519b565fa58d624d0094c (HEAD -> main, origin/main, origin/HEAD)
Author: SaiSurya Ch <saisurya.chakkaveeravenkatanaga@amd.com>
Date:   Wed Aug 14 14:55:35 2024 +0530

    amd: Remove inclusion of unrequired header files.
    
    amd: Remove inclusion of unrequired header files.
    
    Signed-off-by: SaiSurya Ch <saisurya.chakkaveeravenkatanaga@amd.com>
fatal: No names found, cannot describe anything.
[  1%] Generating linker script: /home/sof/build_acp_7_0_xcc/acp_7_0.x
CMake Warning at /home/sof/scripts/cmake/version.cmake:70 (message):
  git describe found / nothing starting with 'v'.  Shallow clone?


-- GIT_TAG / GIT_LOG_HASH : v0.0-0-g0000 / e50055e8a
[  1%] Built target uuid_reg_h
[  1%] Built target ld_script_acp_7_0.x
-- Source content hash: 29d3d00b. Notes:
  - by design, source hash is broken by Kconfig changes. See #3890.
  - Source hash is also broken by _asymmetric_ autocrlf=input, see
    #5917 and reverted #5920.
-- Unchanged /home/sof/build_acp_7_0_xcc/generated/include/sof_versions.h
[  1%] Built target check_version_h
[  2%] Creating directories for 'smex_ep'
[  2%] Building C object src/init/CMakeFiles/ext_manifest.dir/ext_manifest.c.o
[  2%] Creating directories for 'rimage_ep'
[  3%] Building ASM object src/arch/xtensa/hal/CMakeFiles/hal.dir/cache_asm.S.o
[  3%] Building ASM object src/arch/xtensa/hal/CMakeFiles/hal.dir/clock.S.o
[  4%] Building ASM object src/arch/xtensa/hal/CMakeFiles/hal.dir/int_asm.S.o
[  4%] Building C object src/arch/xtensa/hal/CMakeFiles/hal.dir/interrupts.c.o
[  6%] Building ASM object src/arch/xtensa/CMakeFiles/reset.dir/xtos/memctl_default.S.o
[  6%] Building ASM object src/arch/xtensa/hal/CMakeFiles/hal.dir/memcopy.S.o
[  6%] Building ASM object src/arch/xtensa/CMakeFiles/reset.dir/xtos/reset-vector.S.o
[  6%] Building ASM object src/arch/xtensa/hal/CMakeFiles/hal.dir/windowspill_asm.S.o
[  7%] Building ASM object src/arch/xtensa/xtos/CMakeFiles/xlevel3.dir/int-handler.S.o
[  8%] Building C object src/arch/xtensa/hal/CMakeFiles/hal.dir/atomics.c.o
[ 10%] Building ASM object src/arch/xtensa/xtos/CMakeFiles/xlevel4.dir/int-handler.S.o
[ 11%] Building ASM object src/arch/xtensa/xtos/CMakeFiles/xlevel5.dir/int-handler.S.o
[ 12%] No download step for 'smex_ep'
[ 12%] No download step for 'rimage_ep'
[ 13%] No update step for 'smex_ep'
[ 13%] No update step for 'rimage_ep'
[ 14%] Building ASM object src/arch/xtensa/xtos/CMakeFiles/xtos.dir/core-restore.S.o
[ 14%] No patch step for 'smex_ep'
[ 15%] No patch step for 'rimage_ep'
[ 15%] Performing configure step for 'smex_ep'
[ 16%] Performing configure step for 'rimage_ep'
-- The C compiler identification is GNU 11.4.0
-- The C compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h: Assembler messages:
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
clang-10: error: Xtensa-as command failed with exit code 1 (use -v to see invocation)
[ 16%] Building ASM object src/arch/xtensa/xtos/CMakeFiles/xlevel5.dir/int-vector.S.o
gmake[3]: *** [src/arch/xtensa/xtos/CMakeFiles/xlevel4.dir/build.make:76: src/arch/xtensa/xtos/CMakeFiles/xlevel4.dir/int-handler.S.o] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:2034: src/arch/xtensa/xtos/CMakeFiles/xlevel4.dir/all] Error 2
gmake[2]: *** Waiting for unfinished jobs....
[ 16%] Building ASM object src/arch/xtensa/xtos/CMakeFiles/xlevel3.dir/int-vector.S.o
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h: Assembler messages:
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
clang-10: error: Xtensa-as command failed with exit code 1 (use -v to see invocation)
[ 17%] Building ASM object src/arch/xtensa/xtos/CMakeFiles/xlevel3.dir/int-initlevel.S.o
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h: Assembler messages:
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h: Assembler messages:
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
[ 18%] Building ASM object src/arch/xtensa/xtos/CMakeFiles/xlevel5.dir/int-initlevel.S.o
gmake[3]: *** [src/arch/xtensa/xtos/CMakeFiles/xlevel5.dir/build.make:76: src/arch/xtensa/xtos/CMakeFiles/xlevel5.dir/int-handler.S.o] Error 1
gmake[3]: *** Waiting for unfinished jobs....
[ 18%] Building ASM object src/arch/xtensa/xtos/CMakeFiles/xtos.dir/core-save.S.o
-- Detecting C compiler ABI info - done
[ 18%] Building ASM object src/arch/xtensa/xtos/CMakeFiles/xtos.dir/core-shutoff.S.o
clang-10: error: Xtensa-as command failed with exit code 1 (use -v to see invocation)
clang-10: error: Xtensa-as command failed with exit code 1 (use -v to see invocation)
[ 20%] Building ASM object src/arch/xtensa/xtos/CMakeFiles/xtos.dir/double-vector.S.o
[ 20%] Building ASM object src/arch/xtensa/xtos/CMakeFiles/xtos.dir/debug-vector.S.o
gmake[3]: *** [src/arch/xtensa/CMakeFiles/reset.dir/build.make:90: src/arch/xtensa/CMakeFiles/reset.dir/xtos/reset-vector.S.o] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:1606: src/arch/xtensa/CMakeFiles/reset.dir/all] Error 2
gmake[3]: *** [src/arch/xtensa/xtos/CMakeFiles/xlevel3.dir/build.make:76: src/arch/xtensa/xtos/CMakeFiles/xlevel3.dir/int-handler.S.o] Error 1
gmake[3]: *** Waiting for unfinished jobs....
[ 21%] Building ASM object src/arch/xtensa/xtos/CMakeFiles/xtos.dir/xea1/exc-alloca-handler.S.o
[ 21%] Building ASM object src/arch/xtensa/xtos/CMakeFiles/xtos.dir/xea1/exc-c-wrapper-handler.S.o
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- No CMAKE_BUILD_TYPE, defaulting to Debug
-- Configuring done (0.1s)
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h: Assembler messages:
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
-- Generating done (0.0s)
-- Build files have been written to: /home/sof/build_acp_7_0_xcc/smex_ep/build
clang-10: error: Xtensa-as command failed with exit code 1 (use -v to see invocation)
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- No CMAKE_BUILD_TYPE, defaulting to Debug
-- Configuring done (0.1s)
gmake[3]: *** [src/arch/xtensa/xtos/CMakeFiles/xtos.dir/build.make:76: src/arch/xtensa/xtos/CMakeFiles/xtos.dir/core-restore.S.o] Error 1
gmake[3]: *** Waiting for unfinished jobs....
[ 22%] Performing build step for 'smex_ep'
-- Generating done (0.0s)
-- Build files have been written to: /home/sof/build_acp_7_0_xcc/rimage_ep/build
[ 22%] Performing build step for 'rimage_ep'
[ 25%] Building C object CMakeFiles/smex.dir/elf.c.o
[ 50%] Building C object CMakeFiles/smex.dir/ldc.c.o
[  5%] Building C object CMakeFiles/rimage.dir/src/file_simple.c.o
[ 75%] Building C object CMakeFiles/smex.dir/smex.c.o
[ 11%] Building C object CMakeFiles/rimage.dir/src/cse.c.o
[ 17%] Building C object CMakeFiles/rimage.dir/src/css.c.o
[100%] Linking C executable smex
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h: Assembler messages:
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
clang-10: error: Xtensa-as command failed with exit code 1 (use -v to see invocation)
[ 23%] Building C object CMakeFiles/rimage.dir/src/plat_auth.c.o
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h: Assembler messages:
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h: Assembler messages:
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
gmake[3]: *** [src/arch/xtensa/xtos/CMakeFiles/xtos.dir/build.make:104: src/arch/xtensa/xtos/CMakeFiles/xtos.dir/core-shutoff.S.o] Error 1
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h: Assembler messages:
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
clang-10: error: Xtensa-as command failed with exit code 1 (use -v to see invocation)
clang-10: error: Xtensa-as command failed with exit code 1 (use -v to see invocation)
[ 29%] Building C object CMakeFiles/rimage.dir/src/hash.c.o
clang-10: error: Xtensa-as command failed with exit code 1 (use -v to see invocation)
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h: Assembler messages:
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
gmake[3]: *** [src/arch/xtensa/xtos/CMakeFiles/xlevel5.dir/build.make:104: src/arch/xtensa/xtos/CMakeFiles/xlevel5.dir/int-initlevel.S.o] Error 1
clang-10: error: Xtensa-as command failed with exit code 1 (use -v to see invocation)
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h: Assembler messages:
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
gmake[3]: *** [src/arch/xtensa/xtos/CMakeFiles/xlevel5.dir/build.make:90: src/arch/xtensa/xtos/CMakeFiles/xlevel5.dir/int-vector.S.o] Error 1
gmake[3]: *** [src/arch/xtensa/xtos/CMakeFiles/xlevel3.dir/build.make:90: src/arch/xtensa/xtos/CMakeFiles/xlevel3.dir/int-vector.S.o] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:2062: src/arch/xtensa/xtos/CMakeFiles/xlevel5.dir/all] Error 2
[ 35%] Building C object CMakeFiles/rimage.dir/src/pkcs1_5.c.o
clang-10: error: Xtensa-as command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [src/arch/xtensa/xtos/CMakeFiles/xtos.dir/build.make:160: src/arch/xtensa/xtos/CMakeFiles/xtos.dir/xea1/exc-c-wrapper-handler.S.o] Error 1
[ 41%] Building C object CMakeFiles/rimage.dir/src/manifest.c.o
[ 47%] Building C object CMakeFiles/rimage.dir/src/ext_manifest.c.o
[100%] Built target smex
gmake[3]: *** [src/arch/xtensa/xtos/CMakeFiles/xlevel3.dir/build.make:104: src/arch/xtensa/xtos/CMakeFiles/xlevel3.dir/int-initlevel.S.o] Error 1
[ 52%] Building C object CMakeFiles/rimage.dir/src/rimage.c.o
gmake[2]: *** [CMakeFiles/Makefile2:2006: src/arch/xtensa/xtos/CMakeFiles/xlevel3.dir/all] Error 2
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h: Assembler messages:
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
[ 58%] Building C object CMakeFiles/rimage.dir/src/toml_utils.c.o
[ 64%] Building C object CMakeFiles/rimage.dir/src/adsp_config.c.o
[ 22%] No install step for 'smex_ep'
clang-10: error: Xtensa-as command failed with exit code 1 (use -v to see invocation)
[ 70%] Building C object CMakeFiles/rimage.dir/src/misc_utils.c.o
[ 76%] Building C object CMakeFiles/rimage.dir/src/file_utils.c.o
gmake[3]: *** [src/arch/xtensa/xtos/CMakeFiles/xtos.dir/build.make:90: src/arch/xtensa/xtos/CMakeFiles/xtos.dir/core-save.S.o] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:2090: src/arch/xtensa/xtos/CMakeFiles/xtos.dir/all] Error 2
[ 82%] Building C object CMakeFiles/rimage.dir/src/elf_file.c.o
[ 88%] Building C object CMakeFiles/rimage.dir/src/module.c.o
[ 22%] Completed 'smex_ep'
[ 94%] Building C object CMakeFiles/rimage.dir/tomlc99/toml.c.o
[ 22%] Built target smex_ep
[100%] Linking C executable rimage
[100%] Built target rimage
[ 23%] No install step for 'rimage_ep'
[ 24%] Completed 'rimage_ep'
[ 24%] Built target rimage_ep
[ 25%] Linking C static library libext_manifest.a
[ 25%] Built target ext_manifest
[ 25%] Linking C static library libhal.a
[ 25%] Built target hal
gmake[1]: *** [CMakeFiles/Makefile2:1931: src/arch/xtensa/CMakeFiles/bin.dir/rule] Error 2
gmake: *** [Makefile:715: bin] Error 2

@marc-hb
Copy link
Collaborator

marc-hb commented Sep 3, 2024

Thanks, these logs are useful. Next time please -j1 to avoid interleaving errors from different files.

So it is a problem when compiling ASSEMBLY, great guess @dcpleung . More specifically: int-vector.S, exc-c-wrapper-handler.S and int-initlevel.S, core-save.S and maybe others. These include xtruntime-frames.h

Even under the macro ASSEMBLY, build is getting failed (that means it couldn't find the definition of UINT32_C ).

What exactly did you try? Please share your diff. Did you try just replacing if __ZEPHYR__ with if __ASSEMBLY__? Other?

@marc-hb
Copy link
Collaborator

marc-hb commented Sep 3, 2024

Please try this if you haven't yet:

#if defined(__ASSEMBLY__)

#ifndef UINT32_C
#define UINT32_C(x) x
#endif

#else

#ifndef __UINT32_C
#define __UINT32_C(x) x ## U
#endif
#ifndef UINT32_C
#define UINT32_C(x) __UINT32_C(x)
#endif

#endif // __ASSEMBLY__

I am NOT saying this is the "correct" and final solution but if it passes then it will great progress.

@saisurya-ch
Copy link
Member Author

saisurya-ch commented Sep 4, 2024

Please try this if you haven't yet:

#if defined(__ASSEMBLY__)

#ifndef UINT32_C
#define UINT32_C(x) x
#endif

#else

#ifndef __UINT32_C
#define __UINT32_C(x) x ## U
#endif
#ifndef UINT32_C
#define UINT32_C(x) __UINT32_C(x)
#endif

#endif // __ASSEMBLY__

I am NOT saying this is the "correct" and final solution but if it passes then it will great progress.

Below is the console output with the given code.

   ------
   acp_7_0
   ------
XTENSA_SYSTEM=/home/sai_surya/workspace/tools/acp_7_0/RI-2023.11-linux/ACP_7_0_HiFi5_NNE_PROD/config
Build in build_acp_7_0_xcc
PATH=/home/sai_surya/workspace/tools/acp_7_0/RI-2023.11-linux/XtensaTools/bin:/home/sai_surya/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/bin/remote-cli:/home/sai_surya/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
+ cmake -DTOOLCHAIN=xt -DSOF_CC_BASE=clang -DROOT_DIR=/home/sai_surya/workspace/tools/acp_7_0/RI-2023.11-linux/ACP_7_0_HiFi5_NNE_PROD/xtensa-elf -DMEU_OPENSSL= '' '' -DINIT_CONFIG=acp_7_0_defconfig -DEXTRA_CFLAGS= /home/sai_surya/workspace/sof_7_0_final
CMake Warning:
  Ignoring empty string ("") provided on the command line.


CMake Warning:
  Ignoring empty string ("") provided on the command line.


-- Found Python3: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter
-- Preparing Xtensa toolchain
-- The C compiler identification is Clang 10.0.1
-- The ASM compiler identification is GNU
-- Found assembler: /home/sai_surya/workspace/tools/acp_7_0/RI-2023.11-linux/XtensaTools/bin/xt-clang
-- Found Git: /usr/bin/git (found version "2.34.1")
-- SOF version.cmake starting at 2024-09-04T06:43:09Z UTC
-- /home/sai_surya/workspace/sof_7_0_final is at git commit with parent(s):
commit e50055e8a29805ba1a87f79a8d4111474754c231 7cf57e65b4b7d880f2f519b565fa58d624d0094c (HEAD -> main, origin/main, origin/HEAD)
Author: SaiSurya Ch <saisurya.chakkaveeravenkatanaga@amd.com>
Date:   Wed Aug 14 14:55:35 2024 +0530

    amd: Remove inclusion of unrequired header files.
    
    amd: Remove inclusion of unrequired header files.
    
    Signed-off-by: SaiSurya Ch <saisurya.chakkaveeravenkatanaga@amd.com>
fatal: No names found, cannot describe anything.
CMake Warning at scripts/cmake/version.cmake:70 (message):
  git describe found / nothing starting with 'v'.  Shallow clone?
Call Stack (most recent call first):
  CMakeLists.txt:101 (include)


-- GIT_TAG / GIT_LOG_HASH : v0.0-0-g0000 / e50055e8a
-- Source content hash: 5b4c8773. Notes:
  - by design, source hash is broken by Kconfig changes. See #3890.
  - Source hash is also broken by _asymmetric_ autocrlf=input, see
    #5917 and reverted #5920.
-- Generated new /home/sof/build_acp_7_0_xcc/generated/include/sof_versions.h
-- (Re-)generating /home/sof/build_acp_7_0_xcc/generated/.config
   and /home/sof/build_acp_7_0_xcc/generated/include/autoconfig.h
   from /home/sof/src/arch/xtensa/configs/acp_7_0_defconfig
warning: the int symbol CORE_COUNT (defined at src/platform/Kconfig:278) has a non-int default MP_MAX_NUM_CPUS (undefined)
-- Done, future changes to /home/sof/src/arch/xtensa/configs/acp_7_0_defconfig
   will be IGNORED by this build directory! The primary .config
   file is now 'generated/.config' in the build directory.
-- Configuring done (6.5s)
-- Generating done (0.0s)
-- Build files have been written to: /home/sof/build_acp_7_0_xcc
[  0%] cmake -P /home/sof/scripts/cmake/version.cmake
-- SOF version.cmake starting at 2024-09-04T06:43:09Z UTC
-- /home/sai_surya/workspace/sof_7_0_final is at git commit with parent(s):
commit e50055e8a29805ba1a87f79a8d4111474754c231 7cf57e65b4b7d880f2f519b565fa58d624d0094c (HEAD -> main, origin/main, origin/HEAD)
Author: SaiSurya Ch <saisurya.chakkaveeravenkatanaga@amd.com>
Date:   Wed Aug 14 14:55:35 2024 +0530

    amd: Remove inclusion of unrequired header files.
    
    amd: Remove inclusion of unrequired header files.
    
    Signed-off-by: SaiSurya Ch <saisurya.chakkaveeravenkatanaga@amd.com>
fatal: No names found, cannot describe anything.
CMake Warning at /home/sof/scripts/cmake/version.cmake:70 (message):
  git describe found / nothing starting with 'v'.  Shallow clone?


-- GIT_TAG / GIT_LOG_HASH : v0.0-0-g0000 / e50055e8a
-- Source content hash: 5b4c8773. Notes:
  - by design, source hash is broken by Kconfig changes. See #3890.
  - Source hash is also broken by _asymmetric_ autocrlf=input, see
    #5917 and reverted #5920.
-- Unchanged /home/sof/build_acp_7_0_xcc/generated/include/sof_versions.h
[  0%] Built target check_version_h
[  1%] Creating directories for 'smex_ep'
[  2%] No download step for 'smex_ep'
[  3%] No update step for 'smex_ep'
[  3%] No patch step for 'smex_ep'
[  3%] Performing configure step for 'smex_ep'
-- The C compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- No CMAKE_BUILD_TYPE, defaulting to Debug
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/sof/build_acp_7_0_xcc/smex_ep/build
[  4%] Performing build step for 'smex_ep'
[ 25%] Building C object CMakeFiles/smex.dir/elf.c.o
[ 50%] Building C object CMakeFiles/smex.dir/ldc.c.o
[ 75%] Building C object CMakeFiles/smex.dir/smex.c.o
[100%] Linking C executable smex
[100%] Built target smex
[  4%] No install step for 'smex_ep'
[  4%] Completed 'smex_ep'
[  4%] Built target smex_ep
[  5%] Generating generated/include/uuid-registry.h
[  5%] Built target uuid_reg_h
[  5%] Built target genconfig
[  5%] Building C object src/init/CMakeFiles/ext_manifest.dir/ext_manifest.c.o
[  6%] Linking C static library libext_manifest.a
[  6%] Built target ext_manifest
[  6%] Generating linker script: /home/sof/build_acp_7_0_xcc/acp_7_0.x
[  6%] Built target ld_script_acp_7_0.x
[  7%] Building ASM object src/arch/xtensa/CMakeFiles/reset.dir/xtos/memctl_default.S.o
[  7%] Building ASM object src/arch/xtensa/CMakeFiles/reset.dir/xtos/reset-vector.S.o
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h: Assembler messages:
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: found 'U', expected: ')'
/home/sof/src/arch/xtensa/include/xtensa/xtruntime-frames.h:128: Error: junk at end of line, first unrecognized character is `U'
clang-10: error: Xtensa-as command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [src/arch/xtensa/CMakeFiles/reset.dir/build.make:90: src/arch/xtensa/CMakeFiles/reset.dir/xtos/reset-vector.S.o] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:1606: src/arch/xtensa/CMakeFiles/reset.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:1931: src/arch/xtensa/CMakeFiles/bin.dir/rule] Error 2
gmake: *** [Makefile:715: bin] Error 2

@marc-hb
Copy link
Collaborator

marc-hb commented Sep 4, 2024

My bad, can you try this instead: #if defined(_ASMLANGUAGE) || defined(__ASSEMBLER__)

@saisurya-ch
Copy link
Member Author

My bad, can you try this instead: #if defined(_ASMLANGUAGE) || defined(__ASSEMBLER__)

works fine with #if defined(_ASMLANGUAGE)
Thanks @marc-hb

@paulstelian97 Hope removing the condition #if defined(__ZEPHYR__) is fine. Please do check the commit.

@@ -42,17 +42,22 @@
* building SOF with Zephyr and XtensaTools.
*/

#if defined(__ZEPHYR__)
#if defined(_ASMLANGUAGE)
Copy link
Collaborator

@marc-hb marc-hb Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if defined(_ASMLANGUAGE)
#if defined(_ASMLANGUAGE) || defined(__ASSEMBLER__)

like in zephyrproject-rtos/zephyr@f7538f0

That Zephyr commit is from 2017 so it has stood the test of time.

EDIT: just realized the same condition is already used in the same file...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@saisurya-ch saisurya-ch force-pushed the vangoogh_docker branch 2 times, most recently from 7a7fb57 to 8a4e96b Compare September 4, 2024 17:42
@marc-hb
Copy link
Collaborator

marc-hb commented Sep 4, 2024

Still does not work because src/arch/xtensa/xtos/exc-sethandler.c (and maybe others) somehow include stdint.h AFTER src/arch/xtensa/include/xtensa/config/core.h

Now we finally understand why @paulstelian97 used ifdef __ZEPHYR__ in #7538

https://github.com/thesofproject/sof/actions/runs/10706803167/job/29685346073?pr=9413

[ 20%] Building C object src/arch/xtensa/xtos/CMakeFiles/xtos.dir/exc-sethandler.c.o
In file included from /home/sof/work/sof.git/src/arch/xtensa/include/arch/lib/cache.h:22,
                 from /home/sof/work/sof.git/xtos/include/rtos/cache.h:17,
                 from /home/sof/work/sof.git/src/platform/imx8m/include/platform/lib/memory.h:13,
                 from /home/sof/work/sof.git/xtos/include/sof/lib/memory.h:11,
                 from /home/sof/work/sof.git/src/arch/xtensa/xtos/xtos-internal.h:34,
                 from /home/sof/work/sof.git/src/arch/xtensa/xtos/exc-sethandler.c:28:
/home/sof/work/sof.git/../xtensa-root/xtensa-imx8m-elf/include/stdint.h:468: error: "UINT32_C" redefined [-Werror]
  468 | #define UINT32_C(x) x##UL
      | 
In file included from /home/sof/work/sof.git/src/arch/xtensa/xtos/exc-sethandler.c:27:
/home/sof/work/sof.git/src/arch/xtensa/include/xtensa/config/core.h:57: note: this is the location of the previous definition
   57 | #define UINT32_C(x) __UINT32_C(x)
      | 
cc1: all warnings being treated as errors
exc-sethandler.c

#include <xtensa/config/core.h>
#include "xtos-internal.h"

Copy link
Collaborator

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try changing the include order in exc-sethandler.c in a first, separate commit?

It seems to be the only file failing now?

Including more generic headers before more specific ones cannot hurt.

--- a/src/arch/xtensa/xtos/exc-sethandler.c
+++ b/src/arch/xtensa/xtos/exc-sethandler.c
@@ -24,8 +24,8 @@
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */

-#include <xtensa/config/core.h>
 #include "xtos-internal.h"
+#include <xtensa/config/core.h>


 #if XCHAL_HAVE_EXCEPTIONS

@@ -42,17 +42,22 @@
* building SOF with Zephyr and XtensaTools.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update that comment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rephrase? IMHO this update just makes it more confusing than it already was, suggest something like:

"xt-clang platform headers use this (ISO C) macro to define constants, which appends a "U" suffix to force the type of the literal constant. But those headers end up getting included in assembly files which don't support that syntax. Fake the API for assembly builds here in the SOF toolchain layer."

Copy link
Collaborator

@marc-hb marc-hb Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it's not just Zephyr now. And it never was ACP7-specific.

@andyross
Copy link
Contributor

andyross commented Sep 4, 2024

(oops, was dismissing my own -1 because it's been explained now as an assembler error that doesn't understand the same literal syntax...

...and misclicked and dismissed @marc-hb's instead! Obviously I can't replace that, but please don't merge until he has a chance to replace the review)

Invert the header file inclusion order.

Signed-off-by: SaiSurya Ch <saisurya.chakkaveeravenkatanaga@amd.com>
Add UINT32_C definition required for core file of platform ACP_7_0.

Signed-off-by: SaiSurya Ch <saisurya.chakkaveeravenkatanaga@amd.com>
@marc-hb
Copy link
Collaborator

marc-hb commented Sep 5, 2024

Still failing in interrupt.h https://github.com/thesofproject/sof/actions/runs/10720712046/job/29727555760?pr=9413

Again, changing the include order fixes it for me, see below.

Please test locally with ./scripts/docker-run.sh ./scripts/xtensa-build-all.sh -a [ -j1 ] before force-pushing.

Please take the time to write good and accurate commit messages and comments. This is brittle and will likely fail again.

I lost track sorry: are you sure you cannot just #include <stdint.h> somewhere instead of painfully duplicating UINT32_C that comes with it? Was that failing, when and how?

--- sof/src/arch/xtensa/include/arch/drivers/interrupt.h
+++ sof/src/arch/xtensa/include/arch/drivers/interrupt.h
@@ -10,11 +10,12 @@
 #ifndef __ARCH_DRIVERS_INTERRUPT_H__
 #define __ARCH_DRIVERS_INTERRUPT_H__

-#include <xtensa/hal.h>
-#include <xtensa/xtruntime.h>
 #include <stddef.h>
 #include <stdint.h>

+#include <xtensa/hal.h>
+#include <xtensa/xtruntime.h>
+

marc-hb added a commit to marc-hb/sof that referenced this pull request Sep 5, 2024
xt-clang uses UINT32_C() without importing it.  Commit ef38a0c
("arch: xtensa: core.h: Add define for UINT32_C") added it but only for
__ZEPHYR__, add it unconditionally.

Provide an alternative, assembly-compatible definition apparently needed
by XTOS ACP 7.0 compiled with xt-clang.

For C code, simply include <stdint.h>

Longer and convoluted story in thesofproject#9413.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@marc-hb
Copy link
Collaborator

marc-hb commented Sep 5, 2024

I lost track sorry: are you sure you cannot just #include <stdint.h> somewhere instead of painfully duplicating UINT32_C that comes with it? Was that failing, when and how?

@saisurya-ch can you please try my brand new #9442 instead with your toolchain? It includes <stdint.h> except in assembly. It works with every toolchain I have available and compiles in CI. It does not seem to rely on special #include ordering. The jury is still out for solving world hunger.

@saisurya-ch
Copy link
Member Author

saisurya-ch commented Sep 5, 2024

#9442 works fine with my toolchain.
Thanks @marc-hb

@marc-hb
Copy link
Collaborator

marc-hb commented Sep 5, 2024

#9442 works fine with my toolchain.

Awesome! can you please approve it?

@saisurya-ch saisurya-ch closed this Sep 5, 2024
kv2019i pushed a commit that referenced this pull request Sep 6, 2024
xt-clang uses UINT32_C() without importing it.  Commit ef38a0c
("arch: xtensa: core.h: Add define for UINT32_C") added it but only for
__ZEPHYR__, add it unconditionally.

Provide an alternative, assembly-compatible definition apparently needed
by XTOS ACP 7.0 compiled with xt-clang.

For C code, simply include <stdint.h>

Longer and convoluted story in #9413.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants