2021-10-18 07:26 AM
When building a freshly generated project using touchGfx on a stm32WB55 mcu, compiler complains about
../Drivers/CMSIS/Device/ST/STM32WBxx/Include/stm32wb55xx.h:1084:29: error: expected identifier before '(' token
1084 | #define LCD ((LCD_TypeDef *) LCD_BASE)
| ^
../TouchGFX/target/generated/TouchGFXGeneratedHAL.hpp:44:66: note: in expansion of macro 'LCD'
44 | TouchGFXGeneratedHAL(touchgfx::DMA_Interface& dma, touchgfx::LCD& display, touchgfx::TouchController& tc, uint16_t width, uint16_t height) :
| ^~~
This seems to be caused by
#define LCD ((LCD_TypeDef *) LCD_BASE)
in stm32wb55xx.h that doesn't really fit with the function declaration
TouchGFXGeneratedHAL(touchgfx::DMA_Interface& dma, touchgfx::LCD& display, touchgfx::TouchController& tc, uint16_t width, uint16_t height) :
touchgfx::HAL(dma, display, tc, width, height)
{
}
Solution is to comment out the #define in stm32wb55xx.h ...
any other idea to fix this ?
Solved! Go to Solution.
2021-12-02 06:07 AM
Hi!
I solved it like in LCD.hpp (lines 27-30), where I found:
// LCD is defined in some CubeFW C header file. We have to undef to be able to create the LCD class
#ifdef LCD
#undef LCD
#endif
Removing the definition of the macro LCD in TouchGFXGeneratedHAL.hpp (in project TouchGFX\target\generated folder) at the beginning of the file solves the problem. You will have to apply the modification after each code generation, though. Until the next release , hopefully!
2021-12-02 06:07 AM
Hi!
I solved it like in LCD.hpp (lines 27-30), where I found:
// LCD is defined in some CubeFW C header file. We have to undef to be able to create the LCD class
#ifdef LCD
#undef LCD
#endif
Removing the definition of the macro LCD in TouchGFXGeneratedHAL.hpp (in project TouchGFX\target\generated folder) at the beginning of the file solves the problem. You will have to apply the modification after each code generation, though. Until the next release , hopefully!
2021-12-02 11:24 AM
thanks for the tip !
Getting bored to always comment out the #define in stm32wb55x.h from my project, i modified the stm32wb55x.h file from the location where the FW package is stored (STM32Cube_FW_WB_V1.12.1\Drivers\CMSIS\Device\ST\STM32WBxx\Include) . This way everytime STM32MX generate code, it uses my modified version :)
Also, I put that FW package in a local git repository so it will be easier to identify the change i did to the package when/if it will be updated.