Page 1 of 1

CMSIS Header

Posted: Fri Jul 24, 2015 4:03 pm
by Tectu
I am currently busy extending the LTDC driver of the uGFX library. As this is a platform specific driver registers are directly accessed within this driver (there is no need for a display controller board file). The LTDC peripheral of the STM32F4x9 and the STM32F7 are sadly just 99.9% compatible. The following code is required:

Code: Select all

   // Enable the LTDC clock
   #if defined(STM32F4)
      RCC->DCKCFGR = (RCC->DCKCFGR & ~RCC_DCKCFGR_PLLSAIDIVR) | (1 << 16);
   #elif defined(STM32F7)
      RCC->DCKCFGR1 = (RCC->DCKCFGR1 & ~RCC_DCKCFGR1_PLLSAIDIVR) | (1 << 16);
   #else
      #error STM32LTDC driver not implemented for your platform
   #endif

The reason why the driver directly accesses the LTDC registers are because the driver is meant to work on all underlying systems (BareBetal, ChibiOS/RT, ...) without relying on any special HAL. This is furthermore no problem as the user cannot use the peripheral for something else at the same time (this would eg. be a problem when working with an I2C or SPI peripheral), but the LTDC is fully dedicated to uGFX when enabled.

Inside the the ChibiOS/RT sources I see that CMSIS headers are being included, but with the following comment:

Code: Select all

/* Including the device CMSIS header. Note, we are not using the definitions
   from this header because we need this file to be usable also from
   assembler source files. We verify that the info matches instead.*/
#include "stm32f4xx.h"

I am not really sure what is happening here. I just want to be sure that the CMSIS macros for STM32F4, STM32F7 and so on will be available so that ChibiOS/RT users can use the LTDC driver without any additional modifications.


~ Tectu

Re: CMSIS Header

Posted: Fri Jul 24, 2015 5:11 pm
by Giovanni
Modify vendor headers proved to be a bad idea, in 3.0 I decided to not evn try to fix their stuff. What I do is, in drivers, put code similar to what you posted addressing differences in headers.

Nothing special is going on, I simply include the unmodified headers and address problems and differences in the HAL drivers.

Giovanni

Re: CMSIS Header

Posted: Fri Jul 24, 2015 7:14 pm
by Tectu
That makes totally sense to me.
I guess we are both fine then and everything should work for everybody™


~ Tectu