Skip to content

These module docs are in beta and may be incomplete.

modm:cmsis:device: STM32 CMSIS Headers

This module wraps the CMSIS headers for STM32 devices and provides the header file and CPP definitions for accessing the modm:target peripherals. Specifically, it copies the target header file which provides the CMSIS implementation of the target's language interface for its memory-mapped peripherals.

Discrepancies between documentation and headers

These CMSIS headers should reflect what's written in the documentation, however, in our experience there may be small differences in naming, behavior and availability between it and this implementation. Since ST is not interested in addressing these issues, please contribute to our patch list.

The generated header file modm/platform/device.hpp contains the necessary target define STM32{FAMILY}{NAME}xx or similar and includes the modm:target-specific header.

Include only modm/platform/device.hpp!

This file is only included by interface implementations inside the modm/platform folder! If you need to implement your own drivers, include only this file.

CMSIS Compliance

modm implements the target specific CMSIS functionality itself, without using the CMSIS interface. This is necessary to provide similar functionality on non-Cortex-M based targets.

Specifically, these functions are not implemented:

  • uint32_t SystemCoreClock and void SystemCoreClockUpdate(): please use modm::clock::f_cpu as defined in the modm:architecture:clock module.
  • void SystemInit(): modm defines its own startup architecture, see the modm:platform:core module for details.

Debugging Peripherals

When debugging with GDB, it can sometimes be difficult to access peripherals, due to the CMSIS implementation with CPP defines and GCC optimization flags. Depending on these circumstances, GDB may only "see" a peripheral in a certain context, which can make the debugging experience quite frustrating.

To aid this, we generate a linkerscript fragment and source file, which place the peripherals memory as real objects in the peripheral memory space. You can then access these peripherals inside GDB at any time, regardless of context and build profile setting:

(gdb) p/x *GPIOB
$1 = {
  MODER = 0xaa0280,
  OTYPER = 0x300,
  OSPEEDR = 0x2a00c0,
  PUPDR = 0x400100,
  IDR = 0xfd0,
  ODR = 0x100,
  BSRR = 0x0,
  LCKR = 0x0,
  AFR = {0x0, 0x7744}
}

This does not have any effect on your firmware! It is purely a debug helper feature and none of these definitions make it into the executable.

Beware read/write side-effects

When debugging be aware of the side-effects that your read or write to a peripheral memory location can have. It's fairly obvious that a write may have consequences, but also reads can modify peripheral state, for example, a hardware FIFO buffer may pop the queue if your read the top of it.

Content

// Variable
ADC_Common_TypeDef ___ADC123_COMMON ;
ADC_TypeDef ___ADC1 ;
ADC_TypeDef ___ADC2 ;
ADC_TypeDef ___ADC3 ;
CAN_TypeDef ___CAN1 ;
CAN_TypeDef ___CAN2 ;
CRC_TypeDef ___CRC ;
CoreDebug_Type ___CoreDebug ;
DAC_TypeDef ___DAC ;
DAC_TypeDef ___DAC1 ;
DBGMCU_TypeDef ___DBGMCU ;
DCMI_TypeDef ___DCMI ;
DMA2D_TypeDef ___DMA2D ;
DMA_Stream_TypeDef ___DMA1_Stream0 ;
DMA_Stream_TypeDef ___DMA1_Stream1 ;
DMA_Stream_TypeDef ___DMA1_Stream2 ;
DMA_Stream_TypeDef ___DMA1_Stream3 ;
DMA_Stream_TypeDef ___DMA1_Stream4 ;
DMA_Stream_TypeDef ___DMA1_Stream5 ;
DMA_Stream_TypeDef ___DMA1_Stream6 ;
DMA_Stream_TypeDef ___DMA1_Stream7 ;
DMA_Stream_TypeDef ___DMA2_Stream0 ;
DMA_Stream_TypeDef ___DMA2_Stream1 ;
DMA_Stream_TypeDef ___DMA2_Stream2 ;
DMA_Stream_TypeDef ___DMA2_Stream3 ;
DMA_Stream_TypeDef ___DMA2_Stream4 ;
DMA_Stream_TypeDef ___DMA2_Stream5 ;
DMA_Stream_TypeDef ___DMA2_Stream6 ;
DMA_Stream_TypeDef ___DMA2_Stream7 ;
DMA_TypeDef ___DMA1 ;
DMA_TypeDef ___DMA2 ;
DSI_TypeDef ___DSI ;
DWT_Type ___DWT ;
ETH_TypeDef ___ETH ;
EXTI_TypeDef ___EXTI ;
FLASH_TypeDef ___FLASH ;
FMC_Bank1E_TypeDef ___FMC_Bank1E ;
FMC_Bank1_TypeDef ___FMC_Bank1 ;
FMC_Bank3_TypeDef ___FMC_Bank3 ;
FMC_Bank5_6_TypeDef ___FMC_Bank5_6 ;
FPU_Type ___FPU ;
GPIO_TypeDef ___GPIOA ;
GPIO_TypeDef ___GPIOB ;
GPIO_TypeDef ___GPIOC ;
GPIO_TypeDef ___GPIOD ;
GPIO_TypeDef ___GPIOE ;
GPIO_TypeDef ___GPIOF ;
GPIO_TypeDef ___GPIOG ;
GPIO_TypeDef ___GPIOH ;
GPIO_TypeDef ___GPIOI ;
GPIO_TypeDef ___GPIOJ ;
GPIO_TypeDef ___GPIOK ;
I2C_TypeDef ___I2C1 ;
I2C_TypeDef ___I2C2 ;
I2C_TypeDef ___I2C3 ;
ITM_Type ___ITM ;
IWDG_TypeDef ___IWDG ;
LTDC_Layer_TypeDef ___LTDC_Layer1 ;
LTDC_Layer_TypeDef ___LTDC_Layer2 ;
LTDC_TypeDef ___LTDC ;
MPU_Type ___MPU ;
NVIC_Type ___NVIC ;
PWR_TypeDef ___PWR ;
QUADSPI_TypeDef ___QUADSPI ;
RCC_TypeDef ___RCC ;
RNG_TypeDef ___RNG ;
RTC_TypeDef ___RTC ;
SAI_Block_TypeDef ___SAI1_Block_A ;
SAI_Block_TypeDef ___SAI1_Block_B ;
SAI_TypeDef ___SAI1 ;
SCB_Type ___SCB ;
SCnSCB_Type ___SCnSCB ;
SDIO_TypeDef ___SDIO ;
SPI_TypeDef ___I2S2ext ;
SPI_TypeDef ___I2S3ext ;
SPI_TypeDef ___SPI1 ;
SPI_TypeDef ___SPI2 ;
SPI_TypeDef ___SPI3 ;
SPI_TypeDef ___SPI4 ;
SPI_TypeDef ___SPI5 ;
SPI_TypeDef ___SPI6 ;
SYSCFG_TypeDef ___SYSCFG ;
SysTick_Type ___SysTick ;
TIM_TypeDef ___TIM1 ;
TIM_TypeDef ___TIM10 ;
TIM_TypeDef ___TIM11 ;
TIM_TypeDef ___TIM12 ;
TIM_TypeDef ___TIM13 ;
TIM_TypeDef ___TIM14 ;
TIM_TypeDef ___TIM2 ;
TIM_TypeDef ___TIM3 ;
TIM_TypeDef ___TIM4 ;
TIM_TypeDef ___TIM5 ;
TIM_TypeDef ___TIM6 ;
TIM_TypeDef ___TIM7 ;
TIM_TypeDef ___TIM8 ;
TIM_TypeDef ___TIM9 ;
TPI_Type ___TPI ;
USART_TypeDef ___UART4 ;
USART_TypeDef ___UART5 ;
USART_TypeDef ___UART7 ;
USART_TypeDef ___UART8 ;
USART_TypeDef ___USART1 ;
USART_TypeDef ___USART2 ;
USART_TypeDef ___USART3 ;
USART_TypeDef ___USART6 ;
WWDG_TypeDef ___WWDG ;

// Define
#define STM32F469xx

Dependencies

modm:cmsis:device modm_cmsis_device modm: cmsis: device modm_cmsis modm: cmsis modm_cmsis_device->modm_cmsis modm_cmsis_core modm: cmsis: core modm_cmsis_device->modm_cmsis_core modm_platform_adc modm: platform: adc modm_platform_adc->modm_cmsis_device modm_platform_can modm: platform: can modm_platform_can->modm_cmsis_device modm_platform_clock modm: platform: clock modm_platform_clock->modm_cmsis_device modm_platform_clock_cortex modm: platform: clock.cortex modm_platform_clock_cortex->modm_cmsis_device modm_platform_core modm: platform: core modm_platform_core->modm_cmsis_device modm_platform_dma modm: platform: dma modm_platform_dma->modm_cmsis_device modm_platform_fault_cortex modm: platform: fault.cortex modm_platform_fault_cortex->modm_cmsis_device modm_platform_gpio modm: platform: gpio modm_platform_gpio->modm_cmsis_device modm_platform_i2c modm: platform: i2c modm_platform_i2c->modm_cmsis_device modm_platform_random modm: platform: random modm_platform_random->modm_cmsis_device modm_platform_spi modm: platform: spi modm_platform_spi->modm_cmsis_device modm_platform_timer modm: platform: timer modm_platform_timer->modm_cmsis_device modm_platform_uart modm: platform: uart modm_platform_uart->modm_cmsis_device modm_platform_uart_spi modm: platform: uart.spi modm_platform_uart_spi->modm_cmsis_device