After poking around a bit more in the STM32CubeIDE code, I'm seeing a pattern of issues that indicate a serious lack of understanding on the part of the authors of the shipping BSP code. This code was written several years ago, but it is the shipping version and suffers from serious performance problems due entirely to the inexperience of the authors. A good example:
Taken from (STM32Cube_FW_F7_V1.17.1/Drivers/BSP/Components/st7735)
In the st7735_WritePixel() function below, the author is creating 2 unique SPI transactions to send the 16 bits of the pixel color instead of sending a single 2 byte transaction. This wouldn't be such a big deal except that other graphics primitives depend on this function (e.g. DrawVLine() below).
The DrawVLine() function takes 2 orders or magnitude longer than needed simply because the author doesn't understand how Sitronix LCD controllers use memory windows to control the write pointer. It naively calls the WritePixel function and compounds the performance problem. I can find other examples, but this is enough to indicate that every component within the BSP needs a full code review. These may seem like simple issues, but the SPI LCD components are full of badly performing code like this. When using this code, it will reflect poorly on the actual speed of the MCUs because LCDs will display everything much slower than necessary. Is anyone at ST interested in fixing this?
/**
* @brief Writes pixel.
*
@PAram Xpos: specifies the X position.
*
@PAram Ypos: specifies the Y position.
*
@PAram RGBCode: the RGB pixel color
* @retval None
*/
void st7735_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode)
{
uint8_t data = 0;
if((Xpos >= ST7735_LCD_PIXEL_WIDTH) || (Ypos >= ST7735_LCD_PIXEL_HEIGHT))
{
return;
}
/* Set Cursor */
st7735_SetCursor(Xpos, Ypos);
data = RGBCode >> 8;
LCD_IO_WriteMultipleData(&data, 1);
data = RGBCode;
LCD_IO_WriteMultipleData(&data, 1);
}
/**
* @brief Draws vertical line.
*
@PAram RGBCode: Specifies the RGB color
*
@PAram Xpos: specifies the X position.
*
@PAram Ypos: specifies the Y position.
*
@PAram Length: specifies the line length.
* @retval None
*/
void st7735_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
{
uint8_t counter = 0;
if(Ypos + Length > ST7735_LCD_PIXEL_HEIGHT) return;
for(counter = 0; counter < Length; counter++)
{
st7735_WritePixel(Xpos, Ypos + counter, RGBCode);
}
}