configs/stm32f4discovery: If the Critical Section Monitor, modify the ITM_LAR register to assure that the DWT cycle counter is enabled. Suggested by Dave Marples.

This commit is contained in:
Gregory Nutt 2018-11-30 17:57:26 -06:00
parent 3a2a423214
commit f66fb3ac63

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/stm32f4discovery/src/stm32_boot.c * configs/stm32f4discovery/src/stm32_boot.c
* *
* Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2011-2012, 2015, 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -45,6 +45,7 @@
#include <arch/board/board.h> #include <arch/board/board.h>
#include "up_arch.h" #include "up_arch.h"
#include "itm.h"
#include "stm32.h" #include "stm32.h"
#include "stm32f4discovery.h" #include "stm32f4discovery.h"
@ -66,6 +67,15 @@
void stm32_boardinitialize(void) void stm32_boardinitialize(void)
{ {
#ifdef CONFIG_SCHED_CRITMONITOR
/* Make sure the high speed cycle counter is running. It will be started
* automatically only if a debugger is connected.
*/
putreg32(0xc5acce55, ITM_LAR);
modifyreg32(DWT_CTRL, 0, DWT_CTRL_CYCCNTENA_MASK);
#endif
#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3) #if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
/* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak
* function stm32_spidev_initialize() has been brought into the link. * function stm32_spidev_initialize() has been brought into the link.