aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-04-26 09:24:44 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-04-26 09:24:44 +0000
commit65f19c1d66f34a9ca070a5d24ab4c29474f0237a (patch)
tree3fc13e2b4ef437f865dcc6a1d51c787b97eb3516 /testhal/STM32
parentae90e9c47b2c0cbd54cf0a07db42228f8237513e (diff)
downloadChibiOS-65f19c1d66f34a9ca070a5d24ab4c29474f0237a.tar.gz
ChibiOS-65f19c1d66f34a9ca070a5d24ab4c29474f0237a.tar.bz2
ChibiOS-65f19c1d66f34a9ca070a5d24ab4c29474f0237a.zip
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
Diffstat (limited to 'testhal/STM32')
-rw-r--r--testhal/STM32/STM32F4xx/IRQ_STORM_FPU/Makefile2
-rw-r--r--testhal/STM32/STM32F4xx/IRQ_STORM_FPU/main.c26
2 files changed, 27 insertions, 1 deletions
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. */
@@ -212,6 +227,17 @@ int main(void) {
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.
*/
chThdCreateStatic(waWorkerThread, sizeof waWorkerThread,