Project built issue

I had an issue with building a ‘Hello-World’ project.

issue happened in the folder (Target_Legato_Debug . api . xxx. client . xxx.c). see the Screenshot above.

my helloworldComponent.c

#include "legato.h"
#include"interfaces.h"

le_timer_Ref_t led_Timer;
uint32_t interval_time = 500;

void deletedTimer(le_timer_Ref_t t)
{
	le_timer_Stop( t );
	free( le_timer_GetContextPtr( t ) );
	le_timer_Delete( t );  // timer ref is now invalid
}

static void timerCouerHandler(le_timer_Ref_t t_ref)
{
	//IO OPTION -- IOT1_GPIO
	if(le_gpioPin25_IsActive()==true)
		le_gpioPin25_Deactivate();
	else
		le_gpioPin25_Activate();
	LE_INFO("Timer Handler running");
}

le_timer_Ref_t PlayTimerInit(le_timer_Ref_t PlayTimer)
{
    PlayTimer = le_timer_Create("playTimer");
    le_timer_SetHandler(PlayTimer,timerCouerHandler);
    le_timer_SetRepeat(PlayTimer, 0);
    le_timer_SetMsInterval(PlayTimer, interval_time);				//5 seconds
    le_timer_Start(PlayTimer);
    return PlayTimer;
}

COMPONENT_INIT
{
    LE_INFO("Hello, world.");
    led_Timer = PlayTimerInit(led_Timer);
}

my .cdef

sources:
{
	helloworldComponent.c
}

requires:
{
	api:
	{
			// ======= GPIO API requires ========
			// IOT1_GPIO4
		le_gpioPin21 = le_gpio.api
			// IOT1_GPIO3
		le_gpioPin32 = le_gpio.api
			// IOT1_GPIO2
		le_gpioPin7  = le_gpio.api
			// IOT1_GPIO1
		le_gpioPin25 = le_gpio.api
			// ======== ADC API requires ========
		le_adc = le_adc.api
		le_posCtrl = positioning/le_posCtrl.api
		le_pos = positioning/le_pos.api
	}
}

my .adef

version: 1.0.0
maxFileSystemBytes: 512K
executables:
{
	helloworld = ( helloworldComponent )
}
processes:
{
	envVars:
	{
        LE_LOG_LEVEL = DEBUG
        //ADC0 to ADC3
        ADC0 = EXT_ADC0
        ADC1 = EXT_ADC1
        ADC2 = EXT_ADC2
        ADC3 = EXT_ADC3 
    }
	run:
	{
		helloworld =  ( helloworld EXT_ADC0)
	}
	maxCoreDumpFileBytes: 512K
	maxFileBytes: 512K
}

//start: manual

bindings:
{
	//Bindings GPIOs 
	helloworld.helloworldComponent.le_gpioPin21 -> gpioService.le_gpioPin21	//IOT1_GPIO4
	helloworld.helloworldComponent.le_gpioPin32 -> gpioService.le_gpioPin32	//IOT1_GPIO3
	helloworld.helloworldComponent.le_gpioPin7 -> gpioService.le_gpioPin7	//IOT1_GPIO2
	helloworld.helloworldComponent.le_gpioPin25 -> gpioService.le_gpioPin25	//IOT1_GPIO1
	
	//Bindings ADC
	helloworld.helloworldComponent.le_adc -> modemService.le_adc
	
	//Bindings Position
	helloworld.helloworldComponent.le_posCtrl -> positioningService.le_posCtrl
    helloworld.helloworldComponent.le_pos -> positioningService.le_pos
}

can you give me any clue? Thanks.

Hi @lumao

These problems are Semantic Errors (cf Type column in the Problems view)
This means they are reported by the compiler, but by the Eclipse static code analyzer, which sometimes gets confused (notably by generated code).
It is supposed to look only at the code in the components folders (and not in the Target_Legato_Debug output folder).
But there is an Eclipse bug that triggers the analysis when a C file is opened in an editor, even if the file is out of the source tree.

To workaround this you can try:

  • right-click project and Run C/C++ Code Analysis to clean the unexpected errors
  • if not enough, in the project properties, go to C/C++ General > Code Analysis > Launching and disable the Run as you type option, + retry first step.
  • if still not enough, go to C/C++ General > Code Analysis and uncheck all errors, + retry first step.
1 Like

Dear daav,

Thank you…