查看: 3588|回复: 4

[原创] FreeRTOS学习笔记(三)——FreeRTOS内核配置说明

[复制链接]

该用户从未签到

715

主题

6374

帖子

0

超级版主

Rank: 8Rank: 8

积分
25233
最后登录
2025-8-20
发表于 2016-6-22 11:03:17 | 显示全部楼层 |阅读模式
         FreeRTOS学习笔记
       FreeRTOS 是高度可配置的,所有的可配置项都在FreeRTOSConfig.h 文件中。每一个FreeRTOS Demo中都必须包含了一个配置好的FreeRTOSConfig.h文件,用户根据实际应用来裁剪定制FreeRTOS内核。这个配置文件是针对用户程序的,而非内核。
      下面列出上次已移植成功的工程中的FreeRTOSConfig.h配置文件定义(如表一所示),随后会说明里面的每一个参数定义。
表一 FreeRTOSConfig.h
  1. #ifndef FREERTOS_CONFIG_H
  2. #define FREERTOS_CONFIG_H

  3. #define configUSE_PREEMPTION 1
  4. #define configUSE_IDLE_HOOK 0
  5. #define configUSE_TICK_HOOK 0
  6. #define configCPU_CLOCK_HZ (SystemCoreClock)
  7. #define configTICK_RATE_HZ ((TickType_t)1000)
  8. #define configMAX_PRIORITIES (5)
  9. #define configMINIMAL_STACK_SIZE ((unsigned short)90)
  10. #define configTOTAL_HEAP_SIZE ((size_t)(10 * 1024))
  11. #define configMAX_TASK_NAME_LEN (10)
  12. #define configUSE_TRACE_FACILITY 1
  13. #define configUSE_16_BIT_TICKS 0
  14. #define configIDLE_SHOULD_YIELD 1
  15. #define configUSE_MUTEXES 1
  16. #define configQUEUE_REGISTRY_SIZE 8
  17. #define configCHECK_FOR_STACK_OVERFLOW 0
  18. #define configUSE_RECURSIVE_MUTEXES 1
  19. #define configUSE_MALLOC_FAILED_HOOK 0
  20. #define configUSE_APPLICATION_TASK_TAG 0
  21. #define configUSE_COUNTING_SEMAPHORES 1
  22. #define configGENERATE_RUN_TIME_STATS 0
  23. #define configUSE_TIME_SLICING 0

  24. /* Co-routine definitions. */
  25. #define configUSE_CO_ROUTINES 0
  26. #define configMAX_CO_ROUTINE_PRIORITIES (2)

  27. /* Software timer definitions. */
  28. #define configUSE_TIMERS 1
  29. #define configTIMER_TASK_PRIORITY (2)
  30. #define configTIMER_QUEUE_LENGTH 10
  31. #define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2)

  32. /* Set the following definitions to 1 to include the API function, or zero
  33. to exclude the API function. */
  34. #define INCLUDE_vTaskPrioritySet 1
  35. #define INCLUDE_uxTaskPriorityGet 1
  36. #define INCLUDE_vTaskDelete 1
  37. #define INCLUDE_vTaskCleanUpResources 1
  38. #define INCLUDE_vTaskSuspend 1
  39. #define INCLUDE_vTaskDelayUntil 1
  40. #define INCLUDE_vTaskDelay 1

  41. /* Cortex-M specific definitions. */
  42. #ifdef __NVIC_PRIO_BITS
  43. /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
  44. #define configPRIO_BITS __NVIC_PRIO_BITS
  45. #else
  46. #define configPRIO_BITS 4 /* 15 priority levels */
  47. #endif

  48. /* The lowest interrupt priority that can be used in a call to a "set priority"
  49. function. */
  50. #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf

  51. /* The highest interrupt priority that can be used by any interrupt service
  52. routine that makes calls to interrupt safe FreeRTOS API functions.  DO NOT CALL
  53. INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
  54. PRIORITY THAN THIS! (higher priorities are lower numeric values. */
  55. #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5

  56. /* Interrupt priorities used by the kernel port layer itself.  These are generic
  57. to all Cortex-M ports, and do not rely on any particular library functions. */
  58. #define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))
  59. /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
  60. See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
  61. #define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS))

  62. /* Normal assert() semantics without relying on the provision of an assert.h
  63. header file. */
  64. #define configASSERT(x)           \
  65.     if ((x) == 0)                 \
  66.     {                             \
  67.         taskDISABLE_INTERRUPTS(); \
  68.         for (;;)                  \
  69.             ;                     \
  70.     }

  71. /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
  72. standard names. */
  73. #define vPortSVCHandler SVC_Handler
  74. #define xPortPendSVHandler PendSV_Handler
  75. #define xPortSysTickHandler SysTick_Handler

  76. #endif /* FREERTOS_CONFIG_H */
复制代码
FreeRTOS学习笔记(三)——FreeRTOS内核配置说明.pdf (389.19 KB, 下载次数: 149)
回复

使用道具 举报

  • TA的每日心情
    奋斗
    2017-2-13 08:29
  • 签到天数: 20 天

    连续签到: 1 天

    [LV.4]偶尔看看III

    531

    主题

    2048

    帖子

    0

    中级会员

    Rank: 3Rank: 3

    积分
    210
    最后登录
    2018-8-14
    发表于 2016-6-22 11:04:48 | 显示全部楼层
    感谢分享,辛苦了
    签到 签到
    回复 支持 反对

    使用道具 举报

  • TA的每日心情

    2017-1-4 08:05
  • 签到天数: 11 天

    连续签到: 1 天

    [LV.3]偶尔看看II

    85

    主题

    1629

    帖子

    1

    版主

    Rank: 7Rank: 7Rank: 7

    积分
    2569

    优秀版主

    最后登录
    2019-3-28
    发表于 2016-6-22 11:09:45 | 显示全部楼层
    正在研究FreeRTOS,小恩GG辛苦了
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    10

    主题

    46

    帖子

    0

    注册会员

    Rank: 2

    积分
    108
    最后登录
    2018-5-24
    发表于 2016-6-22 14:05:56 | 显示全部楼层
    感谢分享 正好在看这方面的资料
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    6

    主题

    32

    帖子

    0

    注册会员

    Rank: 2

    积分
    76
    最后登录
    2018-7-16
    发表于 2016-6-22 14:06:13 | 显示全部楼层
    小恩GG 最可爱
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /3 下一条

    Archiver|手机版|小黑屋|恩智浦技术社区

    GMT+8, 2025-8-21 11:37 , Processed in 0.084153 second(s), 23 queries , MemCache On.

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.

    快速回复 返回顶部 返回列表