Build Error: Couldn't Find Target Config ...json

Hi,

I am experiencing a new build error after updating some application code, but my co-workers are not experiencing this same error on their machines and I cannot seem to mitigate it on mine. I pulled in some new LED driver code for our project that uses a MAX8647 LED Driver user-built zephyr driver. The driver has been placed in a local folder in the project folder (as we are not yet ready to integrate into the main Zephyr branch). As mentioned, these files build and work properly on two other co-workers machines/environments, so it seems something is preventing my setup from properly loading this driver. The build output can be seen below with only the project filepath editted. The MAX8647 driver files are located in “…\myprojectdir\drivers\led”. I know that this is something with the MAX8647 driver because if I set CONFIG_MAX8647=n in my prj.conf file, then I get a different output as also seen below. After multiple different attempts, I am still unable to get my project to build again.

I have attempted:

  1. Re-installing PlatformIO extension in VSCode
  2. Removing the main .platformio folder and letting it be re-populated.
  3. Replacing the application files.
  4. Ensuring my includePath is updated with the drivers/led path in c_cpp_properties.json.

Build Output:
"Error: Processing nrf52833_dk (platform: nordicnrf52@7.1.0; board: nrf52833_dk; framework: zephyr)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: Redirecting...
PLATFORM: Nordic nRF52 (7.1.0) > Nordic nRF52833-DK
HARDWARE: NRF52833 64MHz, 128KB RAM, 512KB Flash
DEBUG: Current (jlink) On-board (cmsis-dap, jlink) External (blackmagic, stlink)
PACKAGES:

  • framework-zephyr @ 2.20500.210226 (2.5.0)
  • framework-zephyr-canopennode @ 0.0.0-alpha+sha.468d350028
  • framework-zephyr-civetweb @ 0.0.0-alpha+sha.e6903b80c0
  • framework-zephyr-cmsis @ 0.0.0-alpha+sha.c3bd2094f9
  • framework-zephyr-fatfs @ 0.0.0-alpha+sha.1d1fcc725a
  • framework-zephyr-hal-nordic @ 0.0.0-alpha+sha.f0d54d8449
  • framework-zephyr-hal-st @ 0.0.0-alpha+sha.b52fdbf4b6
  • framework-zephyr-libmetal @ 0.0.0-alpha+sha.9d4ee2c3cf
  • framework-zephyr-littlefs @ 0.0.0-alpha+sha.9e4498d1c7
  • framework-zephyr-loramac-node @ 0.0.0-alpha+sha.3f545d76a2
  • framework-zephyr-lvgl @ 0.0.0-alpha+sha.31acbaa36e
  • framework-zephyr-mbedtls @ 0.0.0-alpha+sha.24d84ecff1
  • framework-zephyr-mcuboot @ 0.0.0-alpha+sha.3fc59410b6
  • framework-zephyr-mcumgr @ 0.0.0-alpha+sha.43845e883f
  • framework-zephyr-mipi-sys-t @ 0.0.0-alpha+sha.75e671550a
  • framework-zephyr-open-amp @ 0.0.0-alpha+sha.de1b85a130
  • framework-zephyr-openthread @ 0.0.0-alpha+sha.1d668284a0
  • framework-zephyr-segger @ 0.0.0-alpha+sha.38c79a447e
  • framework-zephyr-sof @ 0.0.0-alpha+sha.b5b772dd61
  • framework-zephyr-tfm-mcuboot @ 1.7.0-rc1
  • framework-zephyr-tinycbor @ 0.0.0-alpha+sha.40daca97b4
  • framework-zephyr-tinycrypt @ 0.0.0-alpha+sha.3e9a49d267
  • framework-zephyr-trusted-firmware-m @ 0.0.0-alpha+sha.96340fb6c0
  • tool-cmake @ 3.16.4
  • tool-dtc @ 1.4.7
  • tool-ninja @ 1.9.0
  • tool-sreccat @ 1.164.0 (1.64)
  • toolchain-gccarmnoneeabi @ 1.80201.190214 (8.2.1)
    Error: Couldn’t find target config target-……__myprojectdir__drivers__led-3ae2b57157f6097099b8.json
    ==================================================================================================== [FAILED] Took 2.71 seconds ===================================================================================================="

Build output when CONFIG_MAX8647=n:
“CMake Error at C:/Users/me/.platformio/packages/framework-zephyr/cmake/extensions.cmake:416 (add_library):
No SOURCES given to target:
…__myprojectdir__drivers__led”

I appreciate any assistance that can be provided.

Thanks,
Jared

Is the drivers/led a folder in the project? Does it contain any source files?

Yes, the folder is located in the root of the project. It contains a CMakeLists.txt file, a Kconfig file, a max8647.c driver file, and also a subfolder called zephyr/ which contains a module.yaml file.

Thanks,
Jared

Can you try to create a minimal project with what you think might be causing the error? In particular the drivers folder and CMake files etc. If that fails, devs can have a look at it.

Yes, I can try to do that.

In the meantime, can you tell me what that .json file is being generated from? Is that a PlatformIO configuration file?

PlatformIO calls into CMake for building Zephyr-based firmwares (see C:\Users\<user>\.platformio\packages\framework-zephyr\scripts\platformio). to my knowledge it does not create that JSON file itself. It is probably generated in the CMake build process under certain conditions.

So that build error is likely generated by CMake as well, or is this an error handled by PlatformIO? It would be nice to know the conditions that can cause that error to be thrown.

It looks like I have figured out my issue. I noticed while copying my platformIO project folder that I got Windows errors about a filepath being too long. This led me to try and move my project directory up a few levels to a folder directly under the C:\ drive. After a few iterations of simplifying the project down and moving around, I was able to eventually build my same original repository version in this new higher level directory.

So, there must be something in CMake that was not happy with the character length of the filepath of the newly added MAX8647 driver files/folders which caused it to throw this error. Would’ve been alot more helpful if it would have thrown a warning or error indicating this instead of the “Error: Couldn’t find target config target-” error, though perhaps this json file was not generated due to filepath length and thus resulted in this error.

If there are any other details I can provide for this to be helpful, please let me know. But it looks like the root issue has at least been discovered.

Thanks,
Jared

Please Enable Win32 Long Paths and retry in the original path.

So I did try enabling Win32 Long Paths and the original directory did then work. However, I also disabled it again to verify this was the fix, and it is still building successfully.

I am realizing there was one other thing which I had done differently which was that I instead of pulling the repo down from git manually then opening that directory in VSCode, I instead had discovered and used the “Clone Git Project” tool in PlatformIO->Quick Access->Miscellaneous. I am wondering now if perhaps this contributed to my issue going away. Unless there is something with enabling Win32 Long Paths that persists even when disabling it without a reboot. I am unable to perform a reboot at this time, but could try this later tonight to verify.

Thanks,
Jared