changeset 3279:8cd345c99e6b

* src/stm32_misc.c: Ensure TIM2 clock enabled when profiling. [Bugzilla 1001953]
author jld
date Mon, 03 Mar 2014 08:18:43 +0000
parents 4b1912ce7f4f
children 0e7f32e78b4d
files packages/hal/cortexm/stm32/var/current/ChangeLog packages/hal/cortexm/stm32/var/current/src/stm32_misc.c
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/packages/hal/cortexm/stm32/var/current/ChangeLog
+++ b/packages/hal/cortexm/stm32/var/current/ChangeLog
@@ -1,3 +1,8 @@
+2014-02-28  John Dallaway  <john@dallaway.org.uk>
+
+	* src/stm32_misc.c: Ensure TIM2 clock enabled when profiling.
+	[Bugzilla 1001953]
+
 2013-04-06  Jerzy Dyrda  <jerzdy@gmail.com>
 
 	* include/var_io_eth.h: 
@@ -380,7 +385,7 @@ 2008-10-06  Nick Garnett  <nickg@ecoscen
 // ####GPLCOPYRIGHTBEGIN####                                                
 // -------------------------------------------                              
 // This file is part of eCos, the Embedded Configurable Operating System.   
-// Copyright (C) 2008, 2009, 2011, 2013 Free Software Foundation, Inc.                        
+// Copyright (C) 2008, 2009, 2011, 2013, 2014 Free Software Foundation, Inc.                        
 //
 // This program is free software; you can redistribute it and/or modify     
 // it under the terms of the GNU General Public License as published by     
--- a/packages/hal/cortexm/stm32/var/current/src/stm32_misc.c
+++ b/packages/hal/cortexm/stm32/var/current/src/stm32_misc.c
@@ -8,7 +8,7 @@
 // ####ECOSGPLCOPYRIGHTBEGIN####                                            
 // -------------------------------------------                              
 // This file is part of eCos, the Embedded Configurable Operating System.   
-// Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.                        
+// Copyright (C) 2008, 2009, 2011, 2014 Free Software Foundation, Inc.                        
 //
 // eCos is free software; you can redistribute it and/or modify it under    
 // the terms of the GNU General Public License as published by the Free     
@@ -531,6 +531,7 @@ cyg_uint32 hal_stm32_timer_clock( CYG_AD
 #ifdef CYGFUN_HAL_CORTEXM_STM32_PROFILE_TIMER
 // Use TIM2 for profiling
 #define STM32_TIMER_PROFILE CYGHWR_HAL_STM32_TIM2
+#define STM32_CLOCK_PROFILE CYGHWR_HAL_STM32_TIM2_CLOCK
 #define HAL_INTERRUPT_PROFILE CYGNUM_HAL_INTERRUPT_TIM2
 
 // Profiling timer ISR
@@ -549,6 +550,9 @@ int hal_enable_profile_timer(int resolut
 {
     CYG_ASSERT(resolution < 0x10000, "Invalid profile timer resolution"); // 16 bits only
 
+    // Enable clock
+    CYGHWR_HAL_STM32_CLOCK_ENABLE(STM32_CLOCK_PROFILE);
+
     // Attach ISR
     HAL_INTERRUPT_ATTACH(HAL_INTERRUPT_PROFILE, &profile_isr, 0x1111, 0);
     HAL_INTERRUPT_UNMASK(HAL_INTERRUPT_PROFILE);