From 65f19c1d66f34a9ca070a5d24ab4c29474f0237a Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 26 Apr 2015 09:24:44 +0000 Subject: Added a fast interrupt to the STM32F4xx FPU stress test. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7927 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/STM32F4xx/IRQ_STORM_FPU/Makefile | 2 +- testhal/STM32/STM32F4xx/IRQ_STORM_FPU/main.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'testhal/STM32') diff --git a/testhal/STM32/STM32F4xx/IRQ_STORM_FPU/Makefile b/testhal/STM32/STM32F4xx/IRQ_STORM_FPU/Makefile index 94c488700..4198e3c85 100644 --- a/testhal/STM32/STM32F4xx/IRQ_STORM_FPU/Makefile +++ b/testhal/STM32/STM32F4xx/IRQ_STORM_FPU/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). diff --git a/testhal/STM32/STM32F4xx/IRQ_STORM_FPU/main.c b/testhal/STM32/STM32F4xx/IRQ_STORM_FPU/main.c index 694653dda..37e379334 100644 --- a/testhal/STM32/STM32F4xx/IRQ_STORM_FPU/main.c +++ b/testhal/STM32/STM32F4xx/IRQ_STORM_FPU/main.c @@ -142,6 +142,21 @@ static const GPTConfig gpt3cfg = { 0 }; +CH_FAST_IRQ_HANDLER(STM32_TIM1_UP_HANDLER) { + float f1, f2, f3, f4, f5; + + TIM1->SR = 0; + + f1 = ff1(3.0f); + f2 = ff1(4.0f); + f3 = ff1(5.0f); + f5 = f1 + f2 + f3; + f4 = ff1(4.0f); + f5 = ff2(f5, f4, f5, f4); + if (f5 != 256.0f) { + chSysHalt("float corrupion #5"); + } +} /*===========================================================================*/ /* Generic demo code. */ @@ -211,6 +226,17 @@ int main(void) { gptStart(&GPTD4, &gpt4cfg); gptStart(&GPTD3, &gpt3cfg); + /* + * Enabling TIM1 as a fast interrupts source. + */ + rccEnableTIM1(false); + nvicEnableVector(STM32_TIM1_UP_NUMBER, 0); + TIM1->ARR = 10000; + TIM1->PSC = 0; + TIM1->CNT = 0; + TIM1->DIER = TIM_DIER_UIE; + TIM1->CR1 = TIM_CR1_CEN; + /* * Initializes the worker threads. */ -- cgit v1.2.3