0

我正在使用 STMCubeMX 中提供的 cmsis_os.c 和 cmsis_os.h。我发现至少有两个地方是 cmsis_os.c 应该修复的。

第一个:

#elif( configSUPPORT_STATIC_ALLOCATION == 1 )
  return xTimerCreateStatic((const char *)"",
                      1, // period should be filled when starting the Timer using osTimerStart
                      (type == osTimerPeriodic) ? pdTRUE : pdFALSE,
                      (void *) argument,
                      (TaskFunction_t)timer_def->ptimer,
                      (StaticTimer_t *)timer_def->controlblock);  
#else
  return xTimerCreate((const char *)"",
                      1, // period should be filled when starting the Timer using osTimerStart
                      (type == osTimerPeriodic) ? pdTRUE : pdFALSE,
                      (void *) argument,
                      (TaskFunction_t)timer_def->ptimer);
#endif

TaskFunction_t 是否应该替换为 TimerCallbackFunction_t?

第二个:

osEvent osSignalWait (int32_t signals, uint32_t millisec)
{
  osEvent ret;

#if( configUSE_TASK_NOTIFICATIONS == 1 )

  TickType_t ticks;

  ret.value.signals = 0;  
  ticks = 0;
  if (millisec == osWaitForever) {
    ticks = portMAX_DELAY;
  }

我认为它必须是:

osEvent osSignalWait (int32_t signals, uint32_t millisec)
{
  osEvent ret;

#if( configUSE_TASK_NOTIFICATIONS == 1 )

  TickType_t ticks;

  if (signals == 0)
    signals = ~0x80000000;

  ret.value.signals = 0;  
  ticks = 0;
  if (millisec == osWaitForever) {
    ticks = portMAX_DELAY;
  }

你怎么看?

有没有办法让 STMCubeMX 生成修补文件而不是原始文件?

谢谢,阿尔贝托

4

0 回答 0