用ctrl f搜索xsemaphorecreatemutex
搜到(semphr.h)
if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_MUTEXES == 1 ) )
#define xSemaphoreCreateMutex() xQueueCreateMutex( queueQUEUE_TYPE_MUTEX )
#endif
这里需要两个1
在(FreeRTOS.h)置1就可以了
#ifndef configSUPPORT_DYNAMIC_ALLOCATION
/* Defaults to 1 for backward compatibility. */
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#endif
#ifndef configUSE_MUTEXES
#define configUSE_MUTEXES 1
#endif
文章介绍了如何在FreeRTOS中启用动态内存分配和使用互斥锁功能,通过在`FreeRTOS.h`中设置`configSUPPORT_DYNAMIC_ALLOCATION`和`configUSE_MUTEXES`为1来实现。默认情况下,这些配置为1以保持向后兼容。

被折叠的 条评论
为什么被折叠?



