• 【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("33[1;32;40m");                                       //ÉèÖÃÖÕ¶Ë×ÖÌåΪÂÌÉ«    
        usart6.printf("Hello, I am iCore4!
    
    ");
        usart6.printf("DSP BasicMath TEST......
    ");    
      /* 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
    ",time[0] / 10, time[1] / 10);
                LED_GREEN_ON;
                LED_RED_OFF;
                LED_BLUE_OFF;
            }
            else{
                usart6.printf("Error
    ");            
                LED_GREEN_OFF;
                LED_RED_ON;
                LED_BLUE_OFF;
            }
      }
      /* USER CODE END 3 */
    
    }

    源代码下载链接:

    链接:http://pan.baidu.com/s/1cq9WSI 密码:hyc2

    iCore4链接:

  • 相关阅读:
    Educational Codeforces Round 97 (Rated for Div. 2)
    2020 计蒜之道 线上决赛
    kuangbin 莫队专题
    Codeforces Round #677 (Div. 3)
    Codeforces Round #674 (Div. 3)
    Elasticsearch Alias:别名
    Elasticsearch 集群重要配置的修改
    Elasticsearch文档版本冲突原理与解决
    redis操作详情
    对密码必须包含字母,数字,特殊字符正则表达式理解
  • 原文地址:https://www.cnblogs.com/xiaomagee/p/7614126.html
Copyright © 2020-2023  润新知