This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/IWR6843ISK-ODS: IWR6843ISKODS: How to enable gtrack_log function logs to the console

Part Number: IWR6843ISK-ODS
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI C/C++ Compiler

Hi TI Team,

We are using IWR6843ISKODS + MMWAVEBOOST in our application. We are using 68xx_Sense_and_Direct_HVAC_Control demo. We would like to enable logs from the g_track module to print on the console.

We found that already g_track module has one log function gtrack_log().

#ifdef GTRACK_LOG_ENABLED
       if(inst->verbose & VERBOSE_WARNING_INFO)
             gtrack_log(GTRACK_VERBOSE_WARNING, "Frame #%llu, %u Target(s), %hu Measurements\n", inst->heartBeat, gtrack_listGetCount(&inst->activeList), mNum);
#endif

Keen to learn how to enable the logs in the gtrack module using gtrack_log() function to the uart console

Please help regarding this

Regards

Sudharshan

  • Hi Sudharshan,

    If you just want to print to UART, you will need to provide a UART handle to the gtrack module, then use the uart_write() function. If you want to write to the CCS debug console, you can use System_printf (ensure system.h is included). 

    Gtrack_log was used by the internal developer, you won't have full access to it.

    Regards,

    Justin

  • Hi Justin,

    >>>If you just want to print to UART, you will need to provide a UART handle to the gtrack module, then use the uart_write() function

          Can you please provide some reference code snippet to this. Already uart0 and 1 are using as command and logging uart handle.

    I am importing project 68xx_Sense_and_Direct_HVAC_Control demo from industrial tool box demo to work space. I want add some debug prints in gtrack_step() function. But I am not able to find the source code for gtrack_step function in the work space. I have found this function source in mmwave_sdk.

    How can I add prints for the same function in mmwave_sdk. How to compile it to make the changes effective for current project.

    Could you please help how to add some debug prints to the UART in gtrack_step()?
    Could you please share some reference code snippet for the above?

    Thanks

    Sudharshan

  • Hi Sudharshan,

    The device only has the two UARTs available, so you'll have to use one of those. Should be fine to use the command UART. You can see uart_write examples in task_mbox.c

    GTrack source is in the lab folder - <Industrial_Toolbox>/labs/people_counting/68xx_Sense_and_Direct/src/mss/gtrack.

    GTrack has a makefile, you can recompile it with this. The compilation directions in the SDK user's guide (for SDK demos) also work for GTrack. Generally its easiest to paste the gtrack folder into the SDK, so you don't have to change all of the paths in the setEnvironment scripts. 

    Make sure that when gtrack is recompiled, you put the library files in the correct location. This is in the gtrack folder in the lab. You can see how this is being linked in the linker tab in CCS->properties. 

    Regards,

    Justin

  • Hi Justin,

    Could you please help how to build/recompile the gtrack module in <Industrial_Toolbox>/labs/people_counting/68xx_Sense_and_Direct/src/mss/gtrack after doing some changes in the source file.

    I have checked gtrack handle structure and I didn't find any member for uart handle in that structure?
    Do we need to modify this structure by adding uarthandle member?

    Thanks

    Sudharshan

  • Hi Sudharshan,

    There is no uart handle present in gtrack - you'll have to add it.

    To compile gtrack:

    1. copy gtrack folder to sdk algorithms <algs> folder. (C:\ti\mmwave_sdk_03_03_00_03\packages\ti\alg)

    2. Copy setenv.bat and checkenv.bat from Scripts folder (C:\ti\mmwave_sdk_03_03_00_03\packages\scripts\windows) to gtrack folder

    3. Run setenv.bat

    4. Run gmake all

    Regards,

    Justin

  • Hi Justin,

    I did the following changes in the gtrack module to add support for logs using uart.

    diff --git a/src/gtrack_step.c b/src/gtrack_step.c
    index ceef058..4a186e3 100644
    --- a/src/gtrack_step.c
    +++ b/src/gtrack_step.c
    @@ -39,6 +39,7 @@
    #include <string.h>
    #include <math.h>
    #include <float.h>
    +#include <ti/drivers/uart/UART.h>
    #include <ti/alg/gtrack/gtrack.h>
    #include <ti/alg/gtrack/include/gtrack_int.h>

    @@ -82,7 +83,7 @@
    * None
    */

    -void gtrack_step(void *handle, GTRACK_measurementPoint *point, GTRACK_measurement_vector *var, uint16_t mNum, GTRACK_targetDesc *t, uint16_t *tNum, uint8_t *mIndex, uint8_t *uIndex, uint32_t *bench)
    +void gtrack_step(void *handle, UART_Handle commandUartHandle, void *GTRACK_measurementPoint *point, GTRACK_measurement_vector *var, uint16_t mNum, GTRACK_targetDesc *t, uint16_t *tNum, uint8_t *mIndex, uint8_t *uIndex, uint32_t *bench)
    {
    GtrackModuleInstance *inst;
    uint16_t n;
    @@ -99,6 +100,7 @@ void gtrack_step(void *handle, GTRACK_measurementPoint *point, GTRACK_measuremen
    if(inst->verbose & VERBOSE_WARNING_INFO)
    gtrack_log(GTRACK_VERBOSE_WARNING, "Frame #%llu, %u Target(s), %hu Measurements\n", inst->heartBeat, gtrack_listGetCount(&inst->activeList), mNum);
    #endif
    + UART_write (commandUartHandle, "Testing the uart log", sizeof("Testing the uart log"));

    if(mNum > inst->maxNumPoints)
    mNum = inst->maxNumPoints;
    diff --git a/gtrack.h b/gtrack.h
    index 05b43c0..336e8fd 100644
    --- a/gtrack.h
    +++ b/gtrack.h
    @@ -113,6 +113,7 @@

    #include <stdint.h>
    #include <stddef.h>
    +#include <ti/drivers/uart/UART.h>

    #ifdef __cplusplus
    extern "C" {
    @@ -605,7 +606,7 @@ typedef struct
    } GTRACK_targetDesc;

    extern void *gtrack_create(GTRACK_moduleConfig *config, int32_t *errCode);
    -extern void gtrack_step(void *handle, GTRACK_measurementPoint *point, GTRACK_measurement_vector *var, uint16_t mNum, GTRACK_targetDesc *t, uint16_t *tNum, uint8_t *mIndex, uint8_t *uIndex, uint32_t *bench);
    +extern void gtrack_step(void *handle, UART_Handle commandUartHandle, GTRACK_measurementPoint *point, GTRACK_measurement_vector *var, uint16_t mNum, GTRACK_targetDesc *t, uint16_t *tNum, uint8_t *mIndex, uint8_t *uIndex, uint32_t *bench);
    extern void gtrack_delete(void *handle);

    /*Added for Live Configuration*/

    When I am trying to compile the gtrack module using gmake all, I am getting the following error

    SHMEM_ALLOC is set to 0x00000006
    make -s MMWAVE_SDK_LIB_BUILD_OPTION=2D gtracklib
    SHMEM_ALLOC is set to 0x00000006
    [R4 Device/Type: iwr68xx/xwr68xx] Building file: src/gtrack_step.c
    "src/gtrack_step.c", line 86: error: expected a ")"
    "src/gtrack_step.c", line 86: error: declaration is incompatible with "void gtrack_step(void *, UART_Handle, GTRACK_measurementPoint *, GTRACK_measurement_vector *, uint16_t, GTRACK_targetDesc *, uint16_t *, uint8_t *, uint8_t *, uint32_t *)" (declared at line 609 of "/home/sudha/ti/mmwave_sdk_03_03_00_03/packages/ti/alg/gtrack/gtrack.h")
    "src/gtrack_step.c", line 101: error: identifier "mNum" is undefined
    "src/gtrack_step.c", line 118: error: identifier "point" is undefined
    "src/gtrack_step.c", line 153: error: identifier "bench" is undefined
    "src/gtrack_step.c", line 159: error: identifier "point" is undefined
    "src/gtrack_step.c", line 163: error: identifier "var" is undefined
    "src/gtrack_step.c", line 165: error: identifier "t" is undefined
    "src/gtrack_step.c", line 165: error: identifier "tNum" is undefined
    "src/gtrack_step.c", line 171: error: identifier "point" is undefined
    "src/gtrack_step.c", line 173: error: identifier "var" is undefined
    "src/gtrack_step.c", line 174: error: identifier "t" is undefined
    "src/gtrack_step.c", line 174: error: identifier "tNum" is undefined
    "src/gtrack_step.c", line 178: error: identifier "uIndex" is undefined
    "src/gtrack_step.c", line 187: error: identifier "mIndex" is undefined
    15 errors detected in the compilation of "src/gtrack_step.c".

    >> Compilation failure
    ../../common/mmwave_sdk.mak:281: recipe for target 'obj_xwr68xx2D/gtrack_step.oer4f' failed
    make[1]: *** [obj_xwr68xx2D/gtrack_step.oer4f] Error 1
    gmake: *** [lib] Error 2

    I have add the following changes in the mss module to send uart handle to the gtrack module

    diff --git a/sense_and_direct_68xx_mss/task_app.c b/sense_and_direct_68xx_mss/task_app.c
    index b463927..58bb83f 100644
    --- a/sense_and_direct_68xx_mss/task_app.c
    +++ b/sense_and_direct_68xx_mss/task_app.c
    @@ -242,10 +242,10 @@ void MmwDemo_appTask(UArg arg0, UArg arg1)

    // Execute tracking
    #if (defined (GTRACK_2D)) || (defined (GTRACK_3D))
    - gtrack_step(gMmwMssMCB.gtrackHandle, points, 0, mNum, targetDescr, &tNum, targetIndex->index, &targetIndex->index[gMmwMssMCB.cfg.trackingCfg.config.maxNumPoints], benchmarks);
    + gtrack_step(gMmwMssMCB.gtrackHandle, gMmwMssMCB.commandUartHandle, points, 0, mNum, targetDescr, &tNum, targetIndex->index, &targetIndex->index[gMmwMssMCB.cfg.trackingCfg.config.maxNumPoints], benchmarks);
    #else
    variances = NULL;
    - gtrack_step(gMmwMssMCB.gtrackHandle, points, variances, mNum, targetDescr, &tNum, targetIndex->index, benchmarks);
    + gtrack_step(gMmwMssMCB.gtrackHandle, gMmwMssMCB.commandUartHandle, points, variances, mNum, targetDescr, &tNum, targetIndex->index, benchmarks);
    #endif

    for(n=0; n<tNum; n++) {

    Could you please help in resolving the issues in compiling the gtrack module with changes?

    Could you please review the changes in mss module?

    Thanks

    Sudharshan

  • Hi Sudharshan,

    It looks like you may need to review your code changes - gtrack_step is not defined properly, and you may have a syntax error.

    I think it would be better to send the uartHandle to the gtrack module at gtrack_create, so that you only have to do this once. The uartHandle should not change, so once gtrack has the pointer, you are good to go.

    Regards,

    Justin

  • Hi Justin,

    I did the following changes as you suggested.

    diff --git a/src/gtrack_create.c b/src/gtrack_create.c
    index 3b8b07d..d9ff3f3 100644
    --- a/src/gtrack_create.c
    +++ b/src/gtrack_create.c
    @@ -40,6 +40,7 @@
     #include <math.h>
     #include <float.h>
    
    +#include <ti/drivers/uart/UART.h>
     #include <ti/alg/gtrack/gtrack.h>
     #include <ti/alg/gtrack/include/gtrack_int.h>
    
    @@ -117,6 +118,7 @@ void *gtrack_create(GTRACK_moduleConfig *config, int32_t *errCode)
     	inst->maxNumTracks = config->maxNumTracks;
    
     	inst->heartBeat = 0U;
    +    inst->commandUartHandle = config->commandUartHandle;
    
         /* default parameters */
     	inst->params.gatingParams = defaultGatingParams;
    diff --git a/src/gtrack_step.c b/src/gtrack_step.c
    index ceef058..ef5cb60 100644
    --- a/src/gtrack_step.c
    +++ b/src/gtrack_step.c
    @@ -94,6 +94,7 @@ void gtrack_step(void *handle, GTRACK_measurementPoint *point, GTRACK_measuremen
         inst = (GtrackModuleInstance *)handle;
    
     	inst->heartBeat++;
    +    UART_write (inst->commandUartHandle, "Testing the uart log", sizeof("Testing the uart log"));
    
     #ifdef GTRACK_LOG_ENABLED
     	if(inst->verbose & VERBOSE_WARNING_INFO)
    diff --git a/include/gtrack_int.h b/include/gtrack_int.h
    index f878e34..d83e22a 100644
    --- a/include/gtrack_int.h
    +++ b/include/gtrack_int.h
    @@ -48,6 +48,7 @@ extern "C" {
     #include <stdint.h>
    
     #include "gtrack_listlib.h"
    +#include <ti/drivers/uart/UART.h>
    
     #define GTRACK_NOMINAL_ALLOCATION_RANGE     	                (6.0f) /* Range for allocation SNR scaling */
    
    @@ -382,6 +383,7 @@ typedef struct {
         uint32_t	        targetNumTotal;
     	/**  @brief Number of currently tracked Targets */
     	uint16_t			targetNumCurrent;
    +    UART_Handle    commandUartHandle;
    
     } GtrackModuleInstance;
    
    diff --git a/gtrack.h b/gtrack.h
    index 05b43c0..2520cdb 100644
    --- a/gtrack.h
    +++ b/gtrack.h
    @@ -113,6 +113,7 @@
    
     #include <stdint.h>
     #include <stddef.h>
    +#include <ti/drivers/uart/UART.h>
    
     #ifdef __cplusplus
     extern "C" {
    @@ -547,6 +548,7 @@ typedef struct
    
         /**  @brief   Advanced parameters, set to NULL for defaults */
         GTRACK_advancedParameters *advParams;
    +    UART_Handle   commandUartHandle;
    
     } GTRACK_moduleConfig;
    diff --git a/sense_and_direct_68xx_mss/task_app.c b/sense_and_direct_68xx_mss/task_app.c
    index b463927..4dbc73c 100644
    --- a/sense_and_direct_68xx_mss/task_app.c
    +++ b/sense_and_direct_68xx_mss/task_app.c
    @@ -577,6 +577,7 @@ int32_t MmwDemo_CLITrackingCfg (int32_t argc, char* argv[])
         if(gMmwMssMCB.gtrackHandle != NULL)
             gtrack_delete(gMmwMssMCB.gtrackHandle);
     
    +    config.commandUartHandle = gMmwMssMCB.commandUartHandle;
         gMmwMssMCB.gtrackHandle = gtrack_create(&config, &errCode);
         if(gMmwMssMCB.gtrackHandle == NULL) {
             System_printf("Error: Unable to allocate memory for Tracker\n");
    

    But I am getting the following error during compilation
    But the libraries are built

    asmer4ft /home/sudha/ti/bios_6_73_01_01/packages/ti/sysbios/family/arm/a15/TimestampProvider_asm.asm ...
    arer4ft BIOS.obj arm_IntrinsicsSupport_asm.obj arm_TaskSupport_asm.obj vim_Hwi_asm.obj vim_Hwi_asm_switch.obj exc_Exception_asm.obj tms570_Core_asm.obj a15_TimestampProvider_asm.obj ...
    gmake[1]: Leaving directory `/home/sudha/ti/mmwave_sdk_03_03_00_03/packages/ti/alg/gtrack/test/usecases/mss/mss_configPkg_xwr68xx/package/cfg/mss_per4ft.src/sysbios'
    Build of libraries done.
    cler4ft package/cfg/mss_per4ft.c ...
    Finished configuring packages

    [R4 Device/Type: iwr68xx/xwr68xx] Building file: test/usecases/mss/main_mss.c
    [R4 Device/Type: iwr68xx/xwr68xx] Building file: test/common/gtrackApp.c
    [R4 Device/Type: iwr68xx/xwr68xx] Building file: test/common/gtrackAlloc.c
    [R4 Device/Type: iwr68xx/xwr68xx] Building file: test/common/gtrackLog.c
    <Linking>
    "test/usecases/mss/mss_gtrack_linker.cmd", line 11: warning #10068-D: no matching section
    "test/usecases/mss/mss_gtrack_linker.cmd", line 12: warning #10068-D: no matching section

    undefined first referenced
    symbol in file
    --------- ----------------
    UART_write lib/libgtrack2D.aer4f<gtrack_step.oer4f>

    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "test/usecases/mss/xwr68xx_gtrack2D_usecase_mss.xer4f" not built

    >> Compilation failure
    test/usecases/mss/gtrackTestMss.mak:65: recipe for target 'gtrackTestMss' failed
    make[1]: *** [gtrackTestMss] Error 1
    gmake: *** [test] Error 2

    Could you please help in solving this issue.

    I am attaching complete gtrack build logs

    TI_reply.txt

    Please help in solving this issue

    Thanks
    Sudharshan

  • Hi Sudharshan,

    Apologies for the late reply.

    We have removed the test files from the official release, but haven't removed the call to compile them. In the top level make file, remove any references to the testfiles. It should be modified so that gmake all only makes 

    gtracklib2d (r4f)

    gtracklib2d (c674x)

    gtracklib3d (r4f)

    gtracklib3d (c674x)

    Regards,

    Justin

  • Hi Justin,

    Thanks for your support. We are able to send the logs through UART. But after few logs display, the system is getting hanged