CMake project – FreeRTOS analysis

Sysprogs forums Forums VisualGDB CMake project – FreeRTOS analysis

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #21820
    oto313
    Participant

    Hello,

    I would like to use FreeRTOS analysis like in this page https://visualgdb.com/tutorials/profiler/realtime/freertos/. So I check the checkbox in Dynamic Analysis “Allow tracing various RTOS events in Real-Time Watch”. Then it shows the message “project does not contain any relocation records” so I clicked on Enable relocation record generation.  It does some change in CMakeLists.txt

    add_definitions(“-DHARDWARE_TYPE=HT_${HARDWARE_TYPE}” “-DHARDWARE_VERSION=${HARDWARE_VERSION}”)

    =>
    add_definitions(-D -D”-DHARDWARE_TYPE=HT_${HARDWARE_TYPE}” -D -D”-DHARDWARE_VERSION=${HARDWARE_VERSION}”)

    I don’t know why the VisualGDB does such change because then the project cannot be built. Even if I revert this change. try to rebuild then it shows error message “project does not contain any relocation records” in Dynamic Analysis. When I try to Debug it shows the message “Could not detect any RTOS  inside your project. RTOS analysis features will not work” then “Could not find the following symbol in project”.

    I suspect that VisualGDB does not pass information from stm32.mak file to CMake. There are flags for adding Profiler:

    PREPROCESSOR_MACROS += ARM_MATH_CM4 STM32L432KC FAST_SEMIHOSTING_BUFFER_SIZE=4096 FAST_SEMIHOSTING_BLOCKING_MODE=1 FAST_SEMIHOSTING_STDIO_DRIVER=1 FAST_SEMIHOSTING_PROFILER_DRIVER=1 PROFILER_STM32L4
    INCLUDE_DIRS += . $(EFP_BASE)/Profiler
    LIBRARY_DIRS +=
    LIBRARY_NAMES +=
    ADDITIONAL_LINKER_INPUTS +=
    MACOS_FRAMEWORKS +=
    LINUX_PACKAGES +=

    CFLAGS += -include $(EFP_BASE)/Profiler/ProfilerFreeRTOSHooks.h
    CXXFLAGS += -include $(EFP_BASE)/Profiler/ProfilerFreeRTOSHooks.h
    ASFLAGS +=
    LDFLAGS += –specs=nano.specs –specs=nosys.specs
    COMMONFLAGS += -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard
    LINKER_SCRIPT := $(BSP_ROOT)/STM32L4xxxx/LinkerScripts/STM32L432KC_flash.lds

    Should I modify my CMake project somehow?

    Thanks for the help.

    PS: I am using CMake with ninja to build the project. I am not using FreeRTOS from “Embedded Frameworks”

    #21842
    support
    Keymaster

    Hi,

    Sorry, the embedded CMake projects are currently somewhat limited compared to Make-based and MSBuild-based (recommended) projects and might result in weird bugs like the one with add_definitions(). We are working on improving this in v5.4, however currently using CMake for embedded targets requires some manual configuration.

    You can enable the generation of relocation records by adding the following flag to LDFLAGS:

    -Wl,-q

    This should have the same effect as clicking “enable generation of relocation records” for MSBuild-based projects.

    #21847
    oto313
    Participant

    Thanks. Now it shows me the message “Could not detect any RTOS inside your project.RTOS analysis feature will not work”. I added include directory “AppData/Local/VisualGDB/EmbeddedEFPs/Profiles” and source files
    <div>
    <div>”AppData/Local/VisualGDB/EmbeddedEFPs/Profiler/FastSemihosting.cpp”</div>
    <div>”AppData/Local/VisualGDB/EmbeddedEFPs/Profiler/ProfilerRTOS_FreeRTOS.c”</div>
    <div>”AppData/Local/VisualGDB/EmbeddedEFPs/Profiler/InstrumentingProfiler.cpp”</div>
    </div>
    <div>Then I called function  InitializeInstrumentingProfiler();</div>
    <div></div>
    <div>What else must I do to have working RTOS profiler?</div>

    #21853
    support
    Keymaster

    Hi,

    Most likely your binary is missing some symbols that VisualGDB expects to find inside FreeRTOS-based programs. Please try locating the following file:

    <VisualGDB directory>\RTOSProfiles\com.sysprogs.freertos\RTOS.xml

    Then find the RequiredSymbols element and check that your program defines all functions mentioned in side it (e.g. using the embedded memory explorer or by viewing the map file).

    #21881
    oto313
    Participant

    Ok now it shows

    Debugging failed

    Could not find tskTaskControlBlock_pcTaskName_Offset in o32

    Exception details:

    System.Exception: Could not find tskTaskControlBlock_pcTaskName_Offset in o32
    at v12.g(String e, String b, c c, String f, h a, a d)
    at cw1..ctor(String g, EmbeddedDynamicAnalysisSettings c, String a, qx d, c e, b921 f, EmbeddedRTOSProfile b, Dictionary2 h)
    at ig1.b1()
    at ig1.x_2(DebugCustomizationSettings a)
    at i11.f()
    at VisualGDB.GDBDebugEngine.t1(ss1 a, m b)

     

    Thanks for response

    #21882
    support
    Keymaster

    Hi,

    No problem. This message means that the ProfilerRTOS_FreeRTOS.c file from the profiler framework was either not built, or the USE_FREERTOS macro was not set. Please ensure that the file is include in your target’s file list and try adding USE_FREERTOS to the preprocessor macro list.

    #29928
    oto313
    Participant

    Hi, I tried freertos analysis on another project after some time. Now it is complaining about similar problem I guess. But I have linked ProfilerRTOS_FreeRTOS.c and used macro USE_FREERTOS

    It says that

     

    System.Exception: tskTaskControlBlock does not contain a member called pcTaskName
    at c..ctor(String c, j a, Boolean d, DebugInfoBinding[] b)
    at yj1..ctor(String b, EmbeddedDynamicAnalysisSettings a, String h, nj2 d, b g, j e, EmbeddedRTOSProfile f, Dictionary`2 c)
    at si1.l()
    at si1.h1_2(DebugCustomizationSettings a)
    at xi1.l()
    at rt1.c_2()
    at VisualGDB.GDBDebugEngine.j1(nc b, z a)

    In embedded memory explorer I even see tskTaskControlBlock_pcTaskName_Offset variable. Where could be a problem?

    Thanks.

    #29929
    support
    Keymaster

    Hi,

    According to our records, your support has expired a while ago. Please renew your support here and install the latest version of VisualGDB. If the problem persists, please let us know and we will help you get it working.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.