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.

Linux/TI-15.4-STACK-GATEWAY-LINUX-SDK: Compile issues when enabling IS_HEADLESS

Part Number: TI-15.4-STACK-GATEWAY-LINUX-SDK

Tool/software: Linux

Dear all,

After reading through the collector code (Linux gateway SDK 2.07.00.16) it looks like I can enable some more output when not running with a display.

I've set the option "CFLAGS += -DIS_HEADLESS" in the Makefile but now I get compile errors:

Compling: csf_linux.c
csf_linux.c: In function 'Csf_deviceSensorDisplay':
csf_linux.c:1134:14: warning: variable 'SensorData' set but not used [-Wunused-but-set-variable]
     uint16_t SensorData;
              ^~~~~~~~~~
csf_linux.c:1132:12: warning: unused variable 'rssi' [-Wunused-variable]
     int8_t rssi = pDataInd->rssi;
            ^~~~
csf_linux.c: In function 'Csf_deviceSensorOadUpdate':
csf_linux.c:1247:9: error: 'DisplayLine_sensorStart' undeclared (first use in this function)
     if((DisplayLine_sensorStart + (srcAddr - 1)) < DisplayLine_sensorEnd)
         ^~~~~~~~~~~~~~~~~~~~~~~
csf_linux.c:1247:9: note: each undeclared identifier is reported only once for each function it appears in
csf_linux.c:1247:52: error: 'DisplayLine_sensorEnd' undeclared (first use in this function)
     if((DisplayLine_sensorStart + (srcAddr - 1)) < DisplayLine_sensorEnd)
                                                    ^~~~~~~~~~~~~~~~~~~~~
csf_linux.c:1245:13: warning: variable 'displayLine' set but not used [-Wunused-but-set-variable]
     uint8_t displayLine = 0;
             ^~~~~~~~~~~
At top level:
csf_linux.c:2880:13: warning: 'removeDevice' defined but not used [-Wunused-function]
 static bool removeDevice(ApiMac_sAddr_t addr)
             ^~~~~~~~~~~~
../../scripts/front_matter.mak:278: recipe for target 'objs/bbb/csf_linux.o' failed
make[1]: *** [objs/bbb/csf_linux.o] Error 1

After looking at the code I see an empty else:

#ifndef IS_HEADLESS
enum {
    DisplayLine_product = 0,
    DisplayLine_nwk,
    DisplayLine_sensorStart,
    DisplayLine_sensorEnd = 6,
    DisplayLine_info,
    DisplayLine_cmd,
} DisplayLine;
#else
#endif //IS_HEADLESS

And on other places there is a #ifndef

void Csf_deviceSensorFwVerUpdate( uint16_t srcAddr, char *fwVerStr)
{
    Board_Led_toggle(board_led_type_LED2);

#ifndef IS_HEADLESS
    if((DisplayLine_sensorStart + (srcAddr - 1)) < DisplayLine_sensorEnd)
    {
        Board_Lcd_printf(DisplayLine_sensorStart + (srcAddr - 1), "Sensor 0x%04x: FW Ver %s",
                        srcAddr, fwVerStr);
    }
    else
    {
        Board_Lcd_printf(DisplayLine_sensorEnd, "Sensor 0x%04x: FW Ver %s",
                        srcAddr, fwVerStr);
    }
#endif //!IS_HEADLESS

#if IS_HLOS
        LOG_printf(LOG_APPSRV_MSG_CONTENT, "Sensor 0x%04x: FW Ver %s\n",
                        srcAddr, fwVerStr);
#endif
}

But not on the part where it throws an error:

void Csf_deviceSensorOadUpdate( uint16_t srcAddr, uint16_t imgId, uint16_t blockNum, uint16_t NumBlocks)
{
    Board_Led_toggle(board_led_type_LED2);

    uint8_t displayLine = 0;

    if((DisplayLine_sensorStart + (srcAddr - 1)) < DisplayLine_sensorEnd)
    {
        displayLine = (DisplayLine_sensorStart + (srcAddr - 1));
    }
    else
    {
        displayLine = DisplayLine_sensorEnd;
    }

    if((blockNum + 1) == NumBlocks)
    {
#ifndef IS_HEADLESS

        Board_Lcd_printf(displayLine, "Sensor 0x%04x: OAD completed, booting new image...",
                        srcAddr);
#endif

#if IS_HLOS
        LOG_printf(LOG_APPSRV_MSG_CONTENT, "Sensor 0x%04x: OAD completed, booting new image...\n",
                        srcAddr);
#endif
    }
    else
    {
#ifndef IS_HEADLESS
        Board_Lcd_printf(displayLine, "Sensor 0x%04x: OAD image %d, block %d of %d",
                srcAddr, imgId, blockNum + 1, NumBlocks);

#endif

#if IS_HLOS
        LOG_printf(LOG_APPSRV_MSG_CONTENT, "Sensor 0x%04x: OAD image %d, block %d of %d\n",
                srcAddr, imgId, blockNum + 1, NumBlocks);
#endif
    }
}

So this looks like a bug. It compiles when I change it to:

#ifndef IS_HEADLESS
    if((DisplayLine_sensorStart + (srcAddr - 1)) < DisplayLine_sensorEnd)
    {
        displayLine = (DisplayLine_sensorStart + (srcAddr - 1));
    }
    else
    {
        displayLine = DisplayLine_sensorEnd;
    }
#endif