2019-11-09 09:55 AM
Adding the following includes in Model.cpp prevents the touchgfx simulator from successfully compiling:
#include <gui/model/Model.hpp>
#include <gui/model/ModelListener.hpp>
extern "C"
{
#include "main.h"
#include "FreeRTOS.h"
#include "queue.h"
#include "task.h"
}
I tried adding to the makefile include path as follows, but I think I'm going down a rabbit hole.
#keep framework include and source out of this $(build_root_path)../Core/Inc
include_paths := $(library_includes) $(foreach comp, $(all_components), $(comp)/include) $(framework_includes) \
C:/Users/webst/STM32CubeIDE/workspace_1.0.1/stm32F769I_disco_cubeide/Core/Inc \
C:/Users/webst/STM32CubeIDE/workspace_1.0.1/stm32F769I_disco_cubeide/Drivers/STM32F7xx_HAL_Driver/Inc \
C:/Users/webst/STM32CubeIDE/workspace_1.0.1/stm32F769I_disco_cubeide/Drivers/CMSIS/Device/ST/STM32F7xx/Include
source_paths = $(foreach comp, $(all_components), $(comp)/src) $(framework_source) simulator
The simulator errors:
Compile
make -f simulator/gcc/Makefile -j10
Converting images
Compiling gui/src/model/Model.cpp
In file included from C:/Users/webst/STM32CubeIDE/workspace_1.0.1/stm32F769I_disco_cubeide/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h:30:0,
from C:/Users/webst/STM32CubeIDE/workspace_1.0.1/stm32F769I_disco_cubeide/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h:29,
from C:/Users/webst/STM32CubeIDE/workspace_1.0.1/stm32F769I_disco_cubeide/Core/Inc/stm32f7xx_hal_conf.h:231,
from C:/Users/webst/STM32CubeIDE/workspace_1.0.1/stm32F769I_disco_cubeide/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h:30,
from C:/Users/webst/STM32CubeIDE/workspace_1.0.1/stm32F769I_disco_cubeide/Core/Inc/main.h:31,
from gui/src/model/Model.cpp:8:
C:/Users/webst/STM32CubeIDE/workspace_1.0.1/stm32F769I_disco_cubeide/Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f7xx.h:162:3: error: #error "Please select first the target STM32F7xx device used in your application (in stm32f7xx.h file)"
#error "Please select first the target STM32F7xx device used in your application (in stm32f7xx.h file)"
^~~~~
In file included from gui/src/model/Model.cpp:8:0:
C:/Users/webst/STM32CubeIDE/workspace_1.0.1/stm32F769I_disco_cubeide/Core/Inc/main.h:33:22: fatal error: otm8009a.h: No such file or directory
#include "otm8009a.h"
^
compilation terminated.
Any suggestions? My project in cubeide compiles fine, but I'd like to maintain the ability to use the simulator.
Solved! Go to Solution.
2019-11-10 07:39 AM
Found the example on the website that shows the correct way:
#include <gui/model/Model.hpp>
#include <gui/model/ModelListener.hpp>
#ifndef SIMULATOR
extern "C"
{
#include "main.h"
}
#include "FreeRTOS.h"
#include "queue.h"
#include "task.h"
extern osMessageQId displayMessageQHandle;
extern osMessageQId displayMessageQ2Handle;
uint8_t newEncoderCount = 0; //this is the variable local to this file that the message queue populates in the model tick when received
static uint8_t ucLEDState = FALSE;
#else
#define FALSE 0
#define TRUE 1
#endif
Model::Model() : modelListener(0)
{
}
void Model::tick()
{
#ifndef SIMULATOR
if (xQueueReceive(displayMessageQHandle, &newEncoderCount, 0) == pdTRUE)
{
modelListener->setEncoderCount(newEncoderCount); //takes the value out of the queue and lets the listener know so that it can call the function
//that informs the presenter which then updates the view
}
#endif
}
void Model::getLEDState()
{
#ifndef SIMULATOR
if (ucLEDState == FALSE)
{
ucLEDState = TRUE;
}
else
{
ucLEDState = FALSE;
}
xQueueSend(displayMessageQ2Handle,&ucLEDState,0);
#endif
}
2019-11-10 07:39 AM
Found the example on the website that shows the correct way:
#include <gui/model/Model.hpp>
#include <gui/model/ModelListener.hpp>
#ifndef SIMULATOR
extern "C"
{
#include "main.h"
}
#include "FreeRTOS.h"
#include "queue.h"
#include "task.h"
extern osMessageQId displayMessageQHandle;
extern osMessageQId displayMessageQ2Handle;
uint8_t newEncoderCount = 0; //this is the variable local to this file that the message queue populates in the model tick when received
static uint8_t ucLEDState = FALSE;
#else
#define FALSE 0
#define TRUE 1
#endif
Model::Model() : modelListener(0)
{
}
void Model::tick()
{
#ifndef SIMULATOR
if (xQueueReceive(displayMessageQHandle, &newEncoderCount, 0) == pdTRUE)
{
modelListener->setEncoderCount(newEncoderCount); //takes the value out of the queue and lets the listener know so that it can call the function
//that informs the presenter which then updates the view
}
#endif
}
void Model::getLEDState()
{
#ifndef SIMULATOR
if (ucLEDState == FALSE)
{
ucLEDState = TRUE;
}
else
{
ucLEDState = FALSE;
}
xQueueSend(displayMessageQ2Handle,&ucLEDState,0);
#endif
}