ERROR Undefined symbol vApplicationGetTimerTaskMemory解决方案


前言

当出现ERROR Undefined symbol vApplicationGetTimerTaskMemory的时候是因为开启了static内存,网上其他的方案就是把静态的关闭,也就是
#define configSUPPORT_STATIC_ALLOCATION 0 //关闭静态内存申。但是这样不就不能用静态了啊????

如何不关闭static解决这个问题?

看freertos官方网站就能找到官网
你需要往下方找找就能看到解决方案,如果你不想 找,你就直接把我下面这段代码复制到你的工程里面就可以了。

/* configSUPPORT_STATIC_ALLOCATION is set to 1, so the application must provide an  
   implementation of vApplicationGetIdleTaskMemory() to provide the memory that is  
   used by the Idle task. */  
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer,  
                                    StackType_t **ppxIdleTaskStackBuffer,  
                                    uint32_t *pulIdleTaskStackSize )  
{  
    /* If the buffers to be provided to the Idle task are declared inside this  
       function then they must be declared static - otherwise they will be allocated on  
       the stack and so not exists after this function exits. */  
    static StaticTask_t xIdleTaskTCB;  
    static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];  

    /* Pass out a pointer to the StaticTask_t structure in which the Idle task's  
       state will be stored. */  
    *ppxIdleTaskTCBBuffer = &xIdleTaskTCB;  

    /* Pass out the array that will be used as the Idle task's stack. */  
    *ppxIdleTaskStackBuffer = uxIdleTaskStack;  

    /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.  
       Note that, as the array is necessarily of type StackType_t,  
       configMINIMAL_STACK_SIZE is specified in words, not bytes. */  
    *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;  
}  

/*-----------------------------------------------------------*/  

/* configSUPPORT_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the  
   application must provide an implementation of vApplicationGetTimerTaskMemory()  
   to provide the memory that is used by the Timer service task. */  
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer,  
                                     StackType_t **ppxTimerTaskStackBuffer,  
                                     uint32_t *pulTimerTaskStackSize )  
{  
    /* If the buffers to be provided to the Timer task are declared inside this  
       function then they must be declared static - otherwise they will be allocated on  
       the stack and so not exists after this function exits. */  
    static StaticTask_t xTimerTaskTCB;  
    static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];  

    /* Pass out a pointer to the StaticTask_t structure in which the Timer  
       task's state will be stored. */  
    *ppxTimerTaskTCBBuffer = &xTimerTaskTCB;  

    /* Pass out the array that will be used as the Timer task's stack. */  
    *ppxTimerTaskStackBuffer = uxTimerTaskStack;  

    /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.  
       Note that, as the array is necessarily of type StackType_t,  
      configTIMER_TASK_STACK_DEPTH is specified in words, not bytes. */  
    *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;  
}  

官网其实啥都想了,就是看你能不能找到了。
我一开始也没看到,但是在这个stm32duino网站里面无意发现了。


  • 7
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值