From f30d98b2ad40883451d34ecd16a9df42563cf41a Mon Sep 17 00:00:00 2001 From: richardbarry Date: Mon, 20 Dec 2010 12:14:45 +0000 Subject: [PATCH] Still updating the STM32L demo project - still a work in progress. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1176 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Demo/Cortex_STM32L152_IAR/FreeRTOSConfig.h | 3 +- Demo/Cortex_STM32L152_IAR/main.c | 42 ++++++++++++------- .../settings/RTOSDemo.dbgdt | 10 ++--- .../settings/RTOSDemo.dni | 17 ++++---- .../settings/RTOSDemo.wsdt | 12 +++--- 5 files changed, 47 insertions(+), 37 deletions(-) diff --git a/Demo/Cortex_STM32L152_IAR/FreeRTOSConfig.h b/Demo/Cortex_STM32L152_IAR/FreeRTOSConfig.h index 1cac0c8d3..c0f3f3f61 100644 --- a/Demo/Cortex_STM32L152_IAR/FreeRTOSConfig.h +++ b/Demo/Cortex_STM32L152_IAR/FreeRTOSConfig.h @@ -113,11 +113,12 @@ is included from an asm file. */ #ifdef __ICCARM__ #include "stm32l1xx_tim.h" extern void vConfigureTimerForRunTimeStats( void ); + unsigned long ulGetRunTimeStatsCounterValue( void ); extern unsigned long ulTIM6_OverflowCount; #endif /* __ICCARM__ */ #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats() -#define portGET_RUN_TIME_COUNTER_VALUE() ( ( ulTIM6_OverflowCount << 16UL ) | ( unsigned long ) TIM6->CNT ) +#define portGET_RUN_TIME_COUNTER_VALUE() ulGetRunTimeStatsCounterValue() #endif /* FREERTOS_CONFIG_H */ diff --git a/Demo/Cortex_STM32L152_IAR/main.c b/Demo/Cortex_STM32L152_IAR/main.c index 1b68a3c0b..f00bc03e3 100644 --- a/Demo/Cortex_STM32L152_IAR/main.c +++ b/Demo/Cortex_STM32L152_IAR/main.c @@ -142,16 +142,7 @@ static char cBuffer[ 256 ]; LCD_Clear( Blue ); lLine = 0; } - -if( ulx < 10 ) -{ - ulTempArray[ ulx++ ] = portGET_RUN_TIME_COUNTER_VALUE(); -} -else -{ - ulx = 0; -} - + switch( xReceivedMessage.cMessageID ) { case mainMESSAGE_BUTTON_UP : sprintf( cBuffer, "Button up = %d", xReceivedMessage.lMessageValue ); @@ -165,7 +156,10 @@ else case mainMESSAGE_BUTTON_SEL : printf( "\nTask\t Abs Time\t %%Time\n*****************************************\n" ); vTaskGetRunTimeStats( ( signed char * ) cBuffer ); printf( cBuffer ); - sprintf( cBuffer, "Select interrupt!" ); + + /* The select button passes its + own string to print out. */ + sprintf( cBuffer, "%s", ( char * ) xReceivedMessage.lMessageValue ); break; case mainMESSAGE_STATUS : sprintf( cBuffer, "Task status = %s", ( ( xReceivedMessage.lMessageValue ) ? "PASS" : "FAIL" ) ); break; @@ -181,7 +175,7 @@ else void EXTI9_5_IRQHandler( void ) { -const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, 0 }; +const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, ( unsigned long ) "Select Interrupt!" }; long lHigherPriorityTaskWoken = pdFALSE; xQueueSendFromISR( xLCDQueue, &xMessage, &lHigherPriorityTaskWoken ); @@ -237,7 +231,6 @@ static void prvSetupHardware( void ) /* Initialise the LEDs. */ vParTestInitialise(); - // /* Initialise the joystick inputs. */ STM_EVAL_PBInit( BUTTON_UP, BUTTON_MODE_GPIO ); STM_EVAL_PBInit( BUTTON_DOWN, BUTTON_MODE_GPIO ); @@ -293,7 +286,8 @@ NVIC_InitTypeDef NVIC_InitStructure; TIM_TimeBaseInit( TIM6, &TIM_TimeBaseStructure ); /* Only interrupt on overflow events. */ - TIM_UpdateRequestConfig( TIM6, TIM_UpdateSource_Regular ); + TIM6->CR1 |= TIM_CR1_URS; + //TIM6->CR1 &= (uint16_t)~((uint16_t)TIM_CR1_URS); TIM_ITConfig( TIM6, TIM_IT_Update, ENABLE ); @@ -303,15 +297,31 @@ NVIC_InitTypeDef NVIC_InitStructure; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0f; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; + TIM_ClearITPendingBit( TIM6, TIM_IT_Update ); NVIC_Init(&NVIC_InitStructure); TIM_Cmd( TIM6, ENABLE ); } /*-----------------------------------------------------------*/ +unsigned long ulGetRunTimeStatsCounterValue( void ) +{ +unsigned long ulReturn; + + TIM6->CR1 &= (uint16_t)(~((uint16_t)TIM_CR1_CEN)); + ulReturn = ( ( ulTIM6_OverflowCount << 16UL ) | ( unsigned long ) TIM6->CNT ); + TIM6->CR1 |= TIM_CR1_CEN; + + return ulReturn; +} +/*-----------------------------------------------------------*/ + void TIM6_IRQHandler( void ) { - ulTIM6_OverflowCount++; - TIM_ClearITPendingBit( TIM6, TIM_IT_Update ); + if( TIM_GetITStatus( TIM6, TIM_IT_Update) != RESET) + { + ulTIM6_OverflowCount++; + TIM_ClearITPendingBit( TIM6, TIM_IT_Update ); + } } diff --git a/Demo/Cortex_STM32L152_IAR/settings/RTOSDemo.dbgdt b/Demo/Cortex_STM32L152_IAR/settings/RTOSDemo.dbgdt index 07a7cea0c..dd9da81af 100644 --- a/Demo/Cortex_STM32L152_IAR/settings/RTOSDemo.dbgdt +++ b/Demo/Cortex_STM32L152_IAR/settings/RTOSDemo.dbgdt @@ -19,7 +19,7 @@ - 279272727 + 295272727 @@ -44,24 +44,24 @@ Workspace - RTOSDemoRTOSDemo/FreeRTOS_SourceRTOSDemo/FreeRTOS_Source/tasks.cRTOSDemo/System_and_ST_Code + RTOSDemoRTOSDemo/FreeRTOS_SourceRTOSDemo/System_and_ST_CodeRTOSDemo/System_and_ST_Code/Eval_Board_LibraryRTOSDemo/System_and_ST_Code/Peripheral_Library - 0TabID-10464-23570TasksTASKVIEW0TabID-31438-23586QueuesQUEUEVIEW0TabID-18392-8256Terminal I/OTerminalIO0TabID-14105-9360Debug LogDebug-Log0TabID-3252-10382WatchWatchulTIM6_OverflowCountulTempArray01251001001000 + 0TabID-10464-23570TasksTASKVIEW0TabID-31438-23586QueuesQUEUEVIEW0TabID-18392-8256Terminal I/OTerminalIO0 - 0100000010000001 + TextEditor$WS_DIR$\main.c013961096109TextEditor$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\port.c016871567156TextEditor$WS_DIR$\..\Common\Minimal\flash.c013158255825TextEditor$WS_DIR$\FreeRTOSConfig.h010555465576TextEditor$WS_DIR$\..\..\Source\tasks.c015895034450344TextEditor$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\portasm.s012148004800TextEditor$WS_DIR$\..\Common\Minimal\dynamic.c02251135511355TextEditor$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\inc\stm32l1xx_tim.h05832454724547TextEditor$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\src\stm32l1xx_tim.c0174461786617888TextEditor$WS_DIR$\system_and_ST_code\STM32L152_EVAL\stm32l152_eval.c030511633116330100000010000001 - iaridepm.enu1debuggergui.enu1armjlink.enu1-2-2402369-2-2200200119048203666220833411405-2-2402589-2-2200200119048203666351786411405-25874021022587-2200200119048203666258929411405-2-22431682-2-216842451002381249491119048203666241-23141682-2241168473100238174338119048203666312-25121682-231216842001002381203666119048203666 + iaridepm.enu1debuggergui.enu1armjlink.enu1-2-2600369-2-2200200119048203666220833613035-2-2600467-2-2200200119048203666279167613035-2-22431682-2-216842451002381249491119048203666241-23141682-2241168473100238174338119048203666 diff --git a/Demo/Cortex_STM32L152_IAR/settings/RTOSDemo.dni b/Demo/Cortex_STM32L152_IAR/settings/RTOSDemo.dni index 1ea4cd23a..0ff5f031d 100644 --- a/Demo/Cortex_STM32L152_IAR/settings/RTOSDemo.dni +++ b/Demo/Cortex_STM32L152_IAR/settings/RTOSDemo.dni @@ -1,5 +1,5 @@ [DebugChecksum] -Checksum=1195579230 +Checksum=-1294035724 [DisAssemblyWindow] NumStates=_ 1 State 1=_ 1 @@ -70,11 +70,6 @@ ShowTimeLog=1 ShowTimeSum=0 Title0=Power [mA] Setup0=0 1 0 500 2 0 4 1 0 -[Disassemble mode] -mode=0 -[Breakpoints] -Bp0=_ "STD_CODE" "{$PROJ_DIR$\main.c}.152.2@1" 1 0 0 0 "" 0 "" 0 -Count=1 [Log file] LoggingEnabled=_ 0 LogFile=_ "" @@ -82,9 +77,6 @@ Category=_ 0 [TermIOLog] LoggingEnabled=_ 0 LogFile=_ "" -[Aliases] -Count=0 -SuppressDialog=0 [SWOTraceWindow] PcSampling=0 InterruptLogs=0 @@ -104,3 +96,10 @@ Enabled=0 Mode=3 Graph=0 Symbiont=0 +[Disassemble mode] +mode=0 +[Breakpoints] +Count=0 +[Aliases] +Count=0 +SuppressDialog=0 diff --git a/Demo/Cortex_STM32L152_IAR/settings/RTOSDemo.wsdt b/Demo/Cortex_STM32L152_IAR/settings/RTOSDemo.wsdt index 9c9f3f8dd..e5687db78 100644 --- a/Demo/Cortex_STM32L152_IAR/settings/RTOSDemo.wsdt +++ b/Demo/Cortex_STM32L152_IAR/settings/RTOSDemo.wsdt @@ -12,12 +12,12 @@ - 348272727 + 364272727 20121632481201622 - + TabID-27630-4718 @@ -25,24 +25,24 @@ Workspace - RTOSDemoRTOSDemo/FreeRTOS_SourceRTOSDemo/Standard_Demo_CodeRTOSDemo/System_and_ST_CodeRTOSDemo/System_and_ST_Code/Eval_Board_LibraryRTOSDemo/System_and_ST_Code/Peripheral_LibraryRTOSDemo/main.c + RTOSDemoRTOSDemo/FreeRTOS_SourceRTOSDemo/Standard_Demo_CodeRTOSDemo/System_and_ST_CodeRTOSDemo/System_and_ST_Code/Eval_Board_LibraryRTOSDemo/System_and_ST_Code/Peripheral_Library - 0TabID-10002-7709BuildBuildTabID-18437-21512Debug LogDebug-Log0 + 0TabID-10002-7709BuildBuildTabID-18437-21512Debug LogDebug-Log0 - TextEditor$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\src\stm32l1xx_tim.c06131951219521TextEditor$WS_DIR$\FreeRTOSConfig.h09154925522TextEditor$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\inc\stm32l1xx_tim.h08363691536929TextEditor$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\portasm.s010745544554TextEditor$WS_DIR$\main.c0123549254934TextEditor$WS_DIR$\..\..\Source\tasks.c011513935039350TextEditor$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\port.c016871287128TextEditor$WS_DIR$\system_and_ST_code\STM32L152_EVAL\stm32l152_eval.c02851067510950TextEditor$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\src\stm32l1xx_gpio.c0198607060700100000010000001 + TextEditor$WS_DIR$\main.c013961096109TextEditor$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\port.c016871567156TextEditor$WS_DIR$\..\Common\Minimal\flash.c013158255825TextEditor$WS_DIR$\FreeRTOSConfig.h010555465576TextEditor$WS_DIR$\..\..\Source\tasks.c015895034450344TextEditor$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\portasm.s012148004800TextEditor$WS_DIR$\..\Common\Minimal\dynamic.c02251135511355TextEditor$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\inc\stm32l1xx_tim.h05832454724547TextEditor$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\src\stm32l1xx_tim.c0174461786617888TextEditor$WS_DIR$\system_and_ST_code\STM32L152_EVAL\stm32l152_eval.c030511633116330100000010000001 - iaridepm.enu1debuggergui.enu1armjlink.enu1-2-2740438-2-2200200119048203666261905755601-2-21981682-2-216842001002381203666119048203666 + iaridepm.enu1-2-2740438-2-2200200119048203666261905755601-2-21981682-2-216842001002381203666119048203666 -- 2.39.5