CubeMx 配置FreeRTOS是存在报错,osSemaphoreCreate, osSemaphoreWait未定义

原因:由于freertos和Hal库版本不兼容问题导致的,使用CubeMa生成的函数会生成老版本的,所以需要改掉

int ff_cre_syncobj (	/* 1:Function succeeded, 0:Could not create the sync object */
	BYTE vol,			/* Corresponding volume (logical drive number) */
	_SYNC_t *sobj		/* Pointer to return the created sync object */
)
{

    int ret;

    osSemaphoreDef(SEM);
    /*
		zyh HAL生成时新旧不兼容问题
		*sobj = osSemaphoreCreate(osSemaphore(SEM), 1);

      */
	//修改后
    *sobj = osSemaphoreNew(1,1,osSemaphore(SEM));
    ret = (*sobj != NULL);

    return ret;
}

int ff_req_grant (	/* 1:Got a grant to access the volume, 0:Could not get a grant */
	_SYNC_t sobj	/* Sync object to wait */
)
{
  int ret = 0;

	/*
		//zyh HAL生成时新旧不兼容问题
		if(osSemaphoreWait(sobj, _FS_TIMEOUT) == osOK)
    */

  //修改后
  if(osSemaphoreAcquire(sobj, _FS_TIMEOUT) == osOK)
  {
    ret = 1;
  }

  return ret;
}

修改后编译通过

问题解决 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值