Unknown CMake command "idf_build_get_property".

xXWesleyXx eckz
Posts: 4
Joined: Fri Jun 10, 2022 12:12 pm

Unknown CMake command "idf_build_get_property".

Postby xXWesleyXx eckz » Fri Jun 10, 2022 12:30 pm

hello,

i'd like to start off saying i'm an intern with no ESP programming experience so please forgive because I this question will probably not be asked correctly.

We have a bunch of code that has been in an ESP32 before but that has been done by an external company and they won't share a thing unless they get a lot of money.
So i've been trying to do this for the past 2 weeks but VSCode keeps nagging about a million different things.
The thing that bullies me currently is the following message:
  1. CMake Error at C:/Users/Wesley/esp/esp-idf/components/freertos/CMakeLists.txt:7 (idf_build_get_property):
  2.   Unknown CMake command "idf_build_get_property".
I've been googling and googling but I cannot find anything on how to get this command to work.
I could go and change all the CMakeLists but then it gets very frustrating again when I want to use a new/different version of esp-idf.
Also that's a lot of CMakeLists to change.

This is my root makelist:
  1. cmake_minimum_required(VERSION 3.0)
  2.  
  3. #include($ENV{IDF_PATH}/tools/cmake/project.cmake)
  4.  
  5. project(main)
  6.  
  7. add_subdirectory($ENV{IDF_PATH}/components/freertos include EXCLUDE_FROM_ALL)
  8.  
  9. #include_directories(${PROJECT_SOURCE_DIR}/include)
  10. #include_directories($ENV{IDF_PATH}/components/freertos)
  11. #include_directories($ENV{IDF_PATH}/components/esp_common)
  12. #include_directories($ENV{IDF_PATH}/components/xtensa)
  13. #include_directories($ENV{IDF_PATH}/components/esp_rom)
  14. #include_directories($ENV{IDF_PATH}/components/esp_timer)
  15.  
  16. add_executable(main ${CMAKE_CURRENT_SOURCE_DIR}/main.c)
And this is the file that causes trouble:
  1. if(BOOTLOADER_BUILD)
  2.     # bootloader only needs FreeRTOS for config, not for anything else
  3.     idf_component_register()
  4.     return()
  5. endif()
  6.  
  7. idf_build_get_property(target IDF_TARGET)
  8.  
  9. if(CONFIG_FREERTOS_SMP)
  10.     if(CONFIG_IDF_TARGET_ARCH_XTENSA)
  11.         set(srcs
  12.             "FreeRTOS-Kernel-SMP/portable/xtensa/port.c"
  13.             "FreeRTOS-Kernel-SMP/portable/xtensa/portasm.S"
  14.             "FreeRTOS-Kernel-SMP/portable/xtensa/xtensa_context.S"
  15.             "FreeRTOS-Kernel-SMP/portable/xtensa/xtensa_init.c"
  16.             "FreeRTOS-Kernel-SMP/portable/xtensa/xtensa_overlay_os_hook.c"
  17.             "FreeRTOS-Kernel-SMP/portable/xtensa/xtensa_vector_defaults.S"
  18.             "FreeRTOS-Kernel-SMP/portable/xtensa/xtensa_vectors.S")
  19.  
  20.         set(include_dirs
  21.             "FreeRTOS-Kernel-SMP/include" # FreeRTOS headers via #include "freertos/xxx.h"
  22.             "esp_additions/include/freertos" # For config via #include "FreeRTOSConfig.h"
  23.             "FreeRTOS-Kernel-SMP/portable/xtensa/include" # Xtensa/Arch Config headers via #include "freertos/xxx.h"
  24.             "esp_additions/include" # For #include "freertos/task_snapshot.h" and #include "freertos/FreeRTOSConfig.h"
  25.             "FreeRTOS-Kernel-SMP/portable/xtensa/include/freertos") # Xtensa headers via #include "xxx.h"
  26.  
  27.         set(private_include_dirs
  28.             "FreeRTOS-Kernel-SMP/portable/xtensa/include/freertos"
  29.             "FreeRTOS-Kernel-SMP/portable/xtensa"
  30.             .)
  31.     endif()
  32.  
  33.     list(APPEND srcs
  34.         "FreeRTOS-Kernel-SMP/croutine.c"
  35.         "FreeRTOS-Kernel-SMP/event_groups.c"
  36.         "FreeRTOS-Kernel-SMP/list.c"
  37.         "FreeRTOS-Kernel-SMP/queue.c"
  38.         "FreeRTOS-Kernel-SMP/tasks.c"
  39.         "FreeRTOS-Kernel-SMP/timers.c"
  40.         "FreeRTOS-Kernel-SMP/stream_buffer.c"
  41.         "FreeRTOS-openocd.c"
  42.         )
  43.  
  44.     list(APPEND private_include_dirs
  45.         "FreeRTOS-Kernel-SMP/include/freertos"   # FreeRTOS headers via #include "xxx.h"
  46.         "esp_additions/private_include")    # For include "freertos_tasks_c_additions.h"
  47.  
  48.     if(CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY)
  49.         list(APPEND srcs "FreeRTOS-Kernel-SMP/portable/xtensa/xtensa_loadstore_handler.S")
  50.     endif()
  51.  
  52. else()
  53.     if(CONFIG_IDF_TARGET_ARCH_XTENSA)
  54.         set(srcs
  55.             "FreeRTOS-Kernel/portable/xtensa/port.c"
  56.             "FreeRTOS-Kernel/portable/xtensa/portasm.S"
  57.             "FreeRTOS-Kernel/portable/xtensa/xtensa_context.S"
  58.             "FreeRTOS-Kernel/portable/xtensa/xtensa_init.c"
  59.             "FreeRTOS-Kernel/portable/xtensa/xtensa_overlay_os_hook.c"
  60.             "FreeRTOS-Kernel/portable/xtensa/xtensa_vector_defaults.S"
  61.             "FreeRTOS-Kernel/portable/xtensa/xtensa_vectors.S")
  62.  
  63.         set(include_dirs
  64.             FreeRTOS-Kernel/include
  65.             esp_additions/include/freertos          # For files with #include "FreeRTOSConfig.h"
  66.             FreeRTOS-Kernel/portable/xtensa/include # For arch-specific FreeRTOSConfig_arch.h in portable/<arch>/include
  67.             esp_additions/include)                  # For files with #include "freertos/FreeRTOSConfig.h"
  68.  
  69.         set(private_include_dirs
  70.             FreeRTOS-Kernel/portable/xtensa/include/freertos
  71.             FreeRTOS-Kernel/portable/xtensa
  72.             FreeRTOS-Kernel/portable/priv_include
  73.             .)
  74.  
  75.     elseif(CONFIG_IDF_TARGET_ARCH_RISCV)
  76.         set(srcs
  77.             "FreeRTOS-Kernel/portable/riscv/port.c"
  78.             "FreeRTOS-Kernel/portable/riscv/portasm.S")
  79.  
  80.         set(include_dirs
  81.             FreeRTOS-Kernel/include
  82.             esp_additions/include/freertos          # For files with #include "FreeRTOSConfig.h"
  83.             FreeRTOS-Kernel/portable/riscv/include  # For arch-specific FreeRTOSConfig_arch.h in portable/<arch>/include
  84.             esp_additions/include)                  # For files with #include "freertos/FreeRTOSConfig.h"
  85.  
  86.         set(private_include_dirs
  87.             FreeRTOS-Kernel/portable/riscv/include/freertos
  88.             FreeRTOS-Kernel/portable/riscv
  89.             FreeRTOS-Kernel/portable/priv_include
  90.             .)
  91.  
  92.     endif()
  93.  
  94.     list(APPEND srcs
  95.         "FreeRTOS-Kernel/portable/port_common.c"
  96.         "FreeRTOS-Kernel/portable/port_systick.c"
  97.         "FreeRTOS-Kernel/croutine.c"
  98.         "FreeRTOS-Kernel/event_groups.c"
  99.         "FreeRTOS-Kernel/list.c"
  100.         "FreeRTOS-Kernel/queue.c"
  101.         "FreeRTOS-Kernel/tasks.c"
  102.         "FreeRTOS-Kernel/timers.c"
  103.         "FreeRTOS-Kernel/stream_buffer.c"
  104.         "FreeRTOS-openocd.c"
  105.         "esp_additions/freertos_v8_compat.c")
  106.  
  107.     list(APPEND private_include_dirs
  108.         "FreeRTOS-Kernel/include/freertos"
  109.         "esp_additions/private_include")    # For include "freertos_tasks_c_additions.h"
  110.  
  111.     if(CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY)
  112.         list(APPEND srcs "FreeRTOS-Kernel/portable/xtensa/xtensa_loadstore_handler.S")
  113.     endif()
  114. endif()
  115.  
  116. idf_component_register(SRCS "${srcs}"
  117.                     INCLUDE_DIRS ${include_dirs}
  118.                     PRIV_INCLUDE_DIRS  ${private_include_dirs}
  119.                     LDFRAGMENTS linker.lf
  120.                     PRIV_REQUIRES soc esp_pm)
  121.  
  122. idf_component_get_property(COMPONENT_DIR freertos COMPONENT_DIR)
  123. idf_component_set_property(freertos ORIG_INCLUDE_PATH "${COMPONENT_DIR}/include/freertos/")
  124.  
  125. if(CONFIG_FREERTOS_DEBUG_OCDAWARE)
  126.     target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--undefined=uxTopUsedPriority") #will be removed
  127.     target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--undefined=FreeRTOS_openocd_params")
  128.     idf_build_set_property(COMPILE_OPTIONS "-DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1" APPEND)
  129. endif()
  130.  
  131. set_source_files_properties(
  132.     tasks.c
  133.     event_groups.c
  134.     timers.c
  135.     queue.c
  136.     stream_buffer.c
  137.     PROPERTIES COMPILE_DEFINITIONS
  138.     _ESP_FREERTOS_INTERNAL
  139.     )
  140.  
  141. # The freertos component provides the `start_app` and `start_app_other_cores`
  142. # if it is included in the build. It then calls `app_main`
  143. # from the main task created, which must be provided by the user.
  144. # Like for `start_app` and `start_app_other_cores`,
  145. # we can't establish dependency on what we don't yet know, so we force the
  146. # linker to not drop this symbol.
  147. target_link_libraries(${COMPONENT_LIB} INTERFACE "-u app_main")
  148.  
  149. if(CONFIG_APPTRACE_SV_ENABLE)
  150.     # FreeRTOS headers have a dependency on app_trace when SystemView tracing is enabled
  151.     idf_component_optional_requires(PUBLIC app_trace)
  152. elseif(CONFIG_APPTRACE_ENABLE)
  153.     # [refactor-todo]: port.c has a dependency on esp_apptrace_init, for running it on APP CPU.
  154.     # this should be resolved when link-time registration of startup functions is added.
  155.     idf_component_optional_requires(PRIVATE app_trace)
  156. endif()
  157.  
  158. if(CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME)
  159.     # [refactor-todo]: port.c esp_startup_start_app_common() calls esp_gdbstub_init()
  160.     idf_component_optional_requires(PRIVATE esp_gdbstub)
  161. endif()
  162.  
  163. if(CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER)
  164.     # [refactor-todo]: esp_timer is required by FreeRTOS when we use esp_timer_get_time() to do profiling
  165.     # Introduce a port wrapper function to avoid including esp_timer.h into the public header
  166.     idf_component_optional_requires(PUBLIC esp_timer)
  167. endif()
EVERY freaking tutorial on the internet isn't fixing this problem and it's making my blood boil.
How in the name of Freddie Mercury can I get this and similar idf_blah commands to work

Regards,

Wesley

PS if you need more info please ask and I will try to supply it.

ESP_Sprite
Posts: 9589
Joined: Thu Nov 26, 2015 4:08 am

Re: Unknown CMake command "idf_build_get_property".

Postby ESP_Sprite » Sat Jun 11, 2022 2:03 am

#include "bla" is C for 'include this'. #include "bla" in CMake is 'the following is a comment and should be disregarded: include "bla"'

xXWesleyXx eckz
Posts: 4
Joined: Fri Jun 10, 2022 12:12 pm

Re: Unknown CMake command "idf_build_get_property".

Postby xXWesleyXx eckz » Mon Jun 13, 2022 7:47 am

ESP_Sprite wrote:
Sat Jun 11, 2022 2:03 am
#include "bla" is C for 'include this'. #include "bla" in CMake is 'the following is a comment and should be disregarded: include "bla"'
I know what a comment is, that wasn't what I asked about, ignore the comments.

ESP_Sprite
Posts: 9589
Joined: Thu Nov 26, 2015 4:08 am

Re: Unknown CMake command "idf_build_get_property".

Postby ESP_Sprite » Mon Jun 13, 2022 8:34 am

So why did you comment out 'include($ENV{IDF_PATH}/tools/cmake/project.cmake)' then? You don't get the ESP-IDF build system if you do that, which makes any ESP-IDF specific call fail.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 79 guests