when refactoring large projects, it is often feasible to do a step by step transition.
I have had the opportunity to replace FreeRTOS / ST lib by ChibiOS and came
across an issue with the ChibiOS modification in ST's chip header file.
e.g. stm32f4xx.h
There the GPIO_TypeDef struct has been removed and thus makes it impossible to use
ST libs gpio functions. This in turn renders legacy drivers unusable and makes a step by step
transition very hard.
I think it is not necessary to completely remove this struct but fix it while preserving compatibility with ST lib:
Code: Select all
typedef struct {
__IO uint32_t MODER; /*!< GPIO port mode register, Address offset: 0x00 */
__IO uint32_t OTYPER; /*!< GPIO port output type register, Address offset: 0x04 */
__IO uint32_t OSPEEDR; /*!< GPIO port output speed register, Address offset: 0x08 */
__IO uint32_t PUPDR; /*!< GPIO port pull-up/pull-down register, Address offset: 0x0C */
__IO uint32_t IDR; /*!< GPIO port input data register, Address offset: 0x10 */
__IO uint32_t ODR; /*!< GPIO port output data register, Address offset: 0x14 */
union {
struct {
__IO uint16_t BSRRL;/*!< GPIO port bit set/reset low register, Address offset: 0x18 */
__IO uint16_t BSRRH;/*!< GPIO port bit set/reset high register, Address offset: 0x1A */
};
volatile union {
__IO uint32_t W;
struct {
__IO uint16_t set;
__IO uint16_t clear;
} H;
} BSRR;
};
__IO uint32_t LCKR; /*!< GPIO port configuration lock register, Address offset: 0x1C */
union {
__IO uint32_t AFR[2]; /*!< GPIO alternate function registers, Address offset: 0x20-0x24 */
struct {
__IO uint32_t AFRL;
__IO uint32_t AFRH;
};
};
} GPIO_TypeDef;
Of course the corresponsing declaration then has to be removed from STM32/GPIOv2/pal_lld.h.
What do you think?
Best regards,
Vinz