cancel
Showing results for 
Search instead for 
Did you mean: 

Error compile simulator

iyed_hamdi
Associate II

Hello ST community,
i hope you can help me with this error
I am developping touchgfx application and i nedd to display water volume in the screen, so i made some changes in my code and i compile with stm32ide i build it , the console show no error when i return to touchgfx designer to run simulator it shows this in terminal i will display it in code example to make things clear: 

 

 

 

$ make -f simulator/gcc/Makefile -j6
Reading ./application.config
Reading ./target.config
Cleaning generated files from generated/texts and generated/fonts.
Generating generated/fonts/include/fonts/GeneratedFont.hpp
Generating generated/fonts/src/GeneratedFont.cpp
Generating generated/fonts/include/fonts/UnmappedDataFont.hpp
Generating generated/fonts/src/UnmappedDataFont.cpp
Generating generated/fonts/include/fonts/CachedFont.hpp
Generating generated/fonts/src/CachedFont.cpp
Generating generated/fonts/include/fonts/FontCache.hpp
Generating generated/fonts/src/FontCache.cpp
Generating generated/fonts/src/ApplicationFontProvider.cpp
Generating generated/fonts/include/fonts/ApplicationFontProvider.hpp
Generating generated/texts/include/texts/TextKeysAndLanguages.hpp
Generating generated/texts/include/texts/TypedTextDatabase.hpp
Generating generated/texts/src/TypedTextDatabase.cpp
Generating generated/texts/src/Texts.cpp
Generating generated/texts/src/LanguageGb.cpp
Generating generated/fonts/src/Font_verdana_10_4bpp_0.cpp
Generating generated/fonts/src/Table_verdana_10_4bpp.cpp
Generating generated/fonts/src/Kerning_verdana_10_4bpp.cpp
Generating generated/fonts/src/Font_verdana_20_4bpp_0.cpp
Generating generated/fonts/src/Table_verdana_20_4bpp.cpp
Generating generated/fonts/src/Kerning_verdana_20_4bpp.cpp
Generating generated/fonts/src/Font_verdana_30_4bpp_0.cpp
Generating generated/fonts/src/Table_verdana_30_4bpp.cpp
Generating generated/fonts/src/Kerning_verdana_30_4bpp.cpp
Generating generated/fonts/src/Font_verdana_40_4bpp_0.cpp
Generating generated/fonts/src/Table_verdana_40_4bpp.cpp
Generating generated/fonts/src/Kerning_verdana_40_4bpp.cpp
Generating generated/fonts/src/Font_verdana_50_4bpp_0.cpp
Generating generated/fonts/src/Table_verdana_50_4bpp.cpp
Generating generated/fonts/src/Kerning_verdana_50_4bpp.cpp
Generating generated/fonts/src/VectorFontRendererBuffers.cpp
Compiling gui/src/controlmonitoringscreen_screen/ControlMonitoringScreenView.cpp
Compiling gui/src/controlmonitoringscreen_screen/ControlMonitoringScreenPresenter.cpp
Compiling gui/src/screensaver_screen/ScreenSaverView.cpp
Compiling gui/src/screensaver_screen/ScreenSaverPresenter.cpp
Compiling gui/src/model/Model.cpp
Compiling gui/src/common/FrontendApplication.cpp
gui/src/model/Model.cpp:4:10: fatal error: FreeRTOS.h: No such file or directory
#include "FreeRTOS.h"
^~~~~~~~~~~~
compilation terminated.
generated/simulator/gcc/Makefile:196: recipe for target 'build/MINGW32_NT-6.2/gui/src/model/Model.o' failed
make[2]: *** [build/MINGW32_NT-6.2/gui/src/model/Model.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from In file included from generated/gui_generated/include/gui_generated/controlmonitoringscreen_screen/ControlMonitoringScreenViewBase.hpp:9:0generated/gui_generated/include/gui_generated/controlmonitoringscreen_screen/ControlMonitoringScreenViewBase.hpp:9:0,
from ,
from gui/include/gui/controlmonitoringscreen_screen/ControlMonitoringScreenView.hpp:4gui/include/gui/controlmonitoringscreen_screen/ControlMonitoringScreenView.hpp:4,
from ,
from gui/src/controlmonitoringscreen_screen/ControlMonitoringScreenView.cpp:1gui/src/controlmonitoringscreen_screen/ControlMonitoringScreenPresenter.cpp:1:
:
gui/include/gui/controlmonitoringscreen_screen/ControlMonitoringScreenPresenter.hpp:6:10:gui/include/gui/controlmonitoringscreen_screen/ControlMonitoringScreenPresenter.hpp:6:10: fatal error: fatal error: main.h: No such file or directory
#include main.h: No such file or directory
#include

^~~~~~~~^~~~~~~~

ccoommppiillaattiioonn tteerrmmiinnaatteedd..

generated/simulator/gcc/Makefile:196: recipe for target 'build/MINGW32_NT-6.2/gui/src/controlmonitoringscreen_screen/ControlMonitoringScreenView.o' failed
make[2]: *** [build/MINGW32_NT-6.2/gui/src/controlmonitoringscreen_screen/ControlMonitoringScreenView.o] Error 1
generated/simulator/gcc/Makefile:196: recipe for target 'build/MINGW32_NT-6.2/gui/src/controlmonitoringscreen_screen/ControlMonitoringScreenPresenter.o' failed
make[2]: *** [build/MINGW32_NT-6.2/gui/src/controlmonitoringscreen_screen/ControlMonitoringScreenPresenter.o] Error 1
gui/src/screensaver_screen/ScreenSaverPresenter.cpp:3:10: fatal error: main.h: No such file or directory
#include "main.h"
^~~~~~~~
compilation terminated.
generated/simulator/gcc/Makefile:196: recipe for target 'build/MINGW32_NT-6.2/gui/src/screensaver_screen/ScreenSaverPresenter.o' failed
make[2]: *** [build/MINGW32_NT-6.2/gui/src/screensaver_screen/ScreenSaverPresenter.o] Error 1
generated/simulator/gcc/Makefile:155: recipe for target 'generate_assets' failed
make[1]: *** [generate_assets] Error 2
simulator/gcc/Makefile:32: recipe for target 'all' failed
make: *** [all] Error 2

 

 

 

  this is Model.cpp:

 

 

 

#include <gui/model/Model.hpp>
#include <gui/model/ModelListener.hpp>

#include "FreeRTOS.h"
#include "queue.h"
#include "task.h"
#include "main.h"

unsigned int counter =0;
struct monitoringSetting monitoringSettingData2 = {0};
unsigned int uiWL =0;

extern "C"
{
	xQueueHandle messageQ;
	xQueueHandle messageQ2;
}

Model::Model() : modelListener(0)
{
	messageQ = xQueueGenericCreate(1,1,0);
}

void Model::tick()
{
	if(pdTRUE == xQueueReceive(messageQ,&counter, 0 )){
		modelListener->setNewValue(monitoringSettingData2);
	}
}

 

 

 

 

 

 

 

 

 

 

 

this is ModelListener.hpp:

 

 

 

 

#ifndef MODELLISTENER_HPP
#define MODELLISTENER_HPP

#include <gui/model/Model.hpp>

class ModelListener
{
public:
    ModelListener() : model(0) {}
    
    virtual ~ModelListener() {}

    void bind(Model* m)
    {
        model = m;
    }

    virtual void setNewValue(struct monitoringSetting monitoringSettingData);
    
protected:
    Model* model;
};

#endif // MODELLISTENER_HPP

 

 

 

 

 


this is controlMonitoringScreenview.cpp:

 

 

 

#include <gui/controlmonitoringscreen_screen/ControlMonitoringScreenView.hpp>

int testToRemove = 0;

#define FORCE_STATE_ON 0
#define FORCE_STATE_OFF 1

#define TOUCHABLE_LOCK 0
#define TOUCHABLE_UNLOCK 1

#define ALPHA_MIN 100
#define ALPHA_MAX 255

ControlMonitoringScreenView::ControlMonitoringScreenView()
{

}

void ControlMonitoringScreenView::setupScreen()
{
    ControlMonitoringScreenViewBase::setupScreen();
}

void ControlMonitoringScreenView::tearDownScreen()
{
    ControlMonitoringScreenViewBase::tearDownScreen();
}

void ControlMonitoringScreenView::updateVal(struct monitoringSetting monitoringSettingDataTODELETE){

	//Unicode::snprintf(textArea1Buffer, TEXTAREA1_SIZE,"%d",newValue);
	unsigned int iHumidity = (int)(monitoringSettingData.pstDHT_Monitor.fHumidity);
	unsigned int uiTempC = (int)(monitoringSettingData.pstDHT_Monitor.fTemperature);

	unsigned int uiVolPer = (int)(LITER_TO_PERCENTAGE(monitoringSettingData.fPT1_Monitor));
	unsigned int uiVolL = (int)(monitoringSettingData.fPT1_Monitor);

	AirHumidityValue.setValue(iHumidity);
	AirTemperatureValue.setValue(uiTempC);

	WaterLevelPercentage.setValue(uiVolPer);
	WaterLevelLiters.setValue(uiVolL);
	WaterLevelProgressBar.setValue(uiVolPer);

	/*TODO rajouter l'algorithmie pour la modification de l'�tat du bouton water service � partir de gucWS_mode*/

	if(FORCING_STOP_TRUE == gucWS_mode){
		WaterServiceControl.setTouchable(TOUCHABLE_LOCK);
		WaterServiceControl.forceState(FORCE_STATE_OFF);
		WaterServiceControl.invalidate();
		WaterServiceControl.setTouchable(TOUCHABLE_UNLOCK);
		gucWS_mode = FORCING_STOP_FALSE;
	}

	/*Condition to stop water production and switch button to OFF*/
	if(YES == bIsStoppingWaterProduction){
		WaterProductionControl.setTouchable(TOUCHABLE_LOCK);
		WaterProductionControl.forceState(FORCE_STATE_OFF);
		WaterProductionControl.invalidate();
		WaterProductionControl.setTouchable(TOUCHABLE_UNLOCK);
		bIsStoppingWaterProduction = NO;
	}

	/*Makes the water production button non controllable*/
	//TODO 1 make the button transparent and add a "FULL" view visible in the place of the button
	if(YES == bIsFullWater){
		WaterProductionControl.setTouchable(TOUCHABLE_LOCK);
	}
	/*Makes the water production button controllable again*/
	//TODO 2 make the button visible again the "FULL" view transparent, once TODO 1 is done
	if(NO == bIsFullWater){
		WaterProductionControl.setTouchable(TOUCHABLE_UNLOCK);
	}

	/*Condition to restart water production and switch button to ON*/
	if(YES == bIsRestartingWaterProduction){
		WaterProductionControl.setTouchable(TOUCHABLE_LOCK);
		WaterProductionControl.forceState(FORCE_STATE_ON);
		WaterProductionControl.invalidate();
		WaterProductionControl.setTouchable(TOUCHABLE_UNLOCK);
		bIsRestartingWaterProduction = NO;
	}



	guiWS_state = WaterServiceControl.getState();
	guiWP_state = WaterProductionControl.getState();
}

 

 

 

 

this is the ControlMonitoringScreenPresenter.hpp:

 

 

 

#ifndef CONTROLMONITORINGSCREENPRESENTER_HPP
#define CONTROLMONITORINGSCREENPRESENTER_HPP

#include <gui/model/ModelListener.hpp>
#include <mvp/Presenter.hpp>
#include "main.h"

using namespace touchgfx;

class ControlMonitoringScreenView;

class ControlMonitoringScreenPresenter : public touchgfx::Presenter, public ModelListener
{
public:
    ControlMonitoringScreenPresenter(ControlMonitoringScreenView& v);

    /**
     * The activate function is called automatically when this screen is "switched in"
     * (ie. made active). Initialization logic can be placed here.
     */
    virtual void activate();

    /**
     * The deactivate function is called automatically when this screen is "switched out"
     * (ie. made inactive). Teardown functionality can be placed here.
     */
    virtual void deactivate();

    virtual ~ControlMonitoringScreenPresenter() {}
    
    void setNewValue(struct monitoringSetting monitoringSettingData);

private:
    ControlMonitoringScreenPresenter();

    ControlMonitoringScreenView& view;
};

#endif // CONTROLMONITORINGSCREENPRESENTER_HPP

 

 

 

 

this is the ControlMonitoringScreenView.hpp:

 

 

 

#ifndef CONTROLMONITORINGSCREENVIEW_HPP
#define CONTROLMONITORINGSCREENVIEW_HPP

#include <gui_generated/controlmonitoringscreen_screen/ControlMonitoringScreenViewBase.hpp>
#include <gui/controlmonitoringscreen_screen/ControlMonitoringScreenPresenter.hpp>
#include "main.h"


class ControlMonitoringScreenView : public ControlMonitoringScreenViewBase
{
public:
    ControlMonitoringScreenView();
    virtual ~ControlMonitoringScreenView() {}
    virtual void setupScreen();
    virtual void tearDownScreen();

    void updateVal (struct monitoringSetting monitoringSettingData);
protected:
};

#endif // CONTROLMONITORINGSCREENVIEW_HPP

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
GaetanGodart
ST Employee

Hello @iyed_hamdi ,

 

In your logs you get 

gui/src/screensaver_screen/ScreenSaverPresenter.cpp:3:10: fatal error: main.h: No such file or directory
#include "main.h"

 It looks like you tried to include your main in ScreenSaver file.
You should only include your main in model.cpp

Try removing your include main.h from ScreenSaver.

Then, to get the values you want, you will have to define get and set functions to get the data from the model to the ScreenSaver.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

View solution in original post

4 REPLIES 4
GaetanGodart
ST Employee

Hello @iyed_hamdi ,

 

The simulator will fail, it is normal because you are using target specific functions (FreeRTOS) in the simulator.

You cannot run code requiring hardware component in the simulator.

To exclude specific line of code from being executed in the simulator use:

#ifdef SIMULATOR
    //do whatever here
#endif

You should not encounter this issue when flashing your program on a board.

 

If this solves answer your question, I invite you to select this message as "best answer".

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)
GaetanGodart
ST Employee

Hello @iyed_hamdi ,

 

Have you been able to move forward with your issue?

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Hello @GaetanGodart 

I need to include for example "main.h" to be executed, I define some variables in "main.h" and I use those variables in "main.c", The issue is the compiles in STM32CubeIDE without error , also when I generate a code from TouchGFX it works, only simulation for this project doesn't work like i mentioned in the beginning of the post.

Any idea or suggestion that could help (I want to verify that button is pressed or not and to execute some code related to a variable of the button is pressed or not in the "main.c")


Thanks for your helps. 

GaetanGodart
ST Employee

Hello @iyed_hamdi ,

 

In your logs you get 

gui/src/screensaver_screen/ScreenSaverPresenter.cpp:3:10: fatal error: main.h: No such file or directory
#include "main.h"

 It looks like you tried to include your main in ScreenSaver file.
You should only include your main in model.cpp

Try removing your include main.h from ScreenSaver.

Then, to get the values you want, you will have to define get and set functions to get the data from the model to the ScreenSaver.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)