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
This commit is contained in:
Giovanni Di Sirio 2015-04-26 09:24:44 +00:00
parent ae90e9c47b
commit 65f19c1d66
2 changed files with 27 additions and 1 deletions

View File

@ -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).

View File

@ -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.
*/