0

So I'm trying to get a rough measure of the execution of a certain function.

I'm trying to use the DWT library with the code

CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
DWT->LAR = 0xC5ACCE55; 
DWT->CYCCNT = 0;
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;

but clearly the compiler returns error: 'CoreDebug' undeclared (first use in this function)

I'm seeing that inside Drivers/DMSIS/Include there are various .h files including it (i.e. core_armv8mml.h, core_cm3.h, core_cm33.h, core_cm4.h, core_cm7.h, core_sc300.h)

Which one should I use for the STM32F091

NicoCaldo
  • 1,171
  • 13
  • 25
  • STM32F0 devices have Cortex-M0 cores. So you probably want `core_cm0.h`. – pmacfarlane Feb 13 '23 at 12:33
  • @pmacfarlane that has no `CoreDebug_DEMCR_TRCENA_Msk` tho.... – NicoCaldo Feb 13 '23 at 12:36
  • 1
    Maybe not available. In `core_cm0.h`: `Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor. Therefore they are not covered by the Cortex-M0 header file.` – pmacfarlane Feb 13 '23 at 14:47

0 Answers0