nRF5340_Audio Build Error

Hello All,

Just to begin, I am an extreme novice when it comes to building/flashing FW so if I do not provide enough description or ask questions that may seem a bit surface level please keep that in mind, but I am happy to provide more info anything else that is needed to help with debugging!

I believe I have the prerequisites installed and I am trying to build the nrf5340_audio sample application, but when I run the following command:

python buildprog.py -c app -b release -d gateway

I get the following log and errors:

C:\Users\samietz\Desktop\nrf5340_audio_test\tools\buildprog>python buildprog.py -c app -b release -d gateway
+------------+----------+---------+--------------+---------------------+---------------------+
|    snr     | snr conn |  device | only reboot  | core app programmed | core net programmed |
+------------+----------+---------+--------------+---------------------+---------------------+
|    1000    |  ←[33mFalse←[0m   | headset | Not selected |     Not selected    |     Not selected    |
| 1050159080 |   ←[32mTrue←[0m   | gateway | Not selected |     Selected TBD    |     Not selected    |
|    1000    |  ←[33mFalse←[0m   | headset | Not selected |     Not selected    |     Not selected    |
+------------+----------+---------+--------------+---------------------+---------------------+
Invoking build step
Run: west build C:\Users\samietz\Desktop\nrf5340_audio_test -b nrf5340_audio_dk_nrf5340_cpuapp -d C:\Users\samietz\Desktop\nrf5340_audio_test\build\dev_gateway\build_release
-- west build: generating a build system
Traceback (most recent call last):
  File "c:\python38\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\python38\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Python38\Scripts\west.exe\__main__.py", line 7, in <module>
  File "c:\python38\lib\site-packages\west\app\main.py", line 793, in main
    app.run(argv or sys.argv[1:])
  File "c:\python38\lib\site-packages\west\app\main.py", line 109, in run
    self.run_command(argv)
  File "c:\python38\lib\site-packages\west\app\main.py", line 345, in run_command
    self.run_extension(args.command, argv)
  File "c:\python38\lib\site-packages\west\app\main.py", line 417, in run_extension
    command.run(args, unknown, self.topdir, manifest=self.manifest,
  File "c:\python38\lib\site-packages\west\commands.py", line 135, in run
    self.do_run(args, unknown)
  File "C:\Users\samietz\Desktop\nrf5340_audio_test\zephyr\scripts\west_commands\build.py", line 201, in do_run
    self._run_cmake(board, origin, self.args.cmake_opts)
  File "C:\Users\samietz\Desktop\nrf5340_audio_test\zephyr\scripts\west_commands\build.py", line 488, in _run_cmake
    run_cmake(final_cmake_args, dry_run=self.args.dry_run)
  File "C:\Users\samietz\Desktop\nrf5340_audio_test\zephyr\scripts/west_commands\zcmake.py", line 45, in run_cmake
    _ensure_min_version(cmake, dry_run)
  File "C:\Users\samietz\Desktop\nrf5340_audio_test\zephyr\scripts/west_commands\zcmake.py", line 277, in _ensure_min_version
    version_out = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
  File "c:\python38\lib\subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "c:\python38\lib\subprocess.py", line 489, in run
    with Popen(*popenargs, **kwargs) as process:
  File "c:\python38\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "c:\python38\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 193] %1 is not a valid Win32 application
Traceback (most recent call last):
  File "C:\Users\samietz\Desktop\nrf5340_audio_test\tools\buildprog\buildprog.py", line 417, in <module>
    __main()
  File "C:\Users\samietz\Desktop\nrf5340_audio_test\tools\buildprog\buildprog.py", line 400, in __main
    __build_module(build_cfg, options)
  File "C:\Users\samietz\Desktop\nrf5340_audio_test\tools\buildprog\buildprog.py", line 149, in __build_module
    raise Exception("cmake error: " + str(ret_val))
Exception: cmake error: 1

This was done while following the instructions here: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/nrf5340_audio/README.html#building-and-programming-using-script.

I have also tried building via the command line and also receive an error, but it's not the same as the above:

samietz@samietz0 MINGW64 ~/Desktop/nrf5340_audio_test
$ west build -b nrf5340_audio_dk_nrf5340_cpuapp --pristine -DCONFIG_AUDIO_DEV=2 -DCONF_FILE=prj_release.conf
WARNING: ZEPHYR_BASE=C:\ncs\v2.0.1\zephyr in the calling environment will be used,
but the zephyr.base config option in C:\Users\samietz\Desktop\nrf5340_audio_test is "zephyr"
which implies a different ZEPHYR_BASE=C:\Users\samietz\Desktop\nrf5340_audio_test\zephyr
To disable this warning in the future, execute 'west config --global zephyr.base-prefer env'
ERROR: source directory -DCONFIG_AUDIO_DEV=2 does not exist
FATAL ERROR: refusing to proceed without --force due to above error

Without an in-depth understanding of what is actually going on here I am a bit lost as to what is going wrong. Any help would be greatly appreciated!

  • asamietz said:
    Thanks for the link to the fundamentals course in the DevZone, I think that would be great to check out. Being an EE only gave me brief exposure to the FW side of things.

    Great! :) The nRF Connect SDK development suite can seem quite a handful at first, but this course helps you get familiar with all the different fundamental aspects, so that you may leverage all their benefits (compared to the bare-metal SDK).

    asamietz said:
    I believe it was because I was using the west init command both without the repository as an argument and not in the initial ncs folder with the toolchain. With those repositories not being downloaded then build and flash were unrecognized commands.

    Ah, yes, this could also be the case if you do not perform the commands in an 'nRF Terminal(inside VSC press ctrl+shift+p and type 'terminal' to open one), or you could open a terminal through the Toolchain Manager drop-down menu option - in both these cases the terminal will be sourced from the correct environment right off the bat, as opposed to if you only open a separate powershell or cmd instance through your windows taskbar.

    Best regards,
    Karl

  • Just re-opening this thread as I have received access to the LC3 repository, but am still running some issues with the build step. I can locate the file needed for the build here C:\ncs\v2.0.1\modules\lib\lc3\src\sw_codec_lc3.c, but when building the application it still can't 'find' the file as seen in the error below:

    C:\ncs\v2.0.1\nrf\applications\nrf5340_audio\tools\buildprog>python3 buildprog.py -c both -b release -d both -p
    +------------+----------+---------+--------------+---------------------+---------------------+
    |    snr     | snr conn |  device | only reboot  | core app programmed | core net programmed |
    +------------+----------+---------+--------------+---------------------+---------------------+
    |    1000    |  ←[33mFalse←[0m   | headset | Not selected |     Selected TBD    |     Selected TBD    |
    | 1050159080 |   ←[32mTrue←[0m   | gateway | Not selected |     Selected TBD    |     Selected TBD    |
    |    1000    |  ←[33mFalse←[0m   | headset | Not selected |     Selected TBD    |     Selected TBD    |
    +------------+----------+---------+--------------+---------------------+---------------------+
    Invoking build step
    Net core uses precompiled hex
    Run: west build C:\ncs\v2.0.1\nrf\applications\nrf5340_audio -b nrf5340_audio_dk_nrf5340_cpuapp -d C:\ncs\v2.0.1\nrf\applications\nrf5340_audio\build\dev_headset\build_release
    [1/13] Building C object CMakeFiles/app.dir/src/audio/sw_codec_select.c.obj
    FAILED: CMakeFiles/app.dir/src/audio/sw_codec_select.c.obj
    C:\ncs\toolchains\v2.0.1\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DARM_ALL_FAST_TABLES -DARM_DSP_CONFIG_TABLES -DARM_FAST_ALLOW_TABLES -DARM_FFT_ALLOW_TABLES -DARM_TABLE_RECIP_Q15 -DARM_TABLE_RECIP_Q31 -DARM_TABLE_SIN_F32 -DARM_TABLE_SIN_Q15 -DARM_TABLE_SIN_Q31 -DGATEWAY=2 -DHEADSET=1 -DKERNEL -DNRF5340_XXAA_APPLICATION -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DUSE_PARTITION_MANAGER=0 -D_FORTIFY_SOURCE=2 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -IC:/ncs/v2.0.1/nrf/applications/nrf5340_audio/src/audio -IC:/ncs/v2.0.1/nrf/applications/nrf5340_audio/src/bluetooth -IC:/ncs/v2.0.1/nrf/applications/nrf5340_audio/src/drivers -IC:/ncs/v2.0.1/nrf/applications/nrf5340_audio/src/events -IC:/ncs/v2.0.1/nrf/applications/nrf5340_audio/src/modules -IC:/ncs/v2.0.1/nrf/applications/nrf5340_audio/src/utils -IC:/ncs/v2.0.1/nrf/applications/nrf5340_audio/src/utils/macros -IC:/ncs/v2.0.1/nrf/applications/nrf5340_audio/app -IC:/ncs/v2.0.1/nrf/boards/arm/nrf5340_audio_dk_nrf5340 -IC:/ncs/v2.0.1/zephyr/include/zephyr -IC:/ncs/v2.0.1/zephyr/include -IC:/ncs/v2.0.1/nrf/applications/nrf5340_audio/build/dev_headset/build_release/zephyr/include/generated -IC:/ncs/v2.0.1/zephyr/soc/arm/nordic_nrf/nrf53 -IC:/ncs/v2.0.1/zephyr/lib/libc/newlib/include -IC:/ncs/v2.0.1/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs/v2.0.1/zephyr/subsys/bluetooth -IC:/ncs/v2.0.1/zephyr/subsys/settings/include -IC:/ncs/v2.0.1/nrf/include -IC:/ncs/v2.0.1/modules/hal/cirrus-logic -IC:/ncs/v2.0.1/modules/hal/cirrus-logic/common -IC:/ncs/v2.0.1/modules/hal/cirrus-logic/common/bridge -IC:/ncs/v2.0.1/modules/hal/cirrus-logic/common/platform_bsp -IC:/ncs/v2.0.1/modules/hal/cirrus-logic/cs47l63 -IC:/ncs/v2.0.1/modules/hal/cirrus-logic/cs47l63/bsp -IC:/ncs/v2.0.1/modules/hal/cirrus-logic/cs47l63/config -IC:/ncs/v2.0.1/modules/hal/cirrus-logic/cs47l63/fw_pt -IC:/ncs/v2.0.1/modules/hal/cirrus-logic/cs47l63/generated -IC:/ncs/v2.0.1/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.0.1/modules/hal/cmsis/CMSIS/DSP/Include -IC:/ncs/v2.0.1/modules/hal/nordic/nrfx -IC:/ncs/v2.0.1/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.0.1/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.0.1/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/v2.0.1/nrf/applications/nrf5340_audio/build/dev_headset/build_release/modules/libmetal/libmetal/lib/include -IC:/ncs/v2.0.1/modules/lib/open-amp/open-amp/lib/include -IC:/ncs/v2.0.1/modules/debug/segger/SEGGER -IC:/ncs/v2.0.1/modules/debug/segger/Config -IC:/ncs/v2.0.1/zephyr/modules/segger/. -IC:/ncs/v2.0.1/modules/crypto/tinycrypt/lib/include -IC:/ncs/v2.0.1/nrfxlib/softdevice_controller/include -IC:/ncs/v2.0.1/modules/fs/fatfs/include -isystem C:/ncs/v2.0.1/nrfxlib/crypto/nrf_cc312_platform/include -Og -imacros C:/ncs/v2.0.1/nrf/applications/nrf5340_audio/build/dev_headset/build_release/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mfp16-format=ieee --sysroot=C:/ncs/toolchains/v2.0.1/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/v2.0.1/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-reorder-functions -fno-defer-pop -fstack-usage -fmacro-prefix-map=C:/ncs/v2.0.1/nrf/applications/nrf5340_audio=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v2.0.1/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v2.0.1=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=nano.specs -std=c99 -MD -MT CMakeFiles/app.dir/src/audio/sw_codec_select.c.obj -MF CMakeFiles\app.dir\src\audio\sw_codec_select.c.obj.d -o CMakeFiles/app.dir/src/audio/sw_codec_select.c.obj -c C:/ncs/v2.0.1/nrf/applications/nrf5340_audio/src/audio/sw_codec_select.c
    C:/ncs/v2.0.1/nrf/applications/nrf5340_audio/src/audio/sw_codec_select.c:15:10: fatal error: sw_codec_lc3.h: No such file or directory
       15 | #include "sw_codec_lc3.h"
          |          ^~~~~~~~~~~~~~~~
    compilation terminated.
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\Python38\Scripts\cmake.EXE' --build 'C:\ncs\v2.0.1\nrf\applications\nrf5340_audio\build\dev_headset\build_release'
    Traceback (most recent call last):
      File "buildprog.py", line 417, in <module>
        __main()
      File "buildprog.py", line 400, in __main
        __build_module(build_cfg, options)
      File "buildprog.py", line 149, in __build_module
        raise Exception("cmake error: " + str(ret_val))
    Exception: cmake error: 1


    I have ran 'west update' and 'west zephyr-export' before the build command, but still see this error. Am I pointing to a wrong location where the build script looks for the file or is something else wrong here?

  • Ok, I see the build application is actually looking for the header file, but I still can locate that on my local machine here: C:\ncs\v2.0.1\modules\lib\lc3\include\sw_codec_lc3.h

  • Did some more digging and came upon this ticket:  RE: When compiling nef5340 audio device, LC3 encoding and decoding mode is selected, and the header device is not available
    It mentioned adding the LC3 file to the directory where the application is located so I did that as well as adding the following code to the make file:

    ${CMAKE_CURRENT_SOURCE_DIR}/lc3

    It was able to build and I am now able to stream the LC3 audio!

  • Hello,

    I am glad to read that you now have got the LC3 access, and that you are able to stream the LC3 audio - great! :) 

    Please do not hesitate to open another ticket if you should encounter any issues or questions, we're happy to help!

    Best regards,
    Karl

Related