use*_*807 0 gcc stm32 freertos
我尝试在 stm32f303 discovery 上运行 freertos。我包括从官方网站下载的 freertos 存档中的所有头文件和源文件。我还包括文件夹中的便携式文件/GCC/ARM_CM4F。我使用 codesourcery lite 编译器。当我尝试编译项目时出现错误:
In file included from freertos/inc/portable.h:321:0,
from freertos/inc/FreeRTOS.h:100,
from freertos/src/croutine.c:66:
freertos/inc/portmacro.h:167:7: error: missing binary operator before token "long"
Run Code Online (Sandbox Code Playgroud)
portmacro.h的 167-172 字符串:
#if( configMAX_PRIORITIES > 32 )
#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice.
#endif
Run Code Online (Sandbox Code Playgroud)
在谷歌中搜索发现存在预处理器错误,但它并没有让我指出我应该做什么。我的 Makefile 设置:
# Set Libraries
LIBS = -lm -lc
###################################################
# Set Board
MCU = -mthumb -mcpu=cortex-m4
FPU = -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
DEFINES = -DSTM32F3XX -DUSE_STDPERIPH_DRIVER
DEFINES += -DUSE_DEFAULT_TIMEOUT_CALLBACK
# Set Compilation and Linking Flags
CFLAGS = $(MCU) $(FPU) $(DEFINES) $(INCLUDES) \
-g -Wall -std=gnu90 -O0 -ffunction-sections -fdata-sections
ASFLAGS = $(MCU) $(FPU) -g -Wa,--warn -x assembler-with-cpp
LDFLAGS = $(MCU) $(FPU) -g -gdwarf-2\
-Tstm32f30_flash.ld \
-Xlinker --gc-sections -Wl,-Map=$(PROJ_NAME).map \
$(LIBS) \
-o $(PROJ_NAME).elf
Run Code Online (Sandbox Code Playgroud)
我哪里弄错了?
小智 5
编译器告诉您 C 预处理器不理解 configMAX_PRIORITIES 的定义。查看 FreeRTOSConfig.h 中的定义,我怀疑它包含预处理器无法理解的强制转换。去掉石膏,可能就没事了。