Why cubeMX generates warning when timebase of SYS is set to systick and freertos is chosen

A warning prompted by cubemx when generating code with freertos chosen with timebase as systick. While this message is pretty confusing because the warning message is actually saying that the timebase of HAL driver shall NOT use systick anymore. Systick will be used for freertos. Not the freertos timebase will use the TIMx whichever specified. 

Read the generated code you will find:

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
  /* USER CODE BEGIN Callback 0 */

  /* USER CODE END Callback 0 */
  if (htim->Instance == TIM1) {
    HAL_IncTick();
  }
  /* USER CODE BEGIN Callback 1 */

  /* USER CODE END Callback 1 */
}

Note that HAL_IncTick() is called by TIMx interrupt callback. Not the SysTick_Handler anymore.  

The reason for doing this is that HAL driver needs to call HAL_GetTicks to caculate timeout. If both uses the SysTick interrupt will definitely infulence OS efficiency. 

uCOS-III does not have this issue, because

a, uCOS-III has a tick task that will do ticking. 

b, the bsp porting replaced the HAL_GetTick function

uint32_t  HAL_GetTick (void)
{
    CPU_INT32U  os_tick_ctr;
#if (OS_VERSION >= 30000u)
    OS_ERR      os_err;
#endif

#if (OS_VERSION >= 30000u)
    os_tick_ctr = OSTimeGet(&os_err);
#else
    os_tick_ctr = OSTimeGet();
#endif

    return os_tick_ctr;
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
MapReduce is a programming model and software framework for processing large sets of data in a distributed and parallel manner. It allows for processing of large data sets on clusters of computers using a simple model for parallel processing. In the MapReduce framework, the input data is divided into chunks and each chunk is processed by a separate mapper function. The mapper function processes the input data and generates intermediate key-value pairs. These key-value pairs are then sorted and grouped by key, and passed on to the reducer function. The reducer function then aggregates the intermediate key-value pairs and generates a final output. For example, let's say we have a large data set of customer orders that we want to process using MapReduce. The mapper function will read each order and generate intermediate key-value pairs where the key is the customer ID and the value is the order amount. The intermediate key-value pairs might look like this: ``` customer1: 10.99 customer2: 25.55 customer1: 5.99 customer3: 15.00 customer2: 12.50 ``` These intermediate key-value pairs are then sorted and grouped by key: ``` customer1: [10.99, 5.99] customer2: [25.55, 12.50] customer3: [15.00] ``` The reducer function then aggregates the values for each key and generates a final output: ``` customer1: 16.98 customer2: 38.05 customer3: 15.00 ``` In this example, the MapReduce framework allowed us to process a large data set in a distributed and parallel manner, making it faster and more efficient.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值