{"id":72254,"date":"2026-02-05T08:33:34","date_gmt":"2026-02-05T00:33:34","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/72254.html"},"modified":"2026-02-05T08:33:34","modified_gmt":"2026-02-05T00:33:34","slug":"freertos%e4%bb%bb%e5%8a%a1%e5%88%9b%e5%bb%ba","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/72254.html","title":{"rendered":"FreeRTOS\u4efb\u52a1\u521b\u5efa"},"content":{"rendered":"<h2><span style=\"color:#fe2c24\">1 \u4efb\u52a1\u521b\u5efa\u4e0e\u5220\u9664\u7684\u57fa\u672c\u6982\u5ff5<\/span><\/h2>\n<p>\u4efb\u52a1\u521b\u5efa&#xff1a;\u5728FreeRTOS\u4e2d\u521b\u5efa\u4efb\u52a1&#xff0c;\u672c\u8d28\u4e0a\u662f\u8c03\u7528\u76f8\u5e94\u7684API\u51fd\u6570&#xff0c;\u5206\u914d\u4efb\u52a1\u63a7\u5236\u5757&#xff08;TCB&#xff09;\u548c\u4efb\u52a1\u6808\u7a7a\u95f4\u3002<br \/>\n\u4efb\u52a1\u5220\u9664&#xff1a;\u79fb\u9664\u4efb\u52a1\u4ece\u5c31\u7eea\u3001\u963b\u585e\u3001\u6302\u8d77\u548c\u4e8b\u4ef6\u5217\u8868\u4e2d&#xff0c;\u91ca\u653e\u76f8\u5173\u5185\u5b58&#xff08;\u52a8\u6001\u521b\u5efa\u65f6\u7531\u7a7a\u95f2\u4efb\u52a1\u5904\u7406&#xff09;\u3002<\/p>\n<h2><span style=\"color:#fe2c24\">2 \u4efb\u52a1\u521b\u5efa\u4e0e\u5220\u9664\u7684API\u51fd\u6570<\/span><\/h2>\n<p>xTaskCreate()&#xff1a;\u52a8\u6001\u521b\u5efa\u4efb\u52a1&#xff0c;\u5185\u5b58\u7531FreeRTOS\u5806\u5206\u914d\u3002<br \/>\nxTaskCreateStatic()&#xff1a;\u9759\u6001\u521b\u5efa\u4efb\u52a1&#xff0c;\u5185\u5b58\u7531\u7528\u6237\u5206\u914d\u3002<br \/>\nvTaskDelete()&#xff1a;\u5220\u9664\u4efb\u52a1&#xff0c;\u52a8\u6001\u6216\u9759\u6001\u521b\u5efa\u7684\u4efb\u52a1\u5747\u53ef\u5220\u9664\u3002<\/p>\n<h2><span style=\"color:#fe2c24\">3. \u52a8\u6001\u521b\u5efa\u4efb\u52a1\u6d41\u7a0b&#xff08;xTaskCreate&#xff09;<\/span><\/h2>\n<h3><span style=\"color:#fe2c24\">3.1 \u4f7f\u7528\u6b65\u9aa4<\/span><\/h3>\n<p>1. \u5c06configSUPPORT_DYNAMIC_ALLOCATION\u8bbe\u4e3a1\u3002<br \/>\n2. \u5b9a\u4e49\u4efb\u52a1\u51fd\u6570&#xff08;\u5165\u53e3\u53c2\u6570&#xff09;\u3002<br \/>\n3. \u8c03\u7528xTaskCreate()\u3002<\/p>\n<h3><span style=\"color:#fe2c24\">3.2 \u5185\u90e8\u5b9e\u73b0<\/span><\/h3>\n<p>1. \u7533\u8bf7\u5806\u6808\u548cTCB\u5185\u5b58\u3002<br \/>\n2. \u521d\u59cb\u5316TCB\u6210\u5458&#xff08;\u4f18\u5148\u7ea7\u3001\u540d\u79f0\u3001\u6808\u9876\u7b49&#xff09;\u3002<br \/>\n3. \u521d\u59cb\u5316\u4efb\u52a1\u6808&#xff08;\u586b\u51450xA5&#xff0c;\u8bbe\u7f6e\u4e0a\u4e0b\u6587&#xff09;\u3002<br \/>\n4. \u5c06\u4efb\u52a1\u6dfb\u52a0\u5230\u5c31\u7eea\u5217\u8868\u3002<br \/>\n5. \u66f4\u65b0\u5c31\u7eea\u4f18\u5148\u7ea7\u4f4d\u56fe\u3002<br \/>\n6. \u5982\u679c\u8c03\u5ea6\u5668\u5df2\u8fd0\u884c\u4e14\u65b0\u4efb\u52a1\u4f18\u5148\u7ea7\u66f4\u9ad8&#xff0c;\u89e6\u53d1\u4efb\u52a1\u5207\u6362\u3002<\/p>\n<h2><span style=\"color:#fe2c24\">4 \u9759\u6001\u521b\u5efa\u4efb\u52a1\u6d41\u7a0b&#xff08;xTaskCreateStatic&#xff09;<\/span><\/h2>\n<h3><span style=\"color:#fe2c24\">4.1 \u4f7f\u7528\u6b65\u9aa4<\/span><\/h3>\n<p>1. \u5c06configSUPPORT_STATIC_ALLOCATION\u8bbe\u4e3a1\u3002<br \/>\n2. \u7528\u6237\u63d0\u4f9b\u6808\u6570\u7ec4\u548cTCB\u7ed3\u6784\u4f53\u3002<br \/>\n3. \u5b9a\u4e49\u4efb\u52a1\u51fd\u6570\u3002<br \/>\n4. \u8c03\u7528xTaskCreateStatic()\u3002<\/p>\n<h3><span style=\"color:#fe2c24\">4.2 \u5185\u90e8\u5b9e\u73b0<\/span><\/h3>\n<p>1. \u7528\u6237\u4f20\u5165\u6808\u548cTCB\u6307\u9488\u3002<br \/>\n2. \u521d\u59cb\u5316TCB&#xff08;\u7c7b\u4f3c\u52a8\u6001\u65b9\u5f0f&#xff09;\u3002<br \/>\n3. \u6dfb\u52a0\u5230\u5c31\u7eea\u5217\u8868\u3002<\/p>\n<h2><span style=\"color:#fe2c24\">5 \u4efb\u52a1\u5220\u9664\u6d41\u7a0b&#xff08;vTaskDelete&#xff09;<\/span><\/h2>\n<h3><span style=\"color:#fe2c24\">5.1 \u4f7f\u7528\u6b65\u9aa4<\/span><\/h3>\n<p>1. \u5c06INCLUDE_vTaskDelete\u8bbe\u4e3a1\u3002<br \/>\n2. \u8c03\u7528vTaskDelete()&#xff0c;\u4f20\u5165\u4efb\u52a1\u53e5\u67c4&#xff08;NULL\u8868\u793a\u5220\u9664\u81ea\u8eab&#xff09;\u3002<\/p>\n<h3><span style=\"color:#fe2c24\">5.2 \u5185\u90e8\u5b9e\u73b0<\/span><\/h3>\n<p>1. \u4ece\u6240\u6709\u5217\u8868\u4e2d\u79fb\u9664\u4efb\u52a1\u3002<br \/>\n2. \u5982\u679c\u662f\u5220\u9664\u81ea\u8eab&#xff0c;\u5219\u8fdb\u5165\u7b49\u5f85\u5220\u9664\u5217\u8868&#xff0c;\u7531\u7a7a\u95f2\u4efb\u52a1\u91ca\u653e\u5185\u5b58\u3002<br \/>\n3. \u5982\u679c\u662f\u5220\u9664\u5176\u4ed6\u4efb\u52a1&#xff0c;\u76f4\u63a5\u91ca\u653e\u5185\u5b58\u3002<br \/>\n4. \u66f4\u65b0\u4efb\u52a1\u6570\u91cf\u548c\u963b\u585e\u65f6\u95f4\u3002<br \/>\n5. \u53ef\u80fd\u89e6\u53d1\u4efb\u52a1\u5207\u6362\u3002<\/p>\n<h2><span style=\"color:#fe2c24\">6 \u52a8\u6001\u4e0e\u9759\u6001\u521b\u5efa\u5bf9\u6bd4<\/span><\/h2>\n<p>\u52a8\u6001\u521b\u5efa&#xff1a;\u5185\u5b58\u6765\u81eaFreeRTOS\u5806&#xff0c;\u7075\u6d3b\u5e38\u7528&#xff0c;\u9700\u914d\u7f6econfigSUPPORT_DYNAMIC_ALLOCATION&#061;1\u3002<br \/>\n\u9759\u6001\u521b\u5efa&#xff1a;\u5185\u5b58\u7531\u7528\u6237\u5206\u914d&#xff0c;\u65e0\u5206\u914d\u5931\u8d25\u98ce\u9669&#xff0c;\u9700\u914d\u7f6econfigSUPPORT_STATIC_ALLOCATION&#061;1&#xff0c;\u9002\u7528\u4e8e\u5185\u5b58\u53d7\u9650\u6216\u9700\u56fa\u5b9a\u5730\u5740\u7684\u573a\u666f\u3002<\/p>\n<h2><span style=\"color:#fe2c24\">7 \u5173\u952e\u6ce8\u610f\u4e8b\u9879<\/span><\/h2>\n<p>1. \u4f18\u5148\u7ea7\u6570\u503c\u8d8a\u5927\u4f18\u5148\u7ea7\u8d8a\u9ad8\u3002<br \/>\n2. \u6808\u5927\u5c0f\u4ee5\u5b57\u4e3a\u5355\u4f4d&#xff08;\u5982128\u8868\u793a128*4\u5b57\u8282&#xff09;\u3002<br \/>\n3. \u5220\u9664\u81ea\u8eab\u65f6\u4f20\u5165NULL&#xff0c;\u5185\u5b58\u7531\u7a7a\u95f2\u4efb\u52a1\u91ca\u653e\u3002<br \/>\n4. \u7528\u6237\u7533\u8bf7\u7684\u5185\u5b58\u9700\u5728\u4efb\u52a1\u5220\u9664\u524d\u91ca\u653e&#xff0c;\u5426\u5219\u4f1a\u5bfc\u81f4\u5185\u5b58\u6cc4\u6f0f\u3002<br \/>\n5. \u5173\u952e\u4ee3\u7801\u6bb5\u53ef\u4f7f\u7528\u4e34\u754c\u533a\u4fdd\u62a4&#xff0c;\u9632\u6b62\u88ab\u4e2d\u65ad\u6253\u65ad\u3002<\/p>\n<h2><span style=\"color:#fe2c24\">8 \u4efb\u52a1\u52a8\u6001\u521b\u5efa\u4e0e\u5220\u9664\u5b9e\u9a8c<\/span><\/h2>\n<h3><span style=\"color:#fe2c24\">8.1\u00a0xTaskCreate() \u51fd\u6570<\/span><\/h3>\n<p>\u8fd9\u662fFreeRTOS\u4e2d\u52a8\u6001\u521b\u5efa\u4efb\u52a1\u7684\u6838\u5fc3API\u51fd\u6570\u3002\u5176\u4f5c\u7528\u662f\u4eceFreeRTOS\u7ba1\u7406\u7684\u5806\u5185\u5b58\u4e2d\u81ea\u52a8\u5206\u914d\u4efb\u52a1\u63a7\u5236\u5757&#xff08;TCB&#xff09;\u548c\u4efb\u52a1\u6808\u7a7a\u95f4&#xff0c;\u5e76\u5c06\u65b0\u4efb\u52a1\u521d\u59cb\u5316\u4e3a\u5c31\u7eea\u72b6\u6001&#xff0c;\u7b49\u5f85\u8c03\u5ea6\u5668\u8c03\u5ea6\u3002<\/p>\n<p>\u51fd\u6570\u539f\u578b&#xff1a;<br \/>\nBaseType_t xTaskCreate( TaskFunction_t pvTaskCode,<br \/>\n                        const char * const pcName,<br \/>\n                        configSTACK_DEPTH_TYPE usStackDepth,<br \/>\n                        void *pvParameters,<br \/>\n                        UBaseType_t uxPriority,<br \/>\n                        TaskHandle_t *pxCreatedTask );<\/p>\n<p>\u53c2\u6570\u8bf4\u660e&#xff1a;<br \/>\npvTaskCode: \u6307\u5411\u4efb\u52a1\u51fd\u6570\u7684\u6307\u9488&#xff0c;\u4efb\u52a1\u51fd\u6570\u901a\u5e38\u4e3a\u65e0\u9650\u5faa\u73af<br \/>\npcName: \u4efb\u52a1\u540d\u79f0\u5b57\u7b26\u4e32&#xff0c;\u7528\u4e8e\u8c03\u8bd5\u548c\u6807\u8bc6<br \/>\nusStackDepth: \u4efb\u52a1\u6808\u6df1\u5ea6&#xff08;\u4ee5\u5b57\u4e3a\u5355\u4f4d&#xff0c;\u5982128\u8868\u793a128*4\u5b57\u8282&#xff09;<br \/>\npvParameters: \u4f20\u9012\u7ed9\u4efb\u52a1\u51fd\u6570\u7684\u53c2\u6570\u6307\u9488<br \/>\nuxPriority: \u4efb\u52a1\u4f18\u5148\u7ea7&#xff08;0\u4e3a\u6700\u4f4e&#xff0c;\u6570\u503c\u8d8a\u5927\u4f18\u5148\u7ea7\u8d8a\u9ad8&#xff09;<br \/>\npxCreatedTask: \u8fd4\u56de\u7684\u4efb\u52a1\u53e5\u67c4&#xff0c;\u53ef\u7528\u4e8e\u540e\u7eed\u4efb\u52a1\u7ba1\u7406<\/p>\n<p>\u8fd4\u56de\u503c&#xff1a;<br \/>\npdPASS: \u4efb\u52a1\u521b\u5efa\u6210\u529f<br \/>\npdFAIL: \u4efb\u52a1\u521b\u5efa\u5931\u8d25&#xff08;\u901a\u5e38\u56e0\u5185\u5b58\u4e0d\u8db3&#xff09;<\/p>\n<p>\u7279\u70b9&#xff1a;<br \/>\n\u4efb\u52a1\u521b\u5efa\u540e\u7acb\u5373\u8fdb\u5165\u5c31\u7eea\u72b6\u6001<br \/>\n\u5185\u5b58\u7531\u7cfb\u7edf\u81ea\u52a8\u7ba1\u7406<br \/>\n\u9700\u8981\u914d\u7f6econfigSUPPORT_DYNAMIC_ALLOCATION&#061;1<\/p>\n<h3><span style=\"color:#fe2c24\">8.2\u00a0vTaskDelete() \u51fd\u6570<\/span><\/h3>\n<p>\u8fd9\u662fFreeRTOS\u4e2d\u5220\u9664\u4efb\u52a1\u7684API\u51fd\u6570\u3002\u5f53\u4f20\u5165\u53c2\u6570\u4e3aNULL\u65f6&#xff0c;\u8868\u793a\u5220\u9664\u5f53\u524d\u6b63\u5728\u6267\u884c\u7684\u4efb\u52a1\u81ea\u8eab\u3002<\/p>\n<p>\u5de5\u4f5c\u539f\u7406&#xff1a;<br \/>\n\u4efb\u52a1\u4ece\u6240\u6709\u72b6\u6001\u5217\u8868&#xff08;\u5c31\u7eea\u3001\u963b\u585e\u3001\u6302\u8d77\u3001\u4e8b\u4ef6&#xff09;\u4e2d\u79fb\u9664<br \/>\n\u4efb\u52a1\u81ea\u8eab\u8fdb\u5165\u7b49\u5f85\u5220\u9664\u5217\u8868<br \/>\n\u7a7a\u95f2\u4efb\u52a1&#xff08;Idle Task&#xff09;\u4f1a\u5728\u540e\u7eed\u8fd0\u884c\u4e2d\u91ca\u653e\u8be5\u4efb\u52a1\u5360\u7528\u7684\u7cfb\u7edf\u5185\u5b58<\/p>\n<p>\u6ce8\u610f\u4e8b\u9879&#xff1a;<br \/>\n\u5220\u9664\u81ea\u8eab\u540e&#xff0c;\u4efb\u52a1\u51fd\u6570\u7acb\u5373\u505c\u6b62\u6267\u884c<br \/>\n\u7528\u6237\u624b\u52a8\u7533\u8bf7\u7684\u5185\u5b58&#xff08;\u5982malloc&#xff09;\u4e0d\u4f1a\u88ab\u81ea\u52a8\u91ca\u653e&#xff0c;\u9700\u8981\u5728\u5220\u9664\u524d\u624b\u52a8\u91ca\u653e<br \/>\n\u5220\u9664\u5176\u4ed6\u4efb\u52a1\u65f6&#xff0c;\u9700\u4f20\u5165\u6709\u6548\u7684\u4efb\u52a1\u53e5\u67c4<br \/>\n\u9700\u8981\u914d\u7f6eINCLUDE_vTaskDelete&#061;1<\/p>\n<p>\u4f7f\u7528\u573a\u666f&#xff1a;<br \/>\n\u4e00\u6b21\u6027\u4efb\u52a1\u5b8c\u6210\u540e\u81ea\u6211\u6e05\u7406<br \/>\n\u4efb\u52a1\u5f02\u5e38\u65f6\u7684\u5b89\u5168\u9000\u51fa<br \/>\n\u52a8\u6001\u4efb\u52a1\u7ba1\u7406\u7cfb\u7edf\u4e2d\u7684\u4efb\u52a1\u79fb\u9664<\/p>\n<h3><span style=\"color:#fe2c24\">8.3\u00a0\u4e34\u754c\u533a<\/span><\/h3>\n<p>\u4e34\u754c\u533a\u662f\u4e00\u6bb5\u5728\u6267\u884c\u671f\u95f4\u4e0d\u80fd\u88ab\u4e2d\u65ad\u7684\u4ee3\u7801\u533a\u57df&#xff0c;\u7528\u4e8e\u4fdd\u62a4\u5171\u4eab\u8d44\u6e90\u7684\u539f\u5b50\u6027\u8bbf\u95ee\u3002<\/p>\n<p>\u76f8\u5173\u51fd\u6570&#xff1a;<br \/>\ntaskENTER_CRITICAL(): \u8fdb\u5165\u4e34\u754c\u533a&#xff0c;\u5173\u95edFreeRTOS\u7ba1\u7406\u7684\u4e2d\u65ad<br \/>\ntaskEXIT_CRITICAL(): \u9000\u51fa\u4e34\u754c\u533a&#xff0c;\u6062\u590d\u4e2d\u65ad<\/p>\n<p>\u4f5c\u7528\u673a\u5236&#xff1a;<br \/>\n\u8fdb\u5165\u4e34\u754c\u533a\u540e&#xff0c;FreeRTOS\u4f1a\u5173\u95ed\u53ef\u7ba1\u7406\u7684\u4e2d\u65ad&#xff08;\u901a\u5e38\u662fPendSV\u548cSysTick&#xff09;<br \/>\n\u4f46\u4ecd\u53ef\u54cd\u5e94\u9ad8\u4f18\u5148\u7ea7\u786c\u4ef6\u4e2d\u65ad&#xff08;\u5982\u5916\u8bbe\u4e2d\u65ad&#xff09;<br \/>\n\u9000\u51fa\u4e34\u754c\u533a\u65f6\u6062\u590d\u4e4b\u524d\u7684\u4e2d\u65ad\u72b6\u6001<\/p>\n<p>\u4e3b\u8981\u7528\u9014&#xff1a;<br \/>\n\u4fdd\u62a4\u591a\u4efb\u52a1\u5171\u4eab\u7684\u5168\u5c40\u53d8\u91cf\u6216\u6570\u636e\u7ed3\u6784<br \/>\n\u9632\u6b62\u4efb\u52a1\u5207\u6362\u671f\u95f4\u7684\u8d44\u6e90\u7ade\u4e89<br \/>\n\u786e\u4fdd\u4ee3\u7801\u6bb5\u7684\u539f\u5b50\u6027\u6267\u884c<\/p>\n<p>\u6ce8\u610f\u4e8b\u9879&#xff1a;<br \/>\n\u4e34\u754c\u533a\u5e94\u5c3d\u91cf\u7b80\u77ed&#xff0c;\u907f\u514d\u5f71\u54cd\u7cfb\u7edf\u5b9e\u65f6\u6027<br \/>\n\u4e0d\u53ef\u5d4c\u5957\u8c03\u7528&#xff08;\u6216\u9700\u6ce8\u610f\u5d4c\u5957\u8ba1\u6570&#xff09;<br \/>\n\u4e0d\u80fd\u5728\u4e34\u754c\u533a\u5185\u8c03\u7528\u53ef\u80fd\u5f15\u8d77\u4efb\u52a1\u963b\u585e\u7684API&#xff08;\u5982vTaskDelay&#xff09;<\/p>\n<h3><span style=\"color:#fe2c24\">8.4 \u5b9e\u9a8c\u4ee3\u7801<\/span><\/h3>\n<p>\/*<br \/>\n * \u4efb\u52a1\u4f18\u5148\u7ea7\u5b9a\u4e49&#xff1a;<br \/>\n * \u6570\u503c\u8d8a\u5927\u4f18\u5148\u7ea7\u8d8a\u9ad8&#xff0c;FreeRTOS\u4e2d\u4f18\u5148\u7ea7\u901a\u5e38\u4ece0\u5f00\u59cb&#xff0c;0\u4e3a\u6700\u4f4e\u4f18\u5148\u7ea7<br \/>\n * \u8fd9\u91cc\u5b9a\u4e49\u8d77\u59cb\u4efb\u52a1\u4f18\u5148\u7ea7\u4e3a1&#xff0c;task1\u4f18\u5148\u7ea7\u4e3a2&#xff0c;task2\u4f18\u5148\u7ea7\u4e3a3&#xff0c;task3\u4f18\u5148\u7ea7\u4e3a4<br \/>\n *\/<br \/>\n#define START_TASK_PRIO       1               \/\/ \u8d77\u59cb\u4efb\u52a1\u4f18\u5148\u7ea7<br \/>\n#define START_TASK_STACK_SIZE 128             \/\/ \u8d77\u59cb\u4efb\u52a1\u5806\u6808\u5927\u5c0f&#xff08;\u4ee5\u5b57\u4e3a\u5355\u4f4d&#xff0c;128\u5b57&#061;128*4\u5b57\u8282&#061;512\u5b57\u8282&#xff09;<br \/>\nTaskHandle_t start_task_handler;              \/\/ \u8d77\u59cb\u4efb\u52a1\u53e5\u67c4&#xff0c;\u7528\u4e8e\u4efb\u52a1\u7ba1\u7406<br \/>\nvoid start_task(void *pvParameters);          \/\/ \u8d77\u59cb\u4efb\u52a1\u51fd\u6570\u58f0\u660e<\/p>\n<p>#define TASK1_PRIO           2                \/\/ \u4efb\u52a11\u4f18\u5148\u7ea7<br \/>\n#define TASK1_STACK_SIZE     128              \/\/ \u4efb\u52a11\u5806\u6808\u5927\u5c0f<br \/>\nTaskHandle_t task1_handler;                   \/\/ \u4efb\u52a11\u53e5\u67c4<br \/>\nvoid task1(void *pvParameters);               \/\/ \u4efb\u52a11\u51fd\u6570\u58f0\u660e<\/p>\n<p>#define TASK2_PRIO           3                \/\/ \u4efb\u52a12\u4f18\u5148\u7ea7<br \/>\n#define TASK2_STACK_SIZE     128              \/\/ \u4efb\u52a12\u5806\u6808\u5927\u5c0f<br \/>\nTaskHandle_t task2_handler;                   \/\/ \u4efb\u52a12\u53e5\u67c4<br \/>\nvoid task2(void *pvParameters);               \/\/ \u4efb\u52a12\u51fd\u6570\u58f0\u660e<\/p>\n<p>#define TASK3_PRIO           4                \/\/ \u4efb\u52a13\u4f18\u5148\u7ea7<br \/>\n#define TASK3_STACK_SIZE     128              \/\/ \u4efb\u52a13\u5806\u6808\u5927\u5c0f<br \/>\nTaskHandle_t task3_handler;                   \/\/ \u4efb\u52a13\u53e5\u67c4<br \/>\nvoid task3(void *pvParameters);               \/\/ \u4efb\u52a13\u51fd\u6570\u58f0\u660e<\/p>\n<p>\/**<br \/>\n * &#064;brief       FreeRTOS\u4f8b\u7a0b\u5165\u53e3\u51fd\u6570<br \/>\n * &#064;param       \u65e0<br \/>\n * &#064;retval      \u65e0<br \/>\n * \u529f\u80fd&#xff1a;\u521b\u5efa\u8d77\u59cb\u4efb\u52a1\u5e76\u542f\u52a8FreeRTOS\u8c03\u5ea6\u5668<br \/>\n *\/<br \/>\nvoid freertos_demo(void)<br \/>\n{<br \/>\n    \/* \u4f7f\u7528xTaskCreate\u52a8\u6001\u521b\u5efa\u8d77\u59cb\u4efb\u52a1<br \/>\n     * \u53c2\u6570\u8bf4\u660e&#xff1a;<br \/>\n     * 1. start_task &#8211; \u4efb\u52a1\u51fd\u6570\u6307\u9488<br \/>\n     * 2. &#034;start_task&#034; &#8211; \u4efb\u52a1\u540d\u79f0&#xff08;\u5b57\u7b26\u4e32&#xff09;<br \/>\n     * 3. START_TASK_STACK_SIZE &#8211; \u4efb\u52a1\u5806\u6808\u5927\u5c0f<br \/>\n     * 4. NULL &#8211; \u4f20\u9012\u7ed9\u4efb\u52a1\u51fd\u6570\u7684\u53c2\u6570&#xff08;\u6b64\u5904\u4e3a\u7a7a&#xff09;<br \/>\n     * 5. START_TASK_PRIO &#8211; \u4efb\u52a1\u4f18\u5148\u7ea7<br \/>\n     * 6. &amp;start_task_handler &#8211; \u8fd4\u56de\u7684\u4efb\u52a1\u53e5\u67c4\u6307\u9488<br \/>\n     *\/<br \/>\n    xTaskCreate((TaskFunction_t)         start_task,<br \/>\n                (char *)                 &#034;start_task&#034;,<br \/>\n                (configSTACK_DEPTH_TYPE) START_TASK_STACK_SIZE,<br \/>\n                (void *)                 NULL,<br \/>\n                (UBaseType_t)            START_TASK_PRIO,<br \/>\n                (TaskHandle_t *)         &amp;start_task_handler);<\/p>\n<p>    \/* \u542f\u52a8FreeRTOS\u8c03\u5ea6\u5668&#xff0c;\u7cfb\u7edf\u5f00\u59cb\u8fdb\u884c\u4efb\u52a1\u8c03\u5ea6 *\/<br \/>\n    vTaskStartScheduler();<br \/>\n}<\/p>\n<p>\/**<br \/>\n * &#064;brief       \u8d77\u59cb\u4efb\u52a1\u51fd\u6570<br \/>\n * &#064;param       pvParameters &#8211; \u4efb\u52a1\u53c2\u6570&#xff08;\u6b64\u5904\u672a\u4f7f\u7528&#xff09;<br \/>\n * &#064;retval      \u65e0<br \/>\n * \u529f\u80fd&#xff1a;\u521b\u5efatask1\u3001task2\u3001task3\u4e09\u4e2a\u4efb\u52a1&#xff0c;\u7136\u540e\u5220\u9664\u81ea\u8eab<br \/>\n *\/<br \/>\nvoid start_task(void *pvParameters)<br \/>\n{<br \/>\n    \/* \u8fdb\u5165\u4e34\u754c\u533a&#xff1a;\u9632\u6b62\u4efb\u52a1\u521b\u5efa\u8fc7\u7a0b\u88ab\u4e2d\u65ad\u6253\u65ad *\/<br \/>\n    taskENTER_CRITICAL();<\/p>\n<p>    \/* \u52a8\u6001\u521b\u5efa\u4efb\u52a11 *\/<br \/>\n    xTaskCreate((TaskFunction_t)         task1,<br \/>\n                (char *)                 &#034;task1&#034;,<br \/>\n                (configSTACK_DEPTH_TYPE) TASK1_STACK_SIZE,<br \/>\n                (void *)                 NULL,<br \/>\n                (UBaseType_t)            TASK1_PRIO,<br \/>\n                (TaskHandle_t *)         &amp;task1_handler);<\/p>\n<p>    \/* \u52a8\u6001\u521b\u5efa\u4efb\u52a12 *\/<br \/>\n    xTaskCreate((TaskFunction_t)         task2,<br \/>\n                (char *)                 &#034;task2&#034;,<br \/>\n                (configSTACK_DEPTH_TYPE) TASK2_STACK_SIZE,<br \/>\n                (void *)                 NULL,<br \/>\n                (UBaseType_t)            TASK2_PRIO,<br \/>\n                (TaskHandle_t *)         &amp;task2_handler);<\/p>\n<p>    \/* \u52a8\u6001\u521b\u5efa\u4efb\u52a13 *\/<br \/>\n    xTaskCreate((TaskFunction_t)         task3,<br \/>\n                (char *)                 &#034;task3&#034;,<br \/>\n                (configSTACK_DEPTH_TYPE) TASK3_STACK_SIZE,<br \/>\n                (void *)                 NULL,<br \/>\n                (UBaseType_t)            TASK3_PRIO,<br \/>\n                (TaskHandle_t *)         &amp;task3_handler);<\/p>\n<p>    \/* \u9000\u51fa\u4e34\u754c\u533a *\/<br \/>\n    taskEXIT_CRITICAL();<\/p>\n<p>    \/* \u5220\u9664\u8d77\u59cb\u4efb\u52a1\u81ea\u8eab&#xff08;NULL\u8868\u793a\u5220\u9664\u5f53\u524d\u4efb\u52a1&#xff09; *\/<br \/>\n    vTaskDelete(NULL);<br \/>\n}<\/p>\n<p>\/**<br \/>\n * &#064;brief       \u4efb\u52a11\u51fd\u6570<br \/>\n * &#064;param       pvParameters &#8211; \u4efb\u52a1\u53c2\u6570&#xff08;\u6b64\u5904\u672a\u4f7f\u7528&#xff09;<br \/>\n * &#064;retval      \u65e0<br \/>\n * \u529f\u80fd&#xff1a;\u63a7\u5236LED0\u6bcf500ms\u95ea\u70c1\u4e00\u6b21<br \/>\n *\/<br \/>\nvoid task1(void *pvParameters)<br \/>\n{<br \/>\n    while (1)<br \/>\n    {<br \/>\n        LED0_TOGGLE();          \/\/ LED0\u72b6\u6001\u7ffb\u8f6c<br \/>\n        vTaskDelay(500);        \/\/ \u5ef6\u8fdf500ms&#xff08;\u4ee5FreeRTOS\u7684\u8282\u62cd\u4e3a\u5355\u4f4d&#xff09;<br \/>\n    }<br \/>\n}<\/p>\n<p>\/**<br \/>\n * &#064;brief       \u4efb\u52a12\u51fd\u6570<br \/>\n * &#064;param       pvParameters &#8211; \u4efb\u52a1\u53c2\u6570&#xff08;\u6b64\u5904\u672a\u4f7f\u7528&#xff09;<br \/>\n * &#064;retval      \u65e0<br \/>\n * \u529f\u80fd&#xff1a;\u63a7\u5236LED1\u6bcf500ms\u95ea\u70c1\u4e00\u6b21<br \/>\n *\/<br \/>\nvoid task2(void *pvParameters)<br \/>\n{<br \/>\n    while (1)<br \/>\n    {<br \/>\n        LED1_TOGGLE();          \/\/ LED1\u72b6\u6001\u7ffb\u8f6c<br \/>\n        vTaskDelay(500);        \/\/ \u5ef6\u8fdf500ms<br \/>\n    }<br \/>\n}<\/p>\n<p>\/**<br \/>\n * &#064;brief       \u4efb\u52a13\u51fd\u6570<br \/>\n * &#064;param       pvParameters &#8211; \u4efb\u52a1\u53c2\u6570&#xff08;\u6b64\u5904\u672a\u4f7f\u7528&#xff09;<br \/>\n * &#064;retval      \u65e0<br \/>\n * \u529f\u80fd&#xff1a;\u68c0\u6d4b\u6309\u952eKEY0&#xff0c;\u6309\u4e0b\u5219\u5220\u9664task1\u4efb\u52a1<br \/>\n *\/<br \/>\nvoid task3(void *pvParameters)<br \/>\n{<br \/>\n    uint8_t key &#061; 0;<\/p>\n<p>    while (1)<br \/>\n    {<br \/>\n        printf(&#034;task3\u6b63\u5728\u8fd0\u884c&#xff01;&#xff01;&#xff01;\\\\r\\\\n&#034;);  \/\/ \u8f93\u51fa\u8fd0\u884c\u63d0\u793a\u4fe1\u606f<\/p>\n<p>        key &#061; key_scan(0);      \/\/ \u626b\u63cf\u6309\u952e&#xff08;\u53c2\u65700\u8868\u793a\u4e0d\u652f\u6301\u8fde\u6309&#xff09;<\/p>\n<p>        if (key &#061;&#061; KEY0_PRES)   \/\/ \u5982\u679cKEY0\u6309\u4e0b<br \/>\n        {<br \/>\n            if (task1_handler !&#061; NULL)  \/\/ \u68c0\u67e5task1\u53e5\u67c4\u662f\u5426\u6709\u6548<br \/>\n            {<br \/>\n                printf(&#034;\u5220\u9664task1\u4efb\u52a1\\\\r\\\\n&#034;);<br \/>\n                vTaskDelete(task1_handler);  \/\/ \u5220\u9664task1\u4efb\u52a1<br \/>\n                task1_handler &#061; NULL;        \/\/ \u5c06\u53e5\u67c4\u7f6e\u4e3aNULL&#xff0c;\u9632\u6b62\u91cd\u590d\u5220\u9664<br \/>\n            }<br \/>\n        }<br \/>\n        vTaskDelay(10);         \/\/ \u5ef6\u8fdf10ms&#xff0c;\u63a7\u5236\u6309\u952e\u68c0\u6d4b\u9891\u7387<br \/>\n    }<br \/>\n}<\/p>\n<p>\u5b9e\u73b0\u529f\u80fd&#xff1a;\u9996\u5148\u521b\u5efa\u4e00\u4e2a\u8d77\u59cb\u4efb\u52a1\u6765\u521d\u59cb\u5316\u4e09\u4e2a\u529f\u80fd\u4efb\u52a1&#xff0c;\u5176\u4e2d task1 \u548c task2 \u5206\u522b\u63a7\u5236 LED0 \u548c LED1 \u4ee5 500ms \u95f4\u9694\u95ea\u70c1&#xff0c;\u5b9e\u73b0\u53cc\u706f\u4ea4\u66ff\u95ea\u70c1\u6548\u679c&#xff1b;task3 \u5219\u8d1f\u8d23\u76d1\u63a7\u6309\u952e KEY0 \u7684\u6309\u4e0b\u4e8b\u4ef6&#xff0c;\u5e76\u5728\u68c0\u6d4b\u5230\u6309\u952e\u65f6\u52a8\u6001\u5220\u9664 task1 \u4efb\u52a1&#xff0c;\u6f14\u793a\u4e86\u4efb\u52a1\u8fd0\u884c\u65f6\u7ba1\u7406\u7684\u529f\u80fd\u3002<\/p>\n<h2><span style=\"color:#fe2c24\">9 \u4efb\u52a1\u52a8\u6001\u521b\u5efa\u4e0e\u5220\u9664\u5b9e\u9a8c<\/span><\/h2>\n<h3><span style=\"color:#fe2c24\">9.1\u00a0xTaskCreateStatic()\u51fd\u6570<\/span><\/h3>\n<p>xTaskCreateStatic\u00a0\u662f FreeRTOS \u4e2d\u7528\u4e8e\u521b\u5efa\u9759\u6001\u5185\u5b58\u5206\u914d\u4efb\u52a1\u7684\u51fd\u6570\u3002\u4e0e\u52a8\u6001\u5206\u914d\u7684\u00a0xTaskCreate\u00a0\u4e0d\u540c&#xff0c;\u5b83\u9700\u8981\u7528\u6237\u9884\u5148\u5206\u914d\u4efb\u52a1\u63a7\u5236\u5757&#xff08;TCB&#xff09;\u548c\u6808\u5185\u5b58&#xff0c;\u9002\u5408\u5728\u7981\u7528\u52a8\u6001\u5185\u5b58\u5206\u914d\u7684\u7cfb\u7edf\u4e2d\u4f7f\u7528\u3002<\/p>\n<p>\u51fd\u6570\u539f\u578b&#xff1a;<br \/>\nTaskHandle_t xTaskCreateStatic( TaskFunction_t pvTaskCode,<br \/>\n                                const char * const pcName,<br \/>\n                                const uint32_t ulStackDepth,<br \/>\n                                void * const pvParameters,<br \/>\n                                UBaseType_t uxPriority,<br \/>\n                                StackType_t * const puxStackBuffer,<br \/>\n                                StaticTask_t * const pxTaskBuffer );<\/p>\n<p>\u53c2\u6570\u8bf4\u660e&#xff1a;<br \/>\npvTaskCode: \u6307\u5411\u4efb\u52a1\u51fd\u6570\u7684\u6307\u9488&#xff0c;\u4efb\u52a1\u51fd\u6570\u901a\u5e38\u4e3a\u65e0\u9650\u5faa\u73af<br \/>\npcName: \u4efb\u52a1\u540d\u79f0\u5b57\u7b26\u4e32&#xff0c;\u7528\u4e8e\u8c03\u8bd5\u548c\u6807\u8bc6<br \/>\nulStackDepth: \u4efb\u52a1\u6808\u6df1\u5ea6&#xff08;\u4ee5\u5b57\u4e3a\u5355\u4f4d&#xff0c;\u5982128\u8868\u793a128*4\u5b57\u8282&#xff09;<br \/>\npvParameters: \u4f20\u9012\u7ed9\u4efb\u52a1\u51fd\u6570\u7684\u53c2\u6570\u6307\u9488<br \/>\nuxPriority: \u4efb\u52a1\u4f18\u5148\u7ea7&#xff08;0\u4e3a\u6700\u4f4e&#xff0c;\u6570\u503c\u8d8a\u5927\u4f18\u5148\u7ea7\u8d8a\u9ad8&#xff09;<br \/>\npuxStackBuffer: \u6307\u5411\u4efb\u52a1\u6808\u7f13\u51b2\u533a\u7684\u6307\u9488&#xff0c;\u5fc5\u987b\u7531\u7528\u6237\u9759\u6001\u5206\u914d<br \/>\npxTaskBuffer: \u6307\u5411\u4efb\u52a1\u63a7\u5236\u5757&#xff08;TCB&#xff09;\u7f13\u51b2\u533a\u7684\u6307\u9488&#xff0c;\u5fc5\u987b\u7531\u7528\u6237\u9759\u6001\u5206\u914d<\/p>\n<p>\u8fd4\u56de\u503c&#xff1a;<br \/>\n\u975eNULL: \u4efb\u52a1\u521b\u5efa\u6210\u529f&#xff0c;\u8fd4\u56de\u4efb\u52a1\u53e5\u67c4<br \/>\nNULL: \u4efb\u52a1\u521b\u5efa\u5931\u8d25&#xff08;\u901a\u5e38\u56e0\u4e3apuxStackBuffer\u6216pxTaskBuffer\u4e3aNULL&#xff0c;\u6216\u6808\u6df1\u5ea6\u4e3a0&#xff09;<\/p>\n<p>\u7279\u70b9&#xff1a;<br \/>\n\u4efb\u52a1\u521b\u5efa\u540e\u7acb\u5373\u8fdb\u5165\u5c31\u7eea\u72b6\u6001<br \/>\n\u5185\u5b58\u7531\u7528\u6237\u9884\u5148\u9759\u6001\u5206\u914d&#xff0c;\u65e0\u52a8\u6001\u5185\u5b58\u7ba1\u7406\u5f00\u9500<br \/>\n\u9700\u8981\u914d\u7f6econfigSUPPORT_STATIC_ALLOCATION&#061;1<br \/>\n\u65e0\u5185\u5b58\u788e\u7247\u95ee\u9898&#xff0c;\u9002\u5408\u957f\u671f\u8fd0\u884c\u7684\u5b89\u5168\u5173\u952e\u7cfb\u7edf<\/p>\n<h3><span style=\"color:#fe2c24\">9.2 \u5b9e\u9a8c\u4ee3\u7801<\/span><\/h3>\n<p>\/* FreeRTOS\u9759\u6001\u4efb\u52a1\u521b\u5efa\u793a\u4f8b\u4ee3\u7801 *\/<\/p>\n<p>\/* \u8d77\u59cb\u4efb\u52a1\u914d\u7f6e\u5b9a\u4e49 *\/<br \/>\n#define START_TASK_PRIO        1                    \/\/ \u4efb\u52a1\u4f18\u5148\u7ea7<br \/>\n#define START_TASK_STACK_SIZE  128                  \/\/ \u5806\u6808\u5927\u5c0f&#xff08;\u4ee5\u5b57\u4e3a\u5355\u4f4d&#xff09;<br \/>\nTaskHandle_t start_task_handler;                    \/\/ \u8d77\u59cb\u4efb\u52a1\u53e5\u67c4<br \/>\nStackType_t START_TASK_STACK[START_TASK_STACK_SIZE]; \/\/ \u8d77\u59cb\u4efb\u52a1\u5806\u6808\u6570\u7ec4&#xff08;\u9759\u6001\u5206\u914d&#xff09;<br \/>\nStaticTask_t start_task_tcb;                        \/\/ \u8d77\u59cb\u4efb\u52a1\u63a7\u5236\u5757&#xff08;TCB&#xff09;<br \/>\nvoid start_task(void *pvParameters);                \/\/ \u8d77\u59cb\u4efb\u52a1\u51fd\u6570\u58f0\u660e<\/p>\n<p>\/* \u4efb\u52a11\u914d\u7f6e\u5b9a\u4e49 *\/<br \/>\n#define TASK1_PRIO       2                          \/\/ \u4efb\u52a1\u4f18\u5148\u7ea7<br \/>\n#define TASK1_STACK_SIZE 128                        \/\/ \u5806\u6808\u5927\u5c0f<br \/>\nTaskHandle_t task1_handler;                         \/\/ \u4efb\u52a11\u53e5\u67c4<br \/>\nStackType_t TASK1_STACK[TASK1_STACK_SIZE];          \/\/ \u4efb\u52a11\u5806\u6808\u6570\u7ec4&#xff08;\u6ce8\u610f&#xff1a;\u8fd9\u91cc\u8bef\u5199\u4e3aSTART_TASK_STACK_SIZE&#xff0c;\u5e94\u8be5\u662fTASK1_STACK_SIZE&#xff09;<br \/>\nStaticTask_t task1_tcb;                             \/\/ \u4efb\u52a11\u63a7\u5236\u5757<br \/>\nvoid task1(void *pvParameters);                     \/\/ \u4efb\u52a11\u51fd\u6570\u58f0\u660e<\/p>\n<p>\/* \u4efb\u52a12\u914d\u7f6e\u5b9a\u4e49 *\/<br \/>\n#define TASK2_PRIO       3                          \/\/ \u4efb\u52a1\u4f18\u5148\u7ea7<br \/>\n#define TASK2_STACK_SIZE 128                        \/\/ \u5806\u6808\u5927\u5c0f<br \/>\nTaskHandle_t task2_handler;                         \/\/ \u4efb\u52a12\u53e5\u67c4<br \/>\nStackType_t TASK2_STACK[TASK2_STACK_SIZE];          \/\/ \u4efb\u52a12\u5806\u6808\u6570\u7ec4&#xff08;\u6ce8\u610f&#xff1a;\u540c\u6837\u8bef\u5199\u4e3aSTART_TASK_STACK_SIZE&#xff09;<br \/>\nStaticTask_t task2_tcb;                             \/\/ \u4efb\u52a12\u63a7\u5236\u5757<br \/>\nvoid task2(void *pvParameters);                     \/\/ \u4efb\u52a12\u51fd\u6570\u58f0\u660e<\/p>\n<p>\/* \u4efb\u52a13\u914d\u7f6e\u5b9a\u4e49 *\/<br \/>\n#define TASK3_PRIO       3                          \/\/ \u4efb\u52a1\u4f18\u5148\u7ea7&#xff08;\u4e0e\u4efb\u52a12\u76f8\u540c&#xff0c;\u8fd9\u53ef\u80fd\u5bfc\u81f4\u4efb\u52a1\u8c03\u5ea6\u4e0d\u7b26\u5408\u9884\u671f&#xff09;<br \/>\n#define TASK3_STACK_SIZE 128                        \/\/ \u5806\u6808\u5927\u5c0f<br \/>\nTaskHandle_t task3_handler;                         \/\/ \u4efb\u52a13\u53e5\u67c4<br \/>\nStackType_t TASK3_STACK[TASK3_STACK_SIZE];          \/\/ \u4efb\u52a13\u5806\u6808\u6570\u7ec4&#xff08;\u540c\u6837\u8bef\u5199\u4e3aSTART_TASK_STACK_SIZE&#xff09;<br \/>\nStaticTask_t task3_tcb;                             \/\/ \u4efb\u52a13\u63a7\u5236\u5757<br \/>\nvoid task3(void *pvParameters);                     \/\/ \u4efb\u52a13\u51fd\u6570\u58f0\u660e<\/p>\n<p>\/* \u7a7a\u95f2\u4efb\u52a1\u548c\u5b9a\u65f6\u5668\u4efb\u52a1\u5185\u5b58\u914d\u7f6e&#xff08;\u9759\u6001\u5206\u914d\u5fc5\u9700&#xff09; *\/<br \/>\nStaticTask_t idle_task_tcb;                              \/\/ \u7a7a\u95f2\u4efb\u52a1\u63a7\u5236\u5757<br \/>\nStackType_t idle_task_stack[configMINIMAL_STACK_SIZE];   \/\/ \u7a7a\u95f2\u4efb\u52a1\u5806\u6808<br \/>\nStaticTask_t timer_task_tcb;                             \/\/ \u5b9a\u65f6\u5668\u4efb\u52a1\u63a7\u5236\u5757<br \/>\nStackType_t timer_task_stack[configMINIMAL_STACK_SIZE];  \/\/ \u5b9a\u65f6\u5668\u4efb\u52a1\u5806\u6808<\/p>\n<p>\/\/ \u7a7a\u95f2\u4efb\u52a1\u5185\u5b58\u5206\u914d\u63a5\u53e3\u51fd\u6570&#xff08;FreeRTOS\u9759\u6001\u521b\u5efa\u4efb\u52a1\u65f6\u5fc5\u987b\u5b9e\u73b0&#xff09;<br \/>\nvoid vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer,<br \/>\n                                   StackType_t **ppxIdleTaskStackBuffer,<br \/>\n                                   uint32_t *pulIdleTaskStackSize)<br \/>\n{<br \/>\n    *ppxIdleTaskTCBBuffer &#061; &amp;idle_task_tcb;             \/\/ \u8fd4\u56de\u7a7a\u95f2\u4efb\u52a1\u63a7\u5236\u5757\u6307\u9488<br \/>\n    *ppxIdleTaskStackBuffer &#061; idle_task_stack;          \/\/ \u8fd4\u56de\u7a7a\u95f2\u4efb\u52a1\u5806\u6808\u6307\u9488<br \/>\n    *pulIdleTaskStackSize &#061; configMINIMAL_STACK_SIZE;   \/\/ \u8fd4\u56de\u7a7a\u95f2\u4efb\u52a1\u5806\u6808\u5927\u5c0f<br \/>\n}<\/p>\n<p>\/\/ \u5b9a\u65f6\u5668\u4efb\u52a1\u5185\u5b58\u5206\u914d\u63a5\u53e3\u51fd\u6570&#xff08;\u4f7f\u7528\u8f6f\u4ef6\u5b9a\u65f6\u5668\u65f6\u5fc5\u987b\u5b9e\u73b0&#xff09;<br \/>\nvoid vApplicationGetTimerTaskMemory(StaticTask_t **ppxTimerTaskTCBBuffer,<br \/>\n                                    StackType_t **ppxTimerTaskStackBuffer,<br \/>\n                                    uint32_t *pulTimerTaskStackSize)<br \/>\n{<br \/>\n    *ppxTimerTaskTCBBuffer &#061; &amp;timer_task_tcb;           \/\/ \u8fd4\u56de\u5b9a\u65f6\u5668\u4efb\u52a1\u63a7\u5236\u5757\u6307\u9488<br \/>\n    *ppxTimerTaskStackBuffer &#061; timer_task_stack;        \/\/ \u8fd4\u56de\u5b9a\u65f6\u5668\u4efb\u52a1\u5806\u6808\u6307\u9488<br \/>\n    *pulTimerTaskStackSize &#061; configMINIMAL_STACK_SIZE;  \/\/ \u8fd4\u56de\u5b9a\u65f6\u5668\u4efb\u52a1\u5806\u6808\u5927\u5c0f<br \/>\n}<\/p>\n<p>\/**<br \/>\n * &#064;brief       FreeRTOS\u4f8b\u7a0b\u5165\u53e3\u51fd\u6570<br \/>\n * &#064;param       \u65e0<br \/>\n * &#064;retval      \u65e0<br \/>\n * \u529f\u80fd&#xff1a;\u4f7f\u7528\u9759\u6001\u65b9\u5f0f\u521b\u5efa\u8d77\u59cb\u4efb\u52a1\u5e76\u542f\u52a8FreeRTOS\u8c03\u5ea6\u5668<br \/>\n *\/<br \/>\nvoid freertos_demo(void)<br \/>\n{<br \/>\n    \/\/ \u4f7f\u7528xTaskCreateStatic\u9759\u6001\u521b\u5efa\u8d77\u59cb\u4efb\u52a1<br \/>\n    start_task_handler &#061; xTaskCreateStatic(<br \/>\n        (TaskFunction_t)start_task,               \/\/ \u6307\u5411\u4efb\u52a1\u51fd\u6570\u7684\u6307\u9488<br \/>\n        (char *)&#034;start_task&#034;,                     \/\/ \u4efb\u52a1\u540d\u79f0<br \/>\n        (uint32_t)START_TASK_STACK_SIZE,          \/\/ \u4efb\u52a1\u5806\u6808\u5927\u5c0f&#xff08;\u4ee5\u5b57\u4e3a\u5355\u4f4d&#xff09;<br \/>\n        (void *)NULL,                             \/\/ \u4f20\u9012\u7ed9\u4efb\u52a1\u51fd\u6570\u7684\u53c2\u6570<br \/>\n        (UBaseType_t)START_TASK_PRIO,             \/\/ \u4efb\u52a1\u4f18\u5148\u7ea7<br \/>\n        (StackType_t *)START_TASK_STACK,          \/\/ \u4efb\u52a1\u5806\u6808\u6570\u7ec4&#xff08;\u7528\u6237\u5206\u914d&#xff09;<br \/>\n        (StaticTask_t *)&amp;start_task_tcb           \/\/ \u4efb\u52a1\u63a7\u5236\u5757\u6307\u9488&#xff08;\u7528\u6237\u5206\u914d&#xff09;<br \/>\n    );<\/p>\n<p>    \/\/ \u542f\u52a8FreeRTOS\u8c03\u5ea6\u5668<br \/>\n    vTaskStartScheduler();<br \/>\n}<\/p>\n<p>\/**<br \/>\n * &#064;brief       \u8d77\u59cb\u4efb\u52a1\u51fd\u6570<br \/>\n * &#064;param       pvParameters &#8211; \u4efb\u52a1\u53c2\u6570&#xff08;\u672a\u4f7f\u7528&#xff09;<br \/>\n * &#064;retval      \u65e0<br \/>\n * \u529f\u80fd&#xff1a;\u9759\u6001\u521b\u5efatask1\u3001task2\u3001task3\u4e09\u4e2a\u4efb\u52a1&#xff0c;\u7136\u540e\u5220\u9664\u81ea\u8eab<br \/>\n *\/<br \/>\nvoid start_task(void *pvParameters)<br \/>\n{<br \/>\n    \/\/ \u8fdb\u5165\u4e34\u754c\u533a&#xff0c;\u9632\u6b62\u4efb\u52a1\u521b\u5efa\u8fc7\u7a0b\u88ab\u4e2d\u65ad\u6253\u65ad<br \/>\n    taskENTER_CRITICAL();<\/p>\n<p>    \/\/ \u4f7f\u7528xTaskCreateStatic\u9759\u6001\u521b\u5efa\u4efb\u52a11<br \/>\n    task1_handler &#061; xTaskCreateStatic(<br \/>\n        (TaskFunction_t)task1,                    \/\/ \u6307\u5411\u4efb\u52a1\u51fd\u6570\u7684\u6307\u9488<br \/>\n        (char *)&#034;task1&#034;,                          \/\/ \u4efb\u52a1\u540d\u79f0<br \/>\n        (uint32_t)TASK1_STACK_SIZE,               \/\/ \u4efb\u52a1\u5806\u6808\u5927\u5c0f<br \/>\n        (void *)NULL,                             \/\/ \u4f20\u9012\u7ed9\u4efb\u52a1\u51fd\u6570\u7684\u53c2\u6570<br \/>\n        (UBaseType_t)TASK1_PRIO,                  \/\/ \u4efb\u52a1\u4f18\u5148\u7ea7<br \/>\n        (StackType_t *)TASK1_STACK,               \/\/ \u4efb\u52a1\u5806\u6808\u6570\u7ec4<br \/>\n        (StaticTask_t *)&amp;task1_tcb                \/\/ \u4efb\u52a1\u63a7\u5236\u5757<br \/>\n    );<\/p>\n<p>    \/\/ \u4f7f\u7528xTaskCreateStatic\u9759\u6001\u521b\u5efa\u4efb\u52a12<br \/>\n    task2_handler &#061; xTaskCreateStatic(<br \/>\n        (TaskFunction_t)task2,                    \/\/ \u6307\u5411\u4efb\u52a1\u51fd\u6570\u7684\u6307\u9488<br \/>\n        (char *)&#034;task2&#034;,                          \/\/ \u4efb\u52a1\u540d\u79f0<br \/>\n        (uint32_t)TASK2_STACK_SIZE,               \/\/ \u4efb\u52a1\u5806\u6808\u5927\u5c0f<br \/>\n        (void *)NULL,                             \/\/ \u4f20\u9012\u7ed9\u4efb\u52a1\u51fd\u6570\u7684\u53c2\u6570<br \/>\n        (UBaseType_t)TASK2_PRIO,                  \/\/ \u4efb\u52a1\u4f18\u5148\u7ea7<br \/>\n        (StackType_t *)TASK2_STACK,               \/\/ \u4efb\u52a1\u5806\u6808\u6570\u7ec4<br \/>\n        (StaticTask_t *)&amp;task2_tcb                \/\/ \u4efb\u52a1\u63a7\u5236\u5757<br \/>\n    );<\/p>\n<p>    \/\/ \u4f7f\u7528xTaskCreateStatic\u9759\u6001\u521b\u5efa\u4efb\u52a13<br \/>\n    task3_handler &#061; xTaskCreateStatic(<br \/>\n        (TaskFunction_t)task3,                    \/\/ \u6307\u5411\u4efb\u52a1\u51fd\u6570\u7684\u6307\u9488<br \/>\n        (char *)&#034;task3&#034;,                          \/\/ \u4efb\u52a1\u540d\u79f0<br \/>\n        (uint32_t)TASK3_STACK_SIZE,               \/\/ \u4efb\u52a1\u5806\u6808\u5927\u5c0f<br \/>\n        (void *)NULL,                             \/\/ \u4f20\u9012\u7ed9\u4efb\u52a1\u51fd\u6570\u7684\u53c2\u6570<br \/>\n        (UBaseType_t)TASK3_PRIO,                  \/\/ \u4efb\u52a1\u4f18\u5148\u7ea7<br \/>\n        (StackType_t *)TASK3_STACK,               \/\/ \u4efb\u52a1\u5806\u6808\u6570\u7ec4<br \/>\n        (StaticTask_t *)&amp;task3_tcb                \/\/ \u4efb\u52a1\u63a7\u5236\u5757<br \/>\n    );<\/p>\n<p>    \/\/ \u5220\u9664\u8d77\u59cb\u4efb\u52a1\u81ea\u8eab&#xff08;\u4f20\u5165\u4efb\u52a1\u53e5\u67c4\u800c\u4e0d\u662fNULL&#xff09;<br \/>\n    vTaskDelete(start_task_handler);<\/p>\n<p>    \/\/ \u9000\u51fa\u4e34\u754c\u533a&#xff08;\u7531\u4e8e\u4e0a\u9762\u5df2\u7ecf\u5220\u9664\u4efb\u52a1&#xff0c;\u6b64\u8bed\u53e5\u4e0d\u4f1a\u6267\u884c&#xff0c;\u5b58\u5728\u903b\u8f91\u9519\u8bef&#xff09;<br \/>\n    taskEXIT_CRITICAL();<br \/>\n}<\/p>\n<p>\/**<br \/>\n * &#064;brief       \u4efb\u52a11\u51fd\u6570<br \/>\n * &#064;param       pvParameters &#8211; \u4efb\u52a1\u53c2\u6570&#xff08;\u672a\u4f7f\u7528&#xff09;<br \/>\n * &#064;retval      \u65e0<br \/>\n * \u529f\u80fd&#xff1a;\u63a7\u5236LED0\u6bcf500ms\u95ea\u70c1\u4e00\u6b21<br \/>\n *\/<br \/>\nvoid task1(void *pvParameters)<br \/>\n{<br \/>\n    while (1)<br \/>\n    {<br \/>\n        LED0_TOGGLE();   \/\/ LED0\u72b6\u6001\u7ffb\u8f6c<br \/>\n        vTaskDelay(500); \/\/ \u5ef6\u8fdf500ms&#xff08;FreeRTOS\u8282\u62cd&#xff09;<br \/>\n    }<br \/>\n}<\/p>\n<p>\/**<br \/>\n * &#064;brief       \u4efb\u52a12\u51fd\u6570<br \/>\n * &#064;param       pvParameters &#8211; \u4efb\u52a1\u53c2\u6570&#xff08;\u672a\u4f7f\u7528&#xff09;<br \/>\n * &#064;retval      \u65e0<br \/>\n * \u529f\u80fd&#xff1a;\u63a7\u5236LED1\u6bcf500ms\u95ea\u70c1\u4e00\u6b21<br \/>\n *\/<br \/>\nvoid task2(void *pvParameters)<br \/>\n{<br \/>\n    while (1)<br \/>\n    {<br \/>\n        LED1_TOGGLE();   \/\/ LED1\u72b6\u6001\u7ffb\u8f6c<br \/>\n        vTaskDelay(500); \/\/ \u5ef6\u8fdf500ms<br \/>\n    }<br \/>\n}<\/p>\n<p>\/**<br \/>\n * &#064;brief       \u4efb\u52a13\u51fd\u6570<br \/>\n * &#064;param       pvParameters &#8211; \u4efb\u52a1\u53c2\u6570&#xff08;\u672a\u4f7f\u7528&#xff09;<br \/>\n * &#064;retval      \u65e0<br \/>\n * \u529f\u80fd&#xff1a;\u68c0\u6d4b\u6309\u952eKEY0&#xff0c;\u6309\u4e0b\u5219\u5220\u9664task1\u4efb\u52a1<br \/>\n *\/<br \/>\nvoid task3(void *pvParameters)<br \/>\n{<br \/>\n    uint8_t key &#061; 0;<br \/>\n    while (1)<br \/>\n    {<br \/>\n        printf(&#034;task3\u6b63\u5728\u8fd0\u884c&#xff01;&#xff01;&#xff01;\\\\r\\\\n&#034;);  \/\/ \u8f93\u51fa\u8fd0\u884c\u63d0\u793a<\/p>\n<p>        key &#061; key_scan(0);  \/\/ \u626b\u63cf\u6309\u952e&#xff08;\u53c2\u65700\u8868\u793a\u4e0d\u652f\u6301\u8fde\u6309&#xff09;<\/p>\n<p>        if (key &#061;&#061; KEY0_PRES)  \/\/ \u5982\u679cKEY0\u6309\u4e0b<br \/>\n        {<br \/>\n            if (task1_handler !&#061; NULL)  \/\/ \u68c0\u67e5\u4efb\u52a11\u53e5\u67c4\u662f\u5426\u6709\u6548<br \/>\n            {<br \/>\n                printf(&#034;\u5220\u9664task1\u4efb\u52a1\\\\r\\\\n&#034;);<br \/>\n                vTaskDelete(task1_handler);  \/\/ \u5220\u9664\u4efb\u52a11<br \/>\n                task1_handler &#061; NULL;        \/\/ \u5c06\u53e5\u67c4\u7f6e\u4e3aNULL&#xff0c;\u9632\u6b62\u91cd\u590d\u5220\u9664<br \/>\n            }<br \/>\n        }<br \/>\n        vTaskDelay(10);  \/\/ \u5ef6\u8fdf10ms&#xff0c;\u63a7\u5236\u6309\u952e\u68c0\u6d4b\u9891\u7387<br \/>\n    }<br \/>\n}<\/p>\n<p>\u5b9e\u73b0\u529f\u80fd&#xff1a;\u9996\u5148\u521b\u5efa\u4e00\u4e2a\u8d77\u59cb\u4efb\u52a1\u6765\u521d\u59cb\u5316\u4e09\u4e2a\u529f\u80fd\u4efb\u52a1&#xff0c;\u5176\u4e2dtask1\u548ctask2\u5206\u522b\u63a7\u5236LED0\u548cLED1\u4ee5500ms\u95f4\u9694\u95ea\u70c1&#xff0c;\u5b9e\u73b0\u53cc\u706f\u4ea4\u66ff\u95ea\u70c1\u6548\u679c&#xff1b;task3\u5219\u76d1\u63a7\u6309\u952eKEY0\u7684\u6309\u4e0b\u4e8b\u4ef6&#xff0c;\u5e76\u5728\u68c0\u6d4b\u5230\u6309\u952e\u65f6\u52a8\u6001\u5220\u9664task1\u4efb\u52a1&#xff0c;\u6f14\u793a\u4e86\u8fd0\u884c\u65f6\u4efb\u52a1\u7ba1\u7406\u529f\u80fd\u3002\u6240\u6709\u4efb\u52a1\u7684\u4efb\u52a1\u63a7\u5236\u5757\u548c\u6808\u7a7a\u95f4\u5747\u91c7\u7528\u9759\u6001\u5206\u914d\u65b9\u5f0f&#xff0c;\u7531\u7528\u6237\u9884\u5148\u5b9a\u4e49\u6570\u7ec4\u548c\u7ed3\u6784\u4f53&#xff0c;\u540c\u65f6\u5b9e\u73b0\u4e86\u7a7a\u95f2\u4efb\u52a1\u548c\u5b9a\u65f6\u5668\u4efb\u52a1\u7684\u5185\u5b58\u5206\u914d\u63a5\u53e3\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1 \u4efb\u52a1\u521b\u5efa\u4e0e\u5220\u9664\u7684\u57fa\u672c\u6982\u5ff5\u4efb\u52a1\u521b\u5efa&#xff1a;\u5728FreeRTOS\u4e2d\u521b\u5efa\u4efb\u52a1&#xff0c;\u672c\u8d28\u4e0a\u662f\u8c03\u7528\u76f8\u5e94\u7684API\u51fd\u6570&#xff0c;\u5206\u914d\u4efb\u52a1\u63a7\u5236\u5757&#xff08;TCB&#xff09;\u548c\u4efb\u52a1\u6808\u7a7a\u95f4\u3002<br \/>\n\u4efb\u52a1\u5220\u9664&#xff1a;\u79fb\u9664\u4efb\u52a1\u4ece\u5c31\u7eea\u3001\u963b\u585e\u3001\u6302\u8d77\u548c\u4e8b\u4ef6\u5217\u8868\u4e2d&#xff0c;\u91ca\u653e\u76f8\u5173\u5185\u5b58&#xff08;\u52a8\u6001\u521b\u5efa\u65f6\u7531\u7a7a\u95f2\u4efb\u52a1\u5904\u7406&#xff09;\u30022 \u4efb\u52a1\u521b\u5efa\u4e0e\u5220\u9664\u7684API\u51fd\u6570xTaskCreate()&#xff1a;\u52a8\u6001\u521b\u5efa\u4efb\u52a1&#xff0c;\u5185\u5b58\u7531FreeRTOS\u5806<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[217,270,269],"topic":[],"class_list":["post-72254","post","type-post","status-publish","format-standard","hentry","category-server","tag-stm32","tag-270","tag-269"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>FreeRTOS\u4efb\u52a1\u521b\u5efa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/72254.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"FreeRTOS\u4efb\u52a1\u521b\u5efa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"1 \u4efb\u52a1\u521b\u5efa\u4e0e\u5220\u9664\u7684\u57fa\u672c\u6982\u5ff5\u4efb\u52a1\u521b\u5efa&#xff1a;\u5728FreeRTOS\u4e2d\u521b\u5efa\u4efb\u52a1&#xff0c;\u672c\u8d28\u4e0a\u662f\u8c03\u7528\u76f8\u5e94\u7684API\u51fd\u6570&#xff0c;\u5206\u914d\u4efb\u52a1\u63a7\u5236\u5757&#xff08;TCB&#xff09;\u548c\u4efb\u52a1\u6808\u7a7a\u95f4\u3002 \u4efb\u52a1\u5220\u9664&#xff1a;\u79fb\u9664\u4efb\u52a1\u4ece\u5c31\u7eea\u3001\u963b\u585e\u3001\u6302\u8d77\u548c\u4e8b\u4ef6\u5217\u8868\u4e2d&#xff0c;\u91ca\u653e\u76f8\u5173\u5185\u5b58&#xff08;\u52a8\u6001\u521b\u5efa\u65f6\u7531\u7a7a\u95f2\u4efb\u52a1\u5904\u7406&#xff09;\u30022 \u4efb\u52a1\u521b\u5efa\u4e0e\u5220\u9664\u7684API\u51fd\u6570xTaskCreate()&#xff1a;\u52a8\u6001\u521b\u5efa\u4efb\u52a1&#xff0c;\u5185\u5b58\u7531FreeRTOS\u5806\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/72254.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-05T00:33:34+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/72254.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/72254.html\",\"name\":\"FreeRTOS\u4efb\u52a1\u521b\u5efa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-05T00:33:34+00:00\",\"dateModified\":\"2026-02-05T00:33:34+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/72254.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/72254.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/72254.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FreeRTOS\u4efb\u52a1\u521b\u5efa\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"FreeRTOS\u4efb\u52a1\u521b\u5efa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/72254.html","og_locale":"zh_CN","og_type":"article","og_title":"FreeRTOS\u4efb\u52a1\u521b\u5efa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"1 \u4efb\u52a1\u521b\u5efa\u4e0e\u5220\u9664\u7684\u57fa\u672c\u6982\u5ff5\u4efb\u52a1\u521b\u5efa&#xff1a;\u5728FreeRTOS\u4e2d\u521b\u5efa\u4efb\u52a1&#xff0c;\u672c\u8d28\u4e0a\u662f\u8c03\u7528\u76f8\u5e94\u7684API\u51fd\u6570&#xff0c;\u5206\u914d\u4efb\u52a1\u63a7\u5236\u5757&#xff08;TCB&#xff09;\u548c\u4efb\u52a1\u6808\u7a7a\u95f4\u3002 \u4efb\u52a1\u5220\u9664&#xff1a;\u79fb\u9664\u4efb\u52a1\u4ece\u5c31\u7eea\u3001\u963b\u585e\u3001\u6302\u8d77\u548c\u4e8b\u4ef6\u5217\u8868\u4e2d&#xff0c;\u91ca\u653e\u76f8\u5173\u5185\u5b58&#xff08;\u52a8\u6001\u521b\u5efa\u65f6\u7531\u7a7a\u95f2\u4efb\u52a1\u5904\u7406&#xff09;\u30022 \u4efb\u52a1\u521b\u5efa\u4e0e\u5220\u9664\u7684API\u51fd\u6570xTaskCreate()&#xff1a;\u52a8\u6001\u521b\u5efa\u4efb\u52a1&#xff0c;\u5185\u5b58\u7531FreeRTOS\u5806","og_url":"https:\/\/www.wsisp.com\/helps\/72254.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-05T00:33:34+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/72254.html","url":"https:\/\/www.wsisp.com\/helps\/72254.html","name":"FreeRTOS\u4efb\u52a1\u521b\u5efa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-05T00:33:34+00:00","dateModified":"2026-02-05T00:33:34+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/72254.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/72254.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/72254.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"FreeRTOS\u4efb\u52a1\u521b\u5efa"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/72254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=72254"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/72254\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=72254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=72254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=72254"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=72254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}