Search code examples
assemblystm32

CMSIS header availability for assembly code


I enjoy coding small routines for my STM Nucleo boards in assembler. Does anyone know if there are header definitions usable with assembler? For example in C, to obtain the address of the DWT clock counter all one has to do is write &DWT->CYCCNT. I can of course pass this address from my C caller to the assembler routine but it would be more elegant if I were able to provide a header, such as CMSIS/Include/core_cm7.h, to the assembler code.


Solution

  • Sadly, no. These microcontrollers are not targetted at people writing assembly for fun when a higher level language would be more appropriate in a professional setting.

    You will have to make your own definitions for use in assembly. One idea would be to write a script to extract the register names and values from the CMSIS headers automatically. This way if an updated header is released or you switch to a new part you can get going straight away.