jweisd 发表于 2021-11-25 21:25:28

调用arm_sin_f32()函数编译出错

在igpio_led_output.uvprojx工程里面的main函数最后增加了一段代码生成一个正弦波数组,并且在开头加了math.h 和 arm_math.h这两个头文件:

#include "board.h"
#include "fsl_debug_console.h"
#include "fsl_gpio.h"
#include "stdio.h"
#include <math.h>
#include "arm_math.h"

#include "pin_mux.h"
#include "clock_config.h"




    while (1)
    {
      delay();
                delay();
                delay();
                delay();
#if (defined(FSL_FEATURE_IGPIO_HAS_DR_TOGGLE) && (FSL_FEATURE_IGPIO_HAS_DR_TOGGLE == 1))
      GPIO_PortToggle(EXAMPLE_LED_GPIO, 1u << EXAMPLE_LED_GPIO_PIN);
#else
      if (g_pinSet)
      {
            GPIO_PinWrite(EXAMPLE_LED_GPIO, EXAMPLE_LED_GPIO_PIN, 0U);
            g_pinSet = false;
      }
      else
      {
            GPIO_PinWrite(EXAMPLE_LED_GPIO, EXAMPLE_LED_GPIO_PIN, 1U);
            g_pinSet = true;
      }
#endif /* FSL_FEATURE_IGPIO_HAS_DR_TOGGLE */
               
                for(i=0; i< block_size; i++){
//                xTimeWave = testdatas;   
                xTimeWave = arm_sin_f32(2*PI*ff*i);
                printf("%d,%8.6f,\r\n",i,xTimeWave);
//                sprintf(printstr, "%04d=%8.6f\r\n", i, xTimeWave);
//                PRINTF(printstr);
                }
    }

编译出错信息:
compiling arm_sin_f32.c...
../../../../../../CMSIS/Include/core_cm.h(81): error: #35: #error directive: "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
      #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
..\..\..\..\..\..\CMSIS\DSP_Lib\Source\FastMathFunctions\arm_sin_f32.c: 0 warnings, 1 error

请问问题在哪里?
谢谢!


ljb2019001 发表于 2021-11-29 10:03:58

没有遇到具体的错误,但是根据报错感觉是core_cm.h没有找到,添加上include试试;另外根据报错,到网上查查有没有类似的错误,我找到一个类似的可以试试https://blog.csdn.net/llljjlj/article/details/88338243
页: [1]
查看完整版本: 调用arm_sin_f32()函数编译出错