Jump to content

STM32F746-Disco colour definition problem


Simon

Recommended Posts

Hi,

I'm got the uGFX demos working and I also have the STM32F746-disco project working. This is the project that was posted to show the fix for the problem caused by the ST HAL and the duplication of colour names Red/Green/Blue between the ST HAL DMA2D component and uGFX.

However, I am now trying to go one step further and get the LED blinking on the board (small steps!). To do this I have copied the STM32F746-disco project and added an include to the main.c (stm32746g_discovery.h) and a statement to init the LED as below:

#include "gui.h"
#include "gfx.h"
#include "stm32f7xx.h"
#include "stm32f7xx_hal.h"
#include "stm32746g_discovery.h"
int main(int argc, char* argv[])
{
	(void)argc;
	(void)argv;

	BSP_LED_Init(LED1);

	gfxInit();

I have also added the directory with the STM32F746 modules into the build:

image.png.194baaa767280ab3c1522d2ca779a35d.png

However, this causes compile errors which are solved by defining the appropriate defs in the stm32f7xx_hal_conf.h file. These are for  UART, I2C, SAI, TIM, DCMI and DMA2D. As has been reported before  the DMA2D module has defines included for Red/Green/Blue and thus the HTML2COLOR macro causes the compile to fail:

arm-none-eabi-gcc -mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-sp-d16 -DSTM32F746G_DISCO -DSTM32F746NGHx -DSTM32F7 -DSTM32 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F746xx -I"/home/simon/ARM-radio/test-uGFX/inc" -I"/home/simon/ARM-radio/test-uGFX/HAL_Driver/Inc" -I"/home/simon/ARM-radio/test-uGFX/CMSIS/core" -I"/home/simon/ARM-radio/test-uGFX/CMSIS/device" -I"/home/simon/ARM-radio/test-uGFX/uGFX" -I"/home/simon/ARM-radio/test-uGFX/uGFX/drivers/gdisp/STM32LTDC" -I"/home/simon/ARM-radio/test-uGFX/uGFX/drivers/ginput/touch/FT5336" -I"/home/simon/ARM-radio/test-uGFX/uGFX/src/gdisp/mcufont" -I"/home/simon/ARM-radio/test-uGFX/rsc" -I"/home/simon/ARM-radio/test-uGFX/Utilities/STM32746G-Discovery" -O0 -g3 -Wall -fmessage-length=0 -ffunction-sections -c -MMD -MP -MF"uGFX/drivers/ginput/touch/FT5336/gmouse_lld_FT5336.d" -MT"uGFX/drivers/ginput/touch/FT5336/gmouse_lld_FT5336.o" -o "uGFX/drivers/ginput/touch/FT5336/gmouse_lld_FT5336.o" "../uGFX/drivers/ginput/touch/FT5336/gmouse_lld_FT5336.c"
In file included from /home/simon/ARM-radio/test-uGFX/uGFX/src/gdisp/gdisp.h:221:0,
                 from /home/simon/ARM-radio/test-uGFX/uGFX/gfx.h:214,
                 from ../uGFX/drivers/ginput/touch/FT5336/gmouse_lld_FT5336.c:8:
/home/simon/ARM-radio/test-uGFX/uGFX/src/gdisp/gdisp_colors.h:309:28: error: expected declaration specifiers or '...' before '(' token
   #define HTML2COLOR_R(h)  ((h) & ((0xFFL & ~((1<<(8-COLOR_BITS_R))-1))<<16))
                            ^
/home/simon/ARM-radio/test-uGFX/uGFX/src/gdisp/gdisp_colors.h:329:39: note: in expansion of macro 'HTML2COLOR_R'
  #define HTML2COLOR(h)  ((COLOR_TYPE)(HTML2COLOR_R(h) | HTML2COLOR_G(h) | HTML2COLOR_B(h)))
                                       ^
/home/simon/ARM-radio/test-uGFX/uGFX/src/gdisp/gdisp_colors.h:87:16: note: in expansion of macro 'HTML2COLOR'
 #define Blue   HTML2COLOR(0x0000FF)
                ^
/home/simon/ARM-radio/test-uGFX/HAL_Driver/Inc/stm32f7xx_hal_dma2d.h:69:12: note: in expansion of macro 'Blue'
   uint32_t Blue;               /*!< Configures the blue value.
            ^

The undef's that have been included in uGFX files don't appear to resolve this problem.

My feeling is that there is a step that I have missed but I have spent quite a lot of the last three days trying to get my head around this and can't see what to do.

Any help would be appreciated :-)

Thanks

Simon.

Link to comment
Share on other sites

2 hours ago, Simon said:

This is the project that was posted to show the fix for the problem caused by the ST HAL and the duplication of colour names Red/Green/Blue between the ST HAL DMA2D component and uGFX.

The project doesn't really fix anything. It just doesn't include any files from the HAL-library that have color defines in them that conflict with the µGFX colors. So in that project the DMA2D HAL-component is just not included so it doesn't cause any trouble.

2 hours ago, Simon said:

However, this causes compile errors which are solved by defining the appropriate defs in the stm32f7xx_hal_conf.h file. These are for  UART, I2C, SAI, TIM, DCMI and DMA2D.

So including the DMA2D indeed causes your compile problems. I don't see why you would want to include the DMA2D HAL-module as you are using µGFX to drive the display.

What I would recommend:

- From the Utilities/STM32F746G-Discovery folder exclude the stm32746g_discovery_lcd.c and .h files.
- After that also exclude the DMA2D HAL-component from the build again.

Normally that should fix the color problems and you should be able to use µGFX to drive the display and use the other BSP components.

Link to comment
Share on other sites

Thank you! I'm sure I had already tried that but....

It's working fine now, I have excluded several of the stm32746g_discovery_*.c files from the build, e.g. in addition to not needing the lcd module I don't need the camera module.

Now, perhaps, I can start to do something more interesting rather than grapple with compile problems :)

Link to comment
Share on other sites

13 minutes ago, Simon said:

in addition to not needing the lcd module I don't need the camera module.

Ah yes! It could be that the camera module also uses some color definitions. Normally all these problems will go away with µGFX V3 so that is good news!

14 minutes ago, Simon said:

Now, perhaps, I can start to do something more interesting rather than grapple with compile problems :)

Setting up a project is indeed the hardest part sometimes! But after setting it up comes all the fun ^_^

If you have any other problems just let us know!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...