【iCore4 双核心板_ARM】例程三十八:DSP MATH库测试
实验现象:
核心代码:
int main(void) { /* USER CODE BEGIN 1 */ int i,j; int res; float time[2]; static int error_flag = 0; /* USER CODE END 1 */ /* MCU Configuration----------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* USER CODE BEGIN SysInit */ /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_USART6_UART_Init(); MX_TIM3_Init(); /* USER CODE BEGIN 2 */ usart6.initialize(115200); usart6.printf("\x0c"); //ÇåÆÁ usart6.printf("\033[1;32;40m"); //ÉèÖÃÖÕ¶Ë×ÖÌåΪÂÌÉ« usart6.printf("Hello, I am iCore4!\r\n\r\n"); usart6.printf("DSP BasicMath TEST......\r\n"); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ timeout = 0; __HAL_TIM_SET_COUNTER(&htim3,0); for(j = 0;j < 10000;j++){ for(i = 0;i < MAX_BLOCKSIZE;i ++){ res = SinCos_Test(testInput_f32[i],0); if(res != 0)error_flag ++; } } time[0] = __HAL_TIM_GET_COUNTER(&htim3)+ timeout*5000; timeout = 0; __HAL_TIM_SET_COUNTER(&htim3,0); for(j = 0;j < 10000;j++){ for(i = 0;i < MAX_BLOCKSIZE;i ++){ res = SinCos_Test(testInput_f32[i],1); if(res != 0)error_flag ++; } } time[1] = __HAL_TIM_GET_COUNTER(&htim3)+ timeout*5000; if(error_flag == 0){ usart6.printf("*NO DSP MATHLIB runtime:%0.1fms *USE DSP MATHLIB runtime:%0.1fms\r",time[0] / 10, time[1] / 10); LED_GREEN_ON; LED_RED_OFF; LED_BLUE_OFF; } else{ usart6.printf("Error\r"); LED_GREEN_OFF; LED_RED_ON; LED_BLUE_OFF; } } /* USER CODE END 3 */ }
源代码下载链接:
链接:http://pan.baidu.com/s/1cq9WSI 密码:hyc2
iCore4链接: