[FreeRTOS笔记1] STM32CubeMX FreeRtos错误

STM32CubeMX FreeRtos错误

在检查错误前一定要有FreeRTOSConfig.h文件

错误1

HAL库用AC6编译器

../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(208): error: expected '(' after 'asm'
__asm void vPortSVCHandler( void )
      ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(208): error: expected ';' after top-level asm block
__asm void vPortSVCHandler( void )
     ^
     ;
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(210): error: use of undeclared identifier 'PRESERVE8'
        PRESERVE8
        ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(225): error: expected '(' after 'asm'
__asm void prvStartFirstTask( void )
      ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(225): error: expected ';' after top-level asm block
__asm void prvStartFirstTask( void )
     ^
     ;
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(227): error: use of undeclared identifier 'PRESERVE8'
        PRESERVE8
        ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(374): error: expected '(' after 'asm'
__asm void xPortPendSVHandler( void )
      ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(374): error: expected ';' after top-level asm block
__asm void xPortPendSVHandler( void )
     ^
     ;
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(376): warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
        extern uxCriticalNesting;
        ~~~~~~ ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(376): error: redeclaration of 'uxCriticalNesting' with a different type: 'int' vs 'UBaseType_t' (aka 'unsigned long')
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(134): note: previous definition is here
static UBaseType_t uxCriticalNesting = 0xaaaaaaaa;
                   ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(377): warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
        extern pxCurrentTCB;
        ~~~~~~ ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(378): warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
        extern vTaskSwitchContext;
        ~~~~~~ ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(378): error: redefinition of 'vTaskSwitchContext' as different kind of symbol
../Middlewares/Third_Party/FreeRTOS/Source/include\task.h(2224): note: previous definition is here
void vTaskSwitchContext( void ) PRIVILEGED_FUNCTION;
     ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(380): error: use of undeclared identifier 'PRESERVE8'
        PRESERVE8
        ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(428): warning: implicit declaration of function 'vPortClearBASEPRIFromISR' is invalid in C99 [-Wimplicit-function-declaration]
        vPortClearBASEPRIFromISR();
        ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(629): error: expected '(' after 'asm'
__asm uint32_t vPortGetIPSR( void )
      ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(629): error: expected ';' after top-level asm block
__asm uint32_t vPortGetIPSR( void )
     ^
     ;
../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c(631): error: use of undeclared identifier 'PRESERVE8'
        PRESERVE8
        ^
4 warnings and 14 errors generated.
compiling port.c...
compiling cmsis_os.c...
"stm32CubeMx_freeRtos.axf" - 14 Error(s), 4 Warning(s).
        ~~~~~~

解决:在MDK目录里找到GCC\ARM_CM3替换掉RVDS\ARM_CM3

[FreeRTOS笔记1] STM32CubeMX FreeRtos错误_第1张图片

加路径:

…\Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM3

换掉

…\Middlewares\Third_Party\FreeRTOS\Source\portable\RVDS\ARM_CM3

[FreeRTOS笔记1] STM32CubeMX FreeRtos错误_第2张图片

编译

[FreeRTOS笔记1] STM32CubeMX FreeRtos错误_第3张图片

错误2

stm32CubeMx_freeRtos\stm32CubeMx_freeRtos.axf: Error: L6837E: Illegal data mapping symbol found in execute-only section port.o(.text.PendSV_Handler) at offset 0x40.
stm32CubeMx_freeRtos\stm32CubeMx_freeRtos.axf: Error: L6837E: Illegal data mapping symbol found in execute-only section port.o(.text.SVC_Handler) at offset 0x20.
stm32CubeMx_freeRtos\stm32CubeMx_freeRtos.axf: Error: L6837E: Illegal data mapping symbol found in execute-only section port.o(.text.prvPortStartFirstTask) at offset 0x1c.

解决:

去掉 mexecute -only

[FreeRTOS笔记1] STM32CubeMX FreeRtos错误_第4张图片

你可能感兴趣的:(单片机C语言,FreeRTOS,stm32,单片机,freertos)