Hi,
I am playing with the nRF5340 Audio Application and trying to read several mics and saving these audio files somewhere. There is an issue open for that here. With the cues you gave I could read and listen to the read audio in the same board (some help from the Cirrus windows SW), so I created a new application based on some files from the audio app, namely hw_codec.c and .h, cs47l63_comm.c and .h and cs47l63_reg_conf.
The issues I am facing to build this new application are probably related only to my poor knowledge on the sdk, so I opened this new issue to understand these error I have.
My first couple of errors came from functions within the headers I used, such as:
/Users/joaovitor/Documents/VSCode/Tiresias/microphone_read/src/hw_codec.c:123: undefined reference to `cs47l63_write_reg’ /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(hw_codec.c.obj): in function `hw_codec_init': /Users/joaovitor/Documents/VSCode/Tiresias/microphone_read/src/hw_codec.c:180: undefined reference to `cs47l63_comm_init’ collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.
The workaround was including every c file in the project directory as targets and have all the referenced header directories included in the CMakeLists.txt file:
# # Copyright (c) 2024 Nordic Semiconductor # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(microphone_read) target_sources(app PRIVATE src/main.c src/drivers/cs47l63_comm.c ${ZEPHYR_CIRRUS_LOGIC_MODULE_DIR}/cs47l63/cs47l63.c ${ZEPHYR_CIRRUS_LOGIC_MODULE_DIR}/common/regmap.c ${ZEPHYR_CIRRUS_LOGIC_MODULE_DIR}/cs47l63/generated/cs47l63_syscfg_regs.c ) # Add the main directory and its subdirectories to the include directories include_directories( /opt/nordic/ncs/v2.6.0-rc2/modules/hal/cirrus-logic /opt/nordic/ncs/v2.6.0-rc2/modules/hal/cirrus-logic/common /opt/nordic/ncs/v2.6.0-rc2/modules/hal/cirrus-logic/cs47l63 /opt/nordic/ncs/v2.6.0-rc2/modules/hal/cirrus-logic/cs47l63/config /opt/nordic/ncs/v2.6.0-rc2/modules/hal/cirrus-logic/cs47l63/generated # Add more directories as needed )
It does not look as the right way to do it, so this is my first question - what is the best way to show the compiler the referenced header files?
Nevertheless, I could fix the errors, but then I came to another one, for which I couldn't find any solution. I have an error that seems to be unrelated to my application:
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. Compiler: /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc Build flags: Id flags: The output was: 1 /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/lib/libc.a(lib_a-exit.o): in function `exit': exit.c:(.text.exit+0x34): undefined reference to `_exit' collect2: error: ld returned 1 exit status Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-g++ Build flags: Id flags: The output was: 1 /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/lib/libc.a(lib_a-exit.o): in function `exit': exit.c:(.text.exit+0x34): undefined reference to `_exit' collect2: error: ld returned 1 exit status
This issue is similar but didn't solve my problem. So my second question is what do I do to solve this problem??
I'll attach my application folder.
Best regards!
SDK version: 2.6.0
Build target: nRF5340 Audio DK
OS: MacOS Sonoma 14.1.2