# FreeRTOS **Repository Path**: SeeDeer/FreeRTOS ## Basic Information - **Project Name**: FreeRTOS - **Description**: No description available - **Primary Language**: C - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-06-20 - **Last Updated**: 2024-12-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 如何用好FreeRTOS这把利剑 ### Q&A 1. 开启时间片调度后,相同优先级的任务没有主动挂起或者堵塞态,systick中断来时,也会被打断切换到其他相同优先级任务吗?
会 ! Time slicing is used to share processing time between tasks of equal priority, even when the tasks do not explicitly yield or enter the Blocked state. ### 优先级 1. 任务优先级数值越高,优先级别越高; 2. 外部中断优先级 高于 所有任务优先级 3. 时间片调度使能后,同 http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html https://www.freertos.org/Documentation/RTOS_book.html ### 内核级异常的使用 1. SVC(系统服务调用,亦简称系统调用)和 PendSV(可悬起系统调用),它们多用于在 操作系统之上的软件开发中。 SVC 用于产生系统函数的调用请求。例如,操作系统不让用户 程序直接访问硬件,而是通过提供一些系统服务函数,用户程序使用 SVC 发出对系统服务函 数的呼叫请求,以这种方法调用它们来间接访问硬件。因此,当用户程序想要控制特定的硬 件时,它就会产生一个 SVC 异常,然后操作系统提供的 SVC 异常服务例程得到执行,它再 调用相关的操作系统函数,后者完成用户程序请求的服务。 2. ### 源码目录及移植说明 ```shell FreeRTOSv10.2.1 ├── FreeRTOS # 源码目录 ├── FreeRTOS-Plus # 附加的一些组件,如tcp/ip协议栈等 ├── FreeRTOS+TCP.url ├── New - Stream and Message Buffers.url ├── Quick_Start_Guide.url ├── readme.txt ├── Upgrading-to-FreeRTOS-10.url └── Upgrading-to-FreeRTOS-9.url FreeRTOSv10.2.1/FreeRTOS ├── Demo # 不同芯片平台和编译器的Demo工程 ├── License # MIT open source license ├── links_to_doc_pages_for_the_demo_projects.url ├── readme.txt └── Source # 源码文件目录 FreeRTOSv10.2.1/FreeRTOS/Source/ ├── croutine.c # 合作式调度方式时包含 ├── event_groups.c # 事件管理,必须包含 ├── include # API头文件 ├── list.c # 必选 ├── portable # 必选,任务调度底层实现,涉及汇编指令,和芯片架构、编译器相关 ├── queue.c # 必选,队列、信号量 ├── readme.txt ├── stream_buffer.c # 可选,10.0版本新增功能 ├── tasks.c # 必选,任务管理 └── timers.c # 必选,定时器相关 ``` ### 内存管理 https://www.freertos.org/a00111.html ```shell FreeRTOSv10.2.1/FreeRTOS/Source/portable/MemMang/ ├── heap_1.c ├── heap_2.c ├── heap_3.c ├── heap_4.c ├── heap_5.c └── ReadMe.url ``` ### 任务调度 https://www.freertos.org/taskandcr.html ### Co-routines 协作线程: ### 宏配置说明 #### configUSE_TIME_SLICING By default (if configUSE_TIME_SLICING is not defined, or if configUSE_TIME_SLICING is defined as 1) FreeRTOS uses prioritised preemptive scheduling with time slicing. That means the RTOS scheduler will always run the highest priority task that is in the Ready state, and will switch between tasks of equal priority on every RTOS tick interrupt. If configUSE_TIME_SLICING is set to 0 then the RTOS scheduler will still run the highest priority task that is in the Ready state, but will not switch between tasks of equal priority just because a tick interrupt has occurred. 时间片调度是否使能,默认是使能的。 1: tick中断出现,任务调度器就会切换到想到 Time slicing is used to share processing time between tasks of equal priority, even when the tasks do not explicitly yield or enter the Blocked state. ### 开源协议