Compile error for STM32G071RB Nucleo with UCPD and GUI interface enabled
While trying to test out the USB-PD middleware, I generated a project for the STM32G071RB Nulceo dev board with Tracer EMB and GUI interface enabled. Generating the code works fine however, I'm getting a compile error that traces back to the FLASH_SIZE macro in stm32g071xx.h
If I turn off the GUI module, the error goes away.
I was able to work around the problem by changing the FLASH_SIZE macro to just be the hard-coded size of the flash on my part, but this isn't a good solution.
The weird thing is, once I got the project to compile and load, I was able to past the original macro expression into the debugger expression evaluator and it came back with the correct answer (0x20000), so it doesn't seem to be a simple syntax error.
Here is the error:
In file included from ../Drivers/CMSIS/Device/ST/STM32G0xx/Include/stm32g0xx.h:117,
from ../Core/Inc/usbpd_gui_memmap.h:31,
from ../Utilities/GUI_INTERFACE/bsp_gui.h:23,
from ../Utilities/GUI_INTERFACE/bsp_gui.c:22:
../Drivers/CMSIS/Device/ST/STM32G0xx/Include/stm32g071xx.h:640:34: error: operator '*' has no left operand
640 | #define FLASH_SIZE (((*((uint32_t *)FLASHSIZE_BASE)) & (0x00FFU)) << 10U)
| ^
../Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_hal_flash.h:889:42: note: in expansion of macro 'FLASH_SIZE'
889 | #define FLASH_BANK_SIZE (FLASH_SIZE) /*!< FLASH Bank Size */
| ^~~~~~~~~~
../Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_hal_flash.h:893:42: note: in expansion of macro 'FLASH_BANK_SIZE'
893 | #define FLASH_PAGE_NB (FLASH_BANK_SIZE/FLASH_PAGE_SIZE) /* Number of pages per bank */
| ^~~~~~~~~~~~~~~
../Core/Inc/usbpd_gui_memmap.h:55:34: note: in expansion of macro 'FLASH_PAGE_NB'
55 | #define INDEX_PAGE (FLASH_PAGE_NB - 1u) /* Index of latest page */
| ^~~~~~~~~~~~~
../Core/Inc/usbpd_gui_memmap.h:57:48: note: in expansion of macro 'INDEX_PAGE'
57 | #define ADDR_FLASH_LAST_PAGE (FLASH_BASE + (INDEX_PAGE * FLASH_PAGE_SIZE)) /* Base @ of latest page */
| ^~~~~~~~~~
../Core/Inc/usbpd_gui_memmap.h:60:40: note: in expansion of macro 'ADDR_FLASH_LAST_PAGE'
60 | #define GUI_FLASH_MAGIC_NUMBER ADDR_FLASH_LAST_PAGE
| ^~~~~~~~~~~~~~~~~~~~
../Utilities/GUI_INTERFACE/bsp_gui.c:24:5: note: in expansion of macro 'GUI_FLASH_MAGIC_NUMBER'
24 | #if GUI_FLASH_MAGIC_NUMBER
| ^~~~~~~~~~~~~~~~~~~~~~Has anybody else seen this error?
