{"id":288326,"date":"2018-08-21T18:30:02","date_gmt":"2018-08-21T14:30:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=288326"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=288326","title":{"rendered":"\u0421++ \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u0434\u043b\u044f \u00ab\u0432\u0441\u0435\u0445\u00bb \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0421\u0438\u0441\u0442\u0435\u043c \u0420\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0412\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u043b\u044f CortexM4"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/420467\/\" class=\"post__text post__text-html js-mediator-article\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/s0\/2o\/ve\/s02ovegatxm9x39z6c8x_5fydki.png\" alt=\"image\"><\/p>\n<p>  \u042f \u0443\u0436\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c FreeRtos \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0421++ \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/habr.com\/post\/261807\/\">STM32, C++ \u0438 FreeRTOS. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441 \u043d\u0443\u043b\u044f. \u0427\u0430\u0441\u0442\u044c 1<\/a>. \u0421 \u0442\u0435\u0445 \u043f\u043e\u0440 \u043f\u0440\u043e\u0448\u043b\u043e \u0446\u0435\u043b\u044b\u0445 3 \u0433\u043e\u0434\u0430, \u044f \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0440\u0435\u043b, \u043f\u043e\u0442\u0435\u0440\u044f\u043b \u043a\u0443\u0447\u0443 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0432\u044f\u0437\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0438\u043b \u0432\u0441\u0442\u0440\u044f\u0445\u043d\u0443\u0442\u044c \u0441\u0442\u0430\u0440\u0438\u043d\u043e\u0439 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u0438 \u0441\u0432\u044f\u0437\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438 \u0437\u0430\u043c\u0430\u0445\u043d\u0443\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u0434\u043b\u044f \u00ab\u043b\u044e\u0431\u043e\u0439\u00bb \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0439 \u041e\u0421\u0420\u0412. \u042d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0448\u0443\u0442\u043a\u0430, \u044f \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0432\u0437\u044f\u043b \u00ab\u0432\u0441\u0435\u0445\u00bb \u0432 \u043a\u0430\u0432\u044b\u0447\u043a\u0438, \u043d\u043e \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0448\u0443\u0442\u043a\u0435 \u0435\u0441\u0442\u044c \u0434\u043e\u043b\u044f \u043f\u0440\u0430\u0432\u0434\u044b. <br \/>  <a name=\"habracut\"><\/a> <br \/>  \u0418\u0442\u0430\u043a, \u0432 \u0447\u0435\u043c \u0436\u0435 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u0432\u043e\u043e\u0431\u0449\u0435 \u043e\u043d\u0430 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430. \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0435\u0441\u0442\u044c \u043c\u0438\u043b\u043b\u0438\u043e\u043d \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0421\u0438 \u2014 \u0432\u044b\u0431\u0438\u0440\u0430\u0439 \u043d\u0435 \u0445\u043e\u0447\u0443 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0432\u043a\u0443\u0441, \u043f\u043b\u0430\u0442\u043d\u0430\u044f, \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u0430\u044f, \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f, \u0431\u043e\u043b\u044c\u0448\u0430\u044f\u2026 \u041d\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044f \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u0432\u0441\u0435 \u044d\u0442\u0438 \u0444\u0438\u0448\u043a\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0437\u0430\u0434\u0430\u0447\u0430, \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0437\u0430\u0434\u0430\u0447, \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0435\u043a\u0446\u0438\u044f, \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u044b \u0438 \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u044b (\u0445\u043e\u0442\u044f \u044f \u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0438\u0445 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c), \u043e\u0447\u0435\u0440\u0435\u0434\u0438. \u041f\u0440\u0438\u0447\u0435\u043c \u0432\u0441\u0435 \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0432 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0432\u0438\u0434\u0435, \u0431\u0435\u0437 \u043e\u0441\u043e\u0431\u044b\u0445 \u043d\u0430\u0432\u043e\u0440\u043e\u0442\u043e\u0432. <\/p>\n<p>  \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043c\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043e\u0442\u0435\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f <a href=\"https:\/\/habr.com\/post\/336308\/\"><b>\u041e\u0421\u0420\u0412 \u041c\u0410\u041a\u0421<\/b><\/a>, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u0421++ \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0435\u0439 \u043e\u0434\u043d\u043e \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435. <\/p>\n<p>  \u041d\u043e \u0437\u0430\u0433\u0432\u043e\u0437\u0434\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430\u0448\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 IEC_61508, \u043e\u0434\u043d\u043e \u0438\u0437 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0437\u0432\u0443\u0447\u0438\u0442, \u043a\u0430\u043a <i>E.29 Application of proven-in-use target library<\/i>. \u041d\u0443 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0435\u0441\u043b\u0438 \u0432\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0443\u0440\u043e\u0432\u043d\u044e <u>SIL3<\/u>, \u0442\u043e \u0431\u0443\u0434\u044c\u0442\u0435 \u0434\u043e\u0431\u0440\u044b (Higher Recommended) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u044d\u0442\u043e\u043c\u0443 \u0443\u0440\u043e\u0432\u043d\u044e \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u044b \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c. <\/p>\n<p>  \u041a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <b>\u041e\u0421\u0420\u0412 \u041c\u0410\u041a\u0421<\/b> \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u043c\u043e\u0436\u043d\u043e, \u043d\u043e \u0431\u0430\u043b\u044b \u0437\u0430 \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u043f\u0440\u0438\u0431\u0430\u0432\u044f\u0442\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0438 \u041e\u0421\u0420\u0412 \u0434\u0435\u043b\u0430\u044e\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u0432\u043e\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043a \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u043c IEC_61508, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <i>FreeRTOS <\/i>\u0438\u043c\u0435\u0435\u0442 \u043a\u043b\u043e\u043d\u0430 <i>SafeRTOS<\/i>, \u0430 <i>embOs<\/i> \u0438\u043c\u0435\u0435\u0442 \u043a\u043b\u043e\u043d\u0430 <i>embOS-Safe<\/i>, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0438 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u0437\u0430\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442, \u0432\u0435\u0434\u044c \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0438 \u043d\u0430 \u044d\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0438 \u0441\u0442\u043e\u044f\u0442 \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u044b\u0441\u044f\u0447, \u0430 \u0442\u043e \u0438 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0442\u044b\u0441\u044f\u0447 \u0434\u043e\u043b\u043b\u0430\u0440\u043e\u0432. <\/p>\n<p>  \u041a\u0441\u0442\u0430\u0442\u0438, \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 IAR, \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u044f \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 1500 \u0434\u043e\u043b\u043b\u0430\u0440\u043e\u0432, \u0437\u0430\u0442\u043e IAR Certified versions \u0441\u0442\u043e\u0438\u0442 \u0443\u0436\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 10000 \u0431\u0430\u043a\u0441\u043e\u0432, \u0445\u043e\u0442\u044f \u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u2014 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0444\u0430\u0439\u043b \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u0435\u0437 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u0438 \u0441 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b. \u041d\u0443 \u0432\u044b \u043f\u043e\u043d\u044f\u043b\u0438, \u0447\u0442\u043e \u0437\u0430 \u0441\u043f\u043e\u043a\u043e\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043b\u0430\u0442\u0438\u0442\u044c. <\/p>\n<p>  \u0422\u0430\u043a \u0432\u043e\u0442, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 <i>\u043e\u0434\u043d\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443<\/i>, \u043f\u043e\u0442\u043e\u043c \u044f \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u043d\u0443\u0436\u0434 \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <i>FreeRTOS<\/i>, \u043f\u043e\u0442\u043e\u043c \u043c\u044b \u043f\u0435\u0440\u0435\u0448\u043b\u0438 \u043d\u0430 <i>\u0434\u0440\u0443\u0433\u0443\u044e<\/i>, \u0432 \u043e\u0431\u0449\u0435\u043c, \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043a\u043e\u0434. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e, \u0447\u0442\u043e\u0431\u044b \u043b\u044e\u0431\u043e\u043c\u0443 \u0431\u044b\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043f\u043e \u043a\u043e\u0434\u0443, \u0447\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0442\u043e\u0433\u0434\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u0434\u043b\u044f \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u0438\u043a\u043e\u0432 \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430\u043d\u0442\u0438\u043a\u043e\u0432, \u0430 \u0433\u0443\u0440\u0443 \u0441\u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430\u0434 \u0438\u043d\u043d\u043e\u0432\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c, \u0430 \u043d\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0433\u0440\u0443\u0434\u0435 \u043b\u0430\u043f\u0448\u044b. \u0412 \u043e\u0431\u0449\u0435\u043c \u0445\u043e\u0447\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432\u043e\u0442 \u0442\u0430\u043a\u0430\u044f \u0444\u043e\u0441\u0441\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u044f:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/rc\/2z\/_k\/rc2z_kzdcpu6isdhwojtbbi4wac.png\" alt=\"image\"><\/p>\n<p>  \u041d\u0443 \u0438\u043b\u0438 \u0432\u043e\u0442 \u0442\u0430\u043a\u0430\u044f\u2026<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wr\/y9\/3t\/wry93tatnwwg44s40ohc5w0khre.png\" alt=\"image\"><\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u0435\u0440\u0442\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434\u043e\u0448\u043b\u0430 \u0431\u044b \u043a\u0430\u043a <i>FreeRTOS<\/i>, \u0442\u0430\u043a \u0438 \u0441\u043a\u0430\u0436\u0435\u043c <i>embOS<\/i> \u043d\u0443 \u0438 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u043e\u0436\u0435 \ud83d\ude42 \u0438 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b \u0447\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0441\u0447\u0430\u0441\u0442\u044c\u044f:   <\/p>\n<ul>\n<li> \u0417\u0430\u0434\u0430\u0447\u0438<\/li>\n<li> \u041a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0435\u043a\u0446\u0438\u0438<\/li>\n<li> \u0421\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0437\u0430\u0434\u0430\u0447<\/li>\n<li> \u0421\u0435\u043c\u0430\u0444\u043e\u0440\u044b \u0438 \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u044b<\/li>\n<li> \u041e\u0447\u0435\u0440\u0435\u0434\u0438<\/li>\n<\/ul>\n<p>  \u041e\u0431\u0435\u0440\u0442\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c <u>SIL3<\/u> \u0438\u0434\u0435\u0439\u043d\u043e\u0439, \u0430 \u044d\u0442\u043e\u0442 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043d\u0443 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u0441\u044f\u043a\u0438\u0445 High Recommended \u0432\u0435\u0449\u0435\u0439, \u0438 \u0435\u0441\u043b\u0438 \u0438\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c, \u0442\u043e \u0432\u044b\u0439\u0434\u0435\u0442, \u0447\u0442\u043e \u043a\u043e\u0434 \u043b\u0443\u0447\u0448\u0435 \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u043e\u043e\u0431\u0449\u0435.<br \/>  \u041d\u043e \u0442\u043e, \u0447\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0440\u0435\u0433\u043b\u0430\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u043a\u0443\u0447\u0443 \u043f\u0440\u0430\u0432\u0438\u043b, \u0442\u043e\u0447\u043d\u0435\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439, \u044d\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0438\u0445 \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0430\u0440\u0443\u0448\u0430\u0442\u044c \u2014 \u043c\u043e\u0436\u043d\u043e, \u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0431\u0430\u043b\u043b\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0441\u044f \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u0430\u0436\u043d\u044b\u043c\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c:   <\/p>\n<ul>\n<li><b>\u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u0432<\/b>, \u043d\u0443 \u043a\u0440\u043e\u043c\u0435 \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 \u0434\u0432\u043e\u0439\u043d\u043e\u0433\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432. \u041c\u0430\u043a\u0440\u043e\u0441\u044b \u044d\u0442\u043e \u0437\u043b\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u0442\u0440\u0430\u0447\u0435\u043d\u043e \u043d\u0430 \u043f\u043e\u0438\u0441\u043a \u043e\u0448\u0438\u0431\u043e\u043a \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043c\u0430\u043a\u0440\u043e\u0441\u0430\u043c\u0438, \u0442\u043e \u0432\u044b\u0439\u0434\u0435\u0442, \u0447\u0442\u043e \u0432\u0441\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0438 \u0441\u0442\u0430\u0440\u0430, \u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u043b\u0443\u0447\u0448\u0435 \u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0434\u043e \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u0437\u0430\u043a\u043e\u043d\u043e\u0434\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435, \u043a\u0430\u043a \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u043b\u0438 \u0442\u043e\u0440\u0440\u0435\u043d\u0442\u044b \u0438\u043b\u0438 \u043e\u0442\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u0440\u0435\u043c\u0438\u044e \u0437\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u043a\u0440\u043e\u0441 <\/li>\n<li><b>\u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438<\/b>, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445, \u043d\u043e \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u0435\u0441\u0442\u044c \u043c\u0435\u0441\u0442\u0430 \u0433\u0434\u0435 \u0431\u0435\u0437 \u043d\u0438\u0445 \u043d\u0438\u043a\u0430\u043a. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043e\u0431\u0435\u0440\u0442\u043a\u0438, \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043e\u043e\u0431\u0449\u0435 \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u043e \u043d\u0438\u0445 \u043e\u043d \u0441\u043b\u044b\u0448\u0430\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u0441\u0432\u043e\u0435\u0433\u043e \u0434\u0435\u0434\u0443\u0448\u043a\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441 \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438 <\/li>\n<li> <b>\u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438<\/b> \u2014 \u0442\u0443\u0442 \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0443\u0447\u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u041e\u0417\u0423 \u043f\u043e\u0434 \u044d\u0442\u0443 \u043a\u0443\u0447\u0443, \u0430 \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043f\u0440\u0438 \u0447\u0430\u0441\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u0443\u0447\u0438 \u043e\u043d\u0430 \u0434\u0435\u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u043d\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0430 \u043d\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0434\u043e\u043b\u044c\u0448\u0435 \u0438 \u0434\u043e\u043b\u044c\u0448\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 <i>FreeRTOS<\/i> \u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0432 <i>configSUPPORT_STATIC_ALLOCATION 1<\/i>. \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0410 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e <i>FreeRTOS<\/i> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c, \u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c <i> configSUPPORT_STATIC_ALLOCATION 0<\/i>, \u0430 <br \/>  <i> configSUPPORT_DYNAMIC_ALLOCATION 1<\/i> \u0438 \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043c\u0430\u043b\u043b\u043e\u043a\u043e\u0432 \u0438 \u043a\u0430\u043b\u043b\u043e\u043a\u043e\u0432 \u0438\u0437 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 \u043f\u0430\u043c\u044f\u0442\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043e\u0442 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b FreeRtos\/portable\/MemMang\/heap_1.c. \u041d\u043e \u0443\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e\u0434 \u043a\u0443\u0447\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0438 \u041e\u0417\u0423 \u0441 \u0437\u0430\u043f\u0430\u0441\u043e\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u0442\u043e\u0447\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u041e\u0417\u0423 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0430\u043c \u043d\u0435 \u0443\u0434\u0430\u0441\u0442\u0441\u044f, \u0443 \u043c\u0435\u043d\u044f \u043f\u0440\u0438 \u0432\u0441\u0435\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 (Idle \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b, \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0445 \u0442\u0430\u0439\u043c\u0435\u0440\u043e\u0432 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430, \u043c\u043e\u0438 \u0434\u0432\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u043e\u0447\u0435\u0440\u0435\u0434\u0438, \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0434\u043b\u044f \u0442\u0430\u0439\u043c\u0435\u0440\u043e\u0432 10 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435, \u0441\u043a\u0430\u0436\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e \u0442\u043e\u0447\u043d\u043e \u043d\u0435 \u0441\u0430\u043c\u044b\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438) \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043a\u043e\u0433\u0434\u0430 \u044f \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u043f\u0430\u043c\u044f\u0442\u0438 \u0432\u043e\u0442 \u0442\u0430\u043a:<br \/> <br \/>\n<blockquote><p> 7 357 bytes of readonly code memory<br \/>   535 bytes of readonly data memory<br \/>   6 053 bytes of readwrite data memory<\/p><\/blockquote>\n<p>  \u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u00ab\u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e\u00bb \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u0435\u0435:  <\/p>\n<blockquote><p> 7 329 bytes of readonly code memory<br \/>   535 bytes of readonly data memory<br \/>   3 877 bytes of readwrite data memory<\/p><\/blockquote>\n<p>  \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0434\u0443\u043c\u0430\u0435\u0442\u0435, \u00ab\u043e\u0433\u043e\u0433\u043e\u2026 \u0441\u0435\u0431\u0435\u00bb, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u0441 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441, \u0441\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/habr.com\/post\/352782\/\"> \u00ab\u042f \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u0446\u0435\u043b\u044b\u0445 3\u041a\u0411 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b \u0432\u0441\u0435\u0433\u043e 3 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u043e \u0441\u0442\u0435\u043a\u043e\u043c \u043f\u043e 128\u0411, \u0430 \u043d\u0430 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0443\u044e \u0443\u0436\u0435 \u043f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043f\u0430\u043c\u044f\u0442\u0438\u00bb <\/a>, \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u044f \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e, \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445.  <\/li>\n<li> <b>\u043d\u0435 \u043a\u0430\u0441\u0442\u0438\u0442\u044c \u0442\u0438\u043f\u044b<\/b>, \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u041f\u0440\u0438\u0432\u0438\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u043a \u0434\u0440\u0443\u0433\u0438\u043c \u0442\u0438\u043f\u0430\u043c \u0443\u0436\u0435 \u0441\u0430\u043c\u043e \u043f\u043e \u0441\u0435\u0431\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0432 \u0434\u0438\u0437\u0430\u0439\u043d\u0435 \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u0442\u0430\u043a, \u043d\u043e \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e \u0431\u044b\u0432\u0430\u0435\u0442, \u0438\u043d\u043e\u0433\u0434\u0430 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u0430\u0441\u0442\u0438\u0442\u044c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, enum \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c ), \u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e, \u043d\u043e \u043d\u0430\u0434\u043e \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c.<\/li>\n<li><b>\u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0438 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e<\/b>. \u0414\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043e\u0431\u0435\u0440\u0442\u043a\u0438, \u0432\u0441\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0441\u043a\u0440\u044b\u0442\u044b, \u0443 \u043d\u0435\u0433\u043e \u0438\u0442\u0430\u043a \u0436\u0438\u0437\u043d\u044c \u043d\u0435 \u043c\u0430\u0441\u043b\u043e, \u0438 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u0435\u043c\u0443 \u0435\u0451 \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0442\u044c \u2014 \u0441\u043e\u0437\u0434\u0430\u043b \u0437\u0430\u0434\u0430\u0447\u0443, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 \u0432 \u043d\u0435\u0439 \u0432\u0441\u0435 \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b \u0438 \u0443\u0448\u0435\u043b \u0440\u0430\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0436\u0438\u0437\u043d\u0438.<\/li>\n<\/ul>\n<p>. <br \/>   \u0421 \u044d\u0442\u043e\u0433\u043e \u0438 \u043d\u0430\u0447\u043d\u0435\u043c, \u0438\u0442\u0430\u043a \u0441\u0442\u0430\u0432\u0438\u043c \u043f\u0435\u0440\u0435\u0434 \u0441\u043e\u0431\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0443 \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 (\u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0441\u0435\u0440\u0438\u0438 \u00ab\u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u043e \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0442\u044c\u00bb).<\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>  \u041f\u0443\u0442\u0435\u043c \u0434\u043e\u043b\u0433\u0438\u0445 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439, \u0432\u0435\u043b\u0438\u043a\u043e\u0431\u0440\u0438\u0442\u0430\u043d\u0441\u043a\u0438\u0435 \u0443\u0447\u0435\u043d\u044b\u0435 (<a href=\"https:\/\/habr.com\/post\/415427\/\">\u0412\u0441\u044f \u043f\u0440\u0430\u0432\u0434\u0430 \u043e\u0431 \u041e\u0421\u0420\u0412 \u043e\u0442 \u041a\u043e\u043b\u0438\u043d\u0430 \u0423\u043e\u043b\u043b\u0441\u0430. \u0421\u0442\u0430\u0442\u044c\u044f #4. \u0417\u0430\u0434\u0430\u0447\u0438, \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f<\/a>) (\u043a\u0441\u0442\u0430\u0442\u0438, \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0437\u043d\u0430\u043b\u0438, \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440 \u0434\u043b\u044f ARM \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b\u0430 \u0442\u043e\u0436\u0435 \u0432\u0435\u043b\u0438\u043a\u043e\u0431\u0440\u0438\u0442\u0430\u043d\u0441\u043a\u0430\u044f \u0443\u0447\u0435\u043d\u0430\u044f, \u0447\u0442\u043e-\u0442\u043e \u044f \u0438 \u043d\u0435 \u0443\u0434\u0438\u0432\u0438\u043b\u0441\u044f \u043d\u0438 \u0440\u0430\u0437\u0443 \ud83d\ude42 ), \u0442\u0430\u043a \u0432\u043e\u0442 \u0432\u0435\u043b\u0438\u043a\u043e\u0431\u0440\u0438\u0442\u0430\u043d\u0441\u043a\u0438\u0435 \u0443\u0447\u0435\u043d\u044b\u0435 \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438, \u0447\u0442\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u00ab\u0432\u0441\u0435\u0445\u00bb \u041e\u0421\u0420\u0412 \u0443 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u043c\u0435\u0435\u0442\u0441\u044f <i>\u0438\u043c\u044f<\/i>, <i>\u0441\u0442\u0435\u043a<\/i>, <i>\u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0435\u043a\u0430<\/i>, <i>\u00ab\u0431\u043b\u043e\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u00bb<\/i>, <i>\u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0438\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u00ab\u0431\u043b\u043e\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u00bb<\/i>, <i>\u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442<\/i>, <i>\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0434\u0430\u0447\u0435<\/i>. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0441\u0435, \u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u0441\u0435 \u044d\u0442\u043e \u0437\u0430\u043f\u0438\u0445\u0430\u0442\u044c \u0432 \u043a\u043b\u0430\u0441\u0441, \u043d\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u043f\u0438\u0441\u0430\u043b\u0438 \u0441 \u0432\u0430\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0443, \u043d\u043e \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u043e\u0431\u0435\u0440\u0442\u043a\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043e\u0431\u0435\u0440\u0442\u043a\u0435 \u0432\u0441\u0435 \u044d\u0442\u0438 \u0432\u0435\u0449\u0438 \u0441\u043c\u044b\u0441\u043b\u0430 \u043d\u0435\u0442, \u0432\u0441\u0435 \u044d\u0442\u043e \u0437\u0430 \u0432\u0430\u0441 \u0441\u0434\u0435\u043b\u0430\u0435\u0442<u> SIL3<\/u> \u0438\u0434\u0435\u0439\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c. \u041f\u043e \u0441\u0443\u0442\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e <i>\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0434\u0430\u0447\u0435<\/i> \u0438 <i>\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0445\u0440\u0430\u043d\u044f\u0449\u0430\u044f \u00ab\u0431\u043b\u043e\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u00bb <\/i>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 <i>\u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u0434\u0430\u0447\u0438<\/i>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0441 \u0437\u0430\u0434\u0430\u0447\u0438, \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e <i>Thread<\/i> \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<pre><code class=\"cpp\"> class Thread  {     public:       virtual void Execute() = 0 ;         private:       tTaskHandle taskHandle ;       tTaskContext context ;   } ; <\/code><\/pre>\n<p>  \u0425\u043e\u0447\u0435\u0442\u0441\u044f \u0447\u0442\u043e\u0431\u044b \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u043b \u043a\u043b\u0430\u0441\u0441 \u043c\u043e\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u0433\u0434\u0435 \u0441\u043c\u043e\u0433 \u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u0432\u0441\u0435 \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438 \u043f\u043e\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u043b \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043e\u0431\u0435\u0440\u0442\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438 \u0441\u043e\u0437\u0434\u0430\u043b\u0430 \u0431\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e API \u041e\u0421\u0420\u0412 \u0437\u0430\u0434\u0430\u0447\u0443, \u0433\u0434\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0430 \u0431\u044b \u043c\u0435\u0442\u043e\u0434 <i>Execute()<\/i>:<\/p>\n<pre><code class=\"cpp\">class MyTask : public Thread { public:    virtual void Execute() override {        while(true) {        \/\/do something..       }      } ; using tMyTaskStack = std::array&lt;OsWrapper::tStack,                       static_cast&lt;tU16&gt;(OsWrapper::StackDepth::minimal)&gt; ;   inline static tMyTaskStack Stack;  \/\/!C++17 } ;  MyTask myDesiredTask int main() {   Rtos::CreateThread(myTask, MyTask::Stack.data(), \"myTask\") ; }<\/code><\/pre>\n<p>  \u0412\u043e \u00ab\u0432\u0441\u0435\u0445\u00bb \u041e\u0421\u0420\u0412, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0437\u0434\u0430\u043b\u0430\u0441\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u043c. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>Execute()<\/i>, \u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u044f \u043d\u0435 \u043c\u043e\u0433\u0443, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043d\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0432 API \u00ab\u0432\u0441\u0435\u0445\u00bb \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043e\u043a \u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u0435\u043c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f <i>embOS<\/i> \u044d\u0442\u043e: <\/p>\n<pre><code class=\"cpp\">void OS_TASK_CreateEx( OS_TASK* pTask,  const char* pName,  OS_PRIO Priority,         void (*pRoutine)(void * pVoid ), void OS_STACKPTR *pStack,  OS_UINT StackSize, OS_UINT TimeSlice, void* pContext); <\/code><\/pre>\n<p>  <b>void* pContext<\/b> \u2014 \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u043a\u043b\u044e\u0447 \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e. \u041f\u0443\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0435\u0442\u043e\u0434, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u043c\u0435\u0442\u043e\u0434, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u043c, \u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 <i>Thread<\/i> \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <i>Execute()<\/i> \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. \u042d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a \u0442\u0438\u043f\u0430\u043c \u043d\u0438\u043a\u0430\u043a, \u043d\u043e \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u0440\u044b\u0442 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre><code class=\"cpp\">static void Run(void *pContext ) {    static_cast&lt;Thread*&gt;(pContext)-&gt;Execute() ;  }<\/code><\/pre>\n<p>  \u0422.\u0435. \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0430\u043a\u043e\u0439, \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 <i>Run<\/i>, \u0432 \u043c\u0435\u0442\u043e\u0434 <i>Run<\/i> \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 <i>Thread<\/i>. \u0412 \u043c\u0435\u0442\u043e\u0434\u0435 <i>Run<\/i> \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <i>Execute()<\/i>, \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 <i>Thread<\/i>, \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0439\u0441\u044f \u043a\u0430\u043a \u0440\u0430\u0437 \u043d\u0430\u0448\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<p>  \u0417\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u0447\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b. \u0412\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0438 \u0438\u043c\u0435\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 API, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u043b\u044f <i>embOS<\/i> \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 void <i>OS_TASK_CreateEx(..)<\/i>, \u0430 \u0434\u043b\u044f <i>FreeRTOS<\/i> \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u2014 \u044d\u0442\u043e <i>xTaskCreate(..)<\/i> \u0438 \u0445\u043e\u0442\u044f \u0441\u0443\u0442\u044c \u0443 \u043d\u0438\u0445 \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435, \u043d\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0440\u0430\u0437\u043d\u044b\u0435. \u041c\u044b \u0436\u0435 \u043d\u0435 \u0445\u043e\u0442\u0438\u043c, \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0438 \u0431\u0435\u0433\u0430\u0442\u044c \u043f\u043e \u0444\u0430\u0439\u043b\u0430\u043c \u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a \u0442\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u044d\u0442\u043e \u0432 \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b \u0438\u2026 \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u0432. \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u043d\u043e \u0441\u0442\u043e\u043f, \u043c\u0430\u043a\u0440\u043e\u0441\u044b \u0436\u0435 \u044f \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u043b \u0441\u0430\u043c \u0441\u0435\u0431\u0435 \u2014 \u043d\u0443\u0436\u0435\u043d \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434.<\/p>\n<p>  \u0421\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e \u043c\u043d\u0435 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443, \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0438 \u0441 inline \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438. \u0415\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0434\u0440\u0443\u0433\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0443, \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u0443\u044e \u0438\u0437 \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f API \u044d\u0442\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0438. \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0430\u0439\u043b <b>rtosFreeRtos.cpp<\/b><\/p>\n<pre><code class=\"cpp\">#include \"rtos.hpp\"  \/\/For  FreeRTOS functions  prototypes #include &lt;FreeRTOS.h&gt;       \/\/For xTaskCreate  #include &lt;task.h&gt; namespace OsWrapper {      void wCreateThread(Thread &amp; thread, const char * pName,                             ThreadPriority prior,const tU16 stackDepth,                              tStack *pStack)  { #if (configSUPPORT_STATIC_ALLOCATION == 1)   if (pStack != nullptr)  {     thread.handle = xTaskCreateStatic(static_cast&lt;TaskFunction_t&gt;(Rtos::Run),                                            pName,                                            stackDepth,                                            &amp;thread,                                            static_cast&lt;uint32_t&gt;(prior),                                            pStack,                                            &amp;thread.taskControlBlock);   } #else     thread.handle =  (xTaskCreate(static_cast&lt;TaskFunction_t&gt;(Rtos::Run),                         pName, stackDepth, &amp;thread, static_cast&lt;uint32_t&gt;(prior),                         &amp;thread.handle) == pdTRUE) ?  thread.handle : nullptr ; #endif   } <\/code><\/pre>\n<p>  \u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0438 \u0444\u0430\u0439\u043b \u0434\u043b\u044f embOS <b>rtosEmbOS.cpp<\/b><\/p>\n<pre><code class=\"cpp\">#include \"rtos.hpp\"  \/\/For  embOS functions  prototypes #include &lt;rtos.h&gt;       namespace OsWrapper {   void wCreateThread(Thread &amp;thread, const char * pName,                              ThreadPriority prior,const tU16 stackDepth,                              tStack *pStack)  {    constexpr OS_UINT timeSliceNull = 0 ;     if (pStack != nullptr)  {        OS_CreateTaskEx(&amp;(thread.handle),                            pName,                            static_cast&lt;OS_PRIO&gt;(prior),                            Rtos::Run,                           pStack,                           ((stackSize == 0U) ? sizeof(pStack) : stackSize),                            timeSliceNull,                           &amp;thread) ;     }        }<\/code><\/pre>\n<p>  \u0422\u0438\u043f\u044b \u0443 \u0440\u0430\u0437\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043e\u043a \u0442\u043e\u0436\u0435 \u0440\u0430\u0437\u043d\u044b\u0435, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0437\u0430\u0434\u0430\u0447, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b rtosdefs.hpp \u0441 \u043d\u0430\u0448\u0438\u043c\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u0431\u0435\u0440\u0442\u043e\u0447\u043d\u044b\u043c\u0438 \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u0430\u043c\u0438.<\/p>\n<pre><code class=\"cpp\"> #include &lt;FreeRTOS.h&gt;      \/\/For TaskHandle_t  namespace OsWrapper {   using tTaskContext = StaticTask_t;   using tTaskHandle = TaskHandle_t;   using tStack = StackType_t ;   } <\/code><\/pre>\n<p>  \u0414\u043b\u044f <i>EmbOS<\/i> \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">#include &lt;rtos.h&gt;      \/\/For OS_TASK  namespace OsWrapper {   using tTaskContext = OS_TASK;   using tTaskHandle = OS_TASK;   using tStack = tU16 \/\/ \u0432\u043e\u043e\u0431\u0449\u0435 \u043e\u043d void, \u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u044f\u0434\u0440\u0430 \u044d\u0442\u043e tU16 ;  } <\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435, \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u043a\u0438 \u043f\u043e\u0434 \u0434\u0440\u0443\u0433\u0443\u044e \u043b\u044e\u0431\u0443\u044e \u041e\u0421\u0420\u0412 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 rtosdefs.cpp \u0438 rtos.cpp. \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043b\u0430\u0441\u0441\u044b <i>Thread<\/i> \u0438 <i>Rtos<\/i> \u0441\u0442\u0430\u043b\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043a\u0430\u043a c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gp\/wq\/zl\/gpwqzlgnristquzlrcdbxyfm9ro.png\" alt=\"image\"><\/p>\n<h2>\u0417\u0430\u043f\u0443\u0441\u043a \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0438 \u0438 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>  \u0414\u043b\u044f Cortex M4 \u00ab\u0432\u0441\u0435\u00bb \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 3 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f, \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f <i>System tick timer<\/i>, <i>System Service call via SWI instruction<\/i>, <i>Pendable request for system service<\/i>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0434\u043b\u044f \u041e\u0421\u0420\u0412 \u0438 \u0431\u044b\u043b\u0438 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043d\u044b. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u041e\u0421\u0420\u0412 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0435\u0449\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f, \u043d\u043e \u044d\u0442\u0438\u0445 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u00ab\u0432\u0441\u0435\u0445\u00bb \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043e\u043a. \u0410 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0442\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u044d\u0442\u0438\u0445 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439 \u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u041e\u0421\u0420\u0412 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0435\u0449\u0435 \u043c\u0435\u0442\u043e\u0434 \u0441\u0442\u0430\u0440\u0442:<\/p>\n<pre><code class=\"cpp\">   static void HandleSvcInterrupt() ; static void HandleSvInterrupt() ; static void HandleSysTickInterrupt() ; static void Start() ; <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438 \u0431\u0435\u0437 \u0447\u0435\u0433\u043e \u044f \u0436\u0438\u0442\u044c \u043d\u0435 \u043c\u043e\u0433\u0443, \u043e \u0447\u0435\u043c \u043c\u0435\u0447\u0442\u0430\u044e \u2014 \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447. \u041c\u043d\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f Event-driven programming, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u0434\u043b\u044f \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447.<\/p>\n<p>  \u0412\u0441\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u043b\u044e\u0431\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0430 \u044d\u0442\u043e \u0443\u043c\u0435\u0435\u0442, \u043d\u0443 \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c <i>uc-OS-II<\/i> \u0438 <i>III<\/i>, \u0445\u043e\u0442\u044f \u043c\u043e\u0436\u0435\u0442 \u044f \u043f\u043b\u043e\u0445\u043e \u0447\u0438\u0442\u0430\u043b, \u043d\u043e, \u043f\u043e-\u043c\u043e\u0435\u043c\u0443 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0442\u0430\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u0443\u0434\u0440\u0435\u043d\u044b\u0439, \u043d\u0443 \u0434\u0430 \u043b\u0430\u0434\u043d\u043e, \u00ab\u0432\u0441\u0435\u00bb \u0442\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u043e \u0442\u043e\u0447\u043d\u043e \u043c\u043e\u0433\u0443\u0442.<\/p>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u043e\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0441\u043b\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0435 \u0432 \u043f\u0443\u0441\u0442\u043e\u0442\u0443, \u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0437\u0430\u0434\u0430\u0447\u0435, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u043b\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u0434\u0430\u0447\u0438. \u0422\u0430\u043a\u0438\u0435 \u044f \u043a\u0430\u043a \u0440\u0430\u0437 \u0445\u0440\u0430\u043d\u044e \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 <i>Thread<\/i>, \u0437\u043d\u0430\u0447\u0438\u0442 \u0438 \u043c\u0435\u0442\u043e\u0434 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443 \u043a\u043b\u0430\u0441\u0441\u0430 Thread. \u0422\u0430\u043c \u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0438 \u043c\u0435\u0442\u043e\u0434 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f. \u0417\u0430\u043e\u0434\u043d\u043e \u0443\u0436 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0438 \u043c\u0435\u0442\u043e\u0434 <i>Sleep(..)<\/i> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ie\/r_\/35\/ier_35fgsut4a_gf_ismmm91tuk.png\" alt=\"image\"><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">rtos.hpp<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/******************************************************************************* * Filename  \t: Rtos.hpp *  * Details   \t: Rtos class is used to create tasks, work with special Rtos  * functions and also it contains a special static method Run. In this method  * the pointer on Thread should be pass. This method is input point as  * the task of Rtos. In the body of the method, the method of concrete Thread  * will run.  *******************************************************************************\/ #ifndef __RTOS_HPP #define __RTOS_HPP  #include \"thread.hpp\"        \/\/ for Thread #include \"..\/..\/Common\/susudefs.hpp\" #include \"FreeRtos\/rtosdefs.hpp\"  namespace OsWrapper  {     extern void wCreateThread(Thread &amp;, const char *, ThreadPriority, const tU16, tStack *) ;   extern void wStart() ;   extern void wHandleSvcInterrupt() ;   extern void wHandleSvInterrupt() ;   extern void wHandleSysTickInterrupt() ;     extern void wEnterCriticalSection();   extern void wLeaveCriticalSection();      class Rtos   {     public:                  static void CreateThread(Thread &amp;thread ,                                tStack * pStack = nullptr,                                const char * pName = nullptr,                                ThreadPriority prior = ThreadPriority::normal,                                const tU16 stackDepth = static_cast&lt;tU16&gt;(StackDepth::minimal)) ;       static void Start() ;              static void HandleSvcInterrupt() ;       static void HandleSvInterrupt() ;       static void HandleSysTickInterrupt() ;              friend void wCreateThread(Thread &amp;, const char *, ThreadPriority, const tU16, tStack *);     private:       \/\/cstat !MISRAC++2008-7-1-2 To prevent reinterpet_cast in the CreateTask       static void Run(void *pContext )        {         static_cast&lt;Thread*&gt;(pContext)-&gt;Execute() ;       }   } ; } ; #endif \/\/ __RTOS_HPP  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">thread.hpp<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/******************************************************************************* * Filename  \t: thread.hpp *  * Details   \t: Base class for any Taskis which contains the pure virtual  * method Execute().  Any active classes which will have a method for running as  * a task of RTOS should inherit the Thread and override the Execute() method.  * For example: *            class MyTask : public OsWrapper::Thread *            { *            public: *               virtual void Execute() override {  *                 while(true) { *                    \/\/do something.. *                 }   *            } ; * *******************************************************************************\/ #ifndef __THREAD_HPP #define __THREAD_HPP    #include \"FreeRtos\/rtosdefs.hpp\" #include \"..\/..\/Common\/susudefs.hpp\"  namespace OsWrapper  {   extern void wSleep(const tTime) ;   extern void wSleepUntil(tTime &amp;, const tTime) ;   extern tTime wGetTicks() ;   extern void wSignal(tTaskHandle const &amp;, const tTaskEventMask) ;   extern tTaskEventMask wWaitForSignal(const tTaskEventMask, tTime) ;   constexpr tTaskEventMask defaultTaskMaskBits = 0b010101010 ;    enum class ThreadPriority   {       clear = 0,       lowest = 10,       belowNormal = 20,       normal = 30,       aboveNormal = 80,       highest = 90,       priorityMax = 255   } ;    enum class StackDepth: tU16   {       minimal = 128U,       medium = 256U,       big = 512U,       biggest = 1024U   };      class Thread   {     public:       virtual void Execute() = 0 ;        inline tTaskHandle GetTaskHanlde() const       {         return handle;       }       static void Sleep(const tTime timeOut = 1000ms)       {         wSleep(timeOut) ;       };        inline void Signal(const tTaskEventMask mask = defaultTaskMaskBits)       {         wSignal(handle, mask);       };              inline tTaskEventMask WaitForSignal(tTime timeOut = 1000ms,                                       const tTaskEventMask mask = defaultTaskMaskBits)       {         return wWaitForSignal(mask, timeOut) ;       }       friend void wCreateThread(Thread &amp;, const char *, ThreadPriority, const tU16, tStack *);     private:       tTaskHandle handle ;       tTaskContext context ;   } ; } ; #endif \/\/ __THREAD_HPP <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041d\u0430\u0447\u0430\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c, \u0438 \u0442\u0443\u0442 \u043c\u0435\u043d\u044f \u043f\u043e\u0434\u0441\u0442\u0435\u0440\u0435\u0433\u0430\u043b\u0430 \u043f\u0435\u0440\u0432\u0430\u044f \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0441\u0442\u044c, \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u00ab\u043b\u044e\u0431\u0430\u044f\u00bb \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0430 \u043f\u043e \u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0432\u043e\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <i>FreeRTOS<\/i> \u0438\u043c\u0435\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438\u0445 \u0438\u0437 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439, \u0441\u043a\u0430\u0436\u0435\u043c, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>xTaskNotify(..)<\/i>, \u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u0437 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u0435\u0451 \u043d\u0435\u043b\u044c\u0437\u044f, \u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <i>xTaskNotifyFromISR(..)<\/i>. <br \/>  \u0423 <i>embOS<\/i> \u0435\u0441\u043b\u0438 \u0432\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0435 \u043b\u044e\u0431\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u0431\u0443\u0434\u044c\u0442\u0435 \u043b\u044e\u0431\u0435\u0437\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <i>OS_InInterrupt() <\/i> \u043f\u0440\u0438 \u0432\u0445\u043e\u0434\u0435 \u0432 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u0438 <i>OS_LeaveInterrupt()<\/i> \u043f\u0440\u0438 \u0432\u044b\u0445\u043e\u0434\u0435. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 <i>InterruptEntry<\/i>, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0438 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440:<\/p>\n<pre><code class=\"cpp\">namespace OsWrapper {   extern void wEnterInterrupt() ;   extern void wLeaveInterrupt() ;      class InterruptEntry   {     public:       inline InterruptEntry()   {         wEnterInterrupt() ;       }\t         inline ~InterruptEntry()  {         wLeaveInterrupt() ;       }   } ; } ;<\/code><\/pre>\n<p>  \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">void Button::HandleInterrupt() {   const OsWrapper::InterruptEntry ie;   EXTI-&gt;PR = EXTI_PR_PR13 ;   myDesiredTask.Signal();    }  void myDesiredTask::Execute() {    while(true)  {     if (WaitForSignal(100000ms) == defaultTaskMaskBits)    {         GPIOC-&gt;ODR ^= (1 &lt;&lt; 5) ;         }   } } ;<\/code><\/pre>\n<p>  \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f <i>FreeRTOS<\/i> \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0438 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0431\u0443\u0434\u0443\u0442 \u043f\u0443\u0441\u0442\u044b\u0435. \u0410 \u0434\u043b\u044f \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <i>xTaskNotifyFromISR(..)<\/i>, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0435\u0437 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043e\u0442\u043a\u0443\u0434\u0430 \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u0430, \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b, \u043d\u043e \u0447\u0442\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u0448\u044c \u0440\u0430\u0434\u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u0438\u0437 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439, \u043d\u043e \u043f\u043e\u043a\u0430 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e.<br \/>  \u0422\u0430\u043a\u043e\u0439 \u0436\u0435 \u0442\u0440\u044e\u043a, \u043a\u0430\u043a \u0441 <i>InterruptEntry<\/i> \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0441 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0435\u0439:<\/p>\n<pre><code class=\"cpp\">namespace OsWrapper{   class CriticalSection  {     public:       inline CriticalSection()      {         wEnterCriticalSection() ;       }               inline ~CriticalSection()      {         wLeaveCriticalSection() ;       }    } ; } ;<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e API <i>FreeRtos<\/i> \u0432 \u0444\u0430\u0439\u043b \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0445\u043e\u0442\u044f \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438 \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c, \u0438\u0442\u0430\u043a \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \ud83d\ude42  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">rtosFreeRtos.cpp<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/******************************************************************************* * Filename  \t: rtosFreeRtos.cpp *  * Details   \t: This file containce implementation of functions of concrete  *                 FreeRTOS to support another RTOS create the same file with the *                 same functions but another name&lt; for example rtosEmbOS.cpp and *                 implement these functions using EmbOS API. * *******************************************************************************\/  #include \"..\/thread.hpp\" #include \"..\/mutex.hpp\" #include \"..\/rtos.hpp\" #include \"..\/..\/..\/Common\/susudefs.hpp\" #include \"rtosdefs.hpp\" #include \"..\/event.hpp\"  #include &lt;limits&gt;  namespace OsWrapper { \/*****************************************************************************  * Function Name: wCreateThread  * Description: Creates a new task and passes a parameter to the task. The   * function should call appropriate RTOS API function to create a task.   *  * Assumptions: RTOS API create task function should get a parameter to pass the  * paramete to task.        * Some RTOS does not use pStack pointer so it should be set to nullptr  *  * Parameters: [in] thread - refernce on Thread object  *             [in] pName - name of task  *             [in] prior - task priority  *             [in] stackDepth - size of Stack    *             [in] pStack - pointer on task stack  * Returns: No  ****************************************************************************\/   void wCreateThread(Thread &amp; thread, const char * pName,                             ThreadPriority prior, const tU16 stackDepth,                             tStack *pStack)   { #if (configSUPPORT_STATIC_ALLOCATION == 1)   if (pStack != nullptr)   {     thread.handle = xTaskCreateStatic(static_cast&lt;TaskFunction_t&gt;(Rtos::Run),                                            pName,                                            stackDepth,                                            &amp;thread,                                            static_cast&lt;uint32_t&gt;(prior),                                            pStack,                                            &amp;thread.context);   } #else   thread.handle =  (xTaskCreate(static_cast&lt;TaskFunction_t&gt;(Rtos::Run),                         pName, stackDepth, &amp;thread, static_cast&lt;uint32_t&gt;(prior),                         &amp;thread.handle) == pdTRUE) ?  thread.handle : nullptr ; #endif   }  \/*****************************************************************************  * Function Name: wStart()  * Description: Starts the RTOS scheduler  *  * Assumptions: No  * Parameters: No  * Returns: No  ****************************************************************************\/     void wStart()    {     vTaskStartScheduler() ;   }       \/*****************************************************************************  * Function Name: wHandleSvcInterrupt()  * Description: Handle of SVC Interrupt. The function should call appropriate   * RTOS function to handle the interrupt  *  * Assumptions: No  * Parameters: No  * Returns: No  ****************************************************************************\/     void wHandleSvcInterrupt()   {     vPortSVCHandler() ;   }         \/*****************************************************************************  * Function Name: wHandleSvInterrupt()  * Description: Handle of SV Interrupt. The function should call appropriate   * RTOS function to handle the interrupt  *  * Assumptions: No  * Parameters: No  * Returns: No  ****************************************************************************\/         void wHandleSvInterrupt()   {     xPortPendSVHandler() ;   }     \/*****************************************************************************  * Function Name: wHandleSysTickInterrupt()  * Description: Handle of System Timer Interrupt. The function should call   *  appropriate RTOS function to handle the interrupt  *  * Assumptions: No  * Parameters: No  * Returns: No  ****************************************************************************\/     void wHandleSysTickInterrupt()   {     xPortSysTickHandler() ;   }   \/*****************************************************************************  * Function Name: wSleep()  * Description: Suspends the calling task for a specified period of time,   *  or waits actively when called from main()  *  * Assumptions: No  * Parameters: [in] timeOut - specifies the time interval in system ticks  * Returns: No  ****************************************************************************\/     void wSleep(const tTime timeOut)   {     vTaskDelay(timeOut) ;   }      \/*****************************************************************************   * Function Name: wEnterCriticalSection()   * Description: Basic critical section implementation that works by simply    * disabling interrupts   *   * Assumptions: No   * Parameters: No   * Returns: No   ****************************************************************************\/    void wEnterCriticalSection()   {     taskENTER_CRITICAL() ;   }      \/*****************************************************************************   * Function Name: wLeaveCriticalSection()   * Description: Leave critical section implementation that works by simply    * enabling interrupts   *   * Assumptions: No   * Parameters: No   * Returns: No   ****************************************************************************\/    void wLeaveCriticalSection()   {     taskEXIT_CRITICAL() ;   }      \/****************************************************************************   * Function Name: wEnterInterrupt()   * Description: Some RTOS requires to inform the kernel  that interrupt code    * is executing    *   * Assumptions: No   * Parameters: No   * Returns: No   ****************************************************************************\/   void wEnterInterrupt()    {        }      \/****************************************************************************   * Function Name: wLeaveInterrupt()   * Description: Some RTOS requires to inform that the end of the interrupt r   * outine has been reached; executes task switching within ISR    *   * Assumptions: No   * Parameters: No   * Returns: No   ****************************************************************************\/   void wLeaveInterrupt()    {        }      \/****************************************************************************   * Function Name: wSignal()   * Description: Signals event(s) to a specified task   *   * Assumptions: No   * Parameters: [in] taskHandle - Reference to the task structure   *             [in] mask - The event bit mask containing the event bits,    *             which shall be signaled.   * Returns: No   ****************************************************************************\/   void wSignal(tTaskHandle const &amp;taskHandle, const tTaskEventMask mask)   {     BaseType_t xHigherPriorityTaskWoken = pdFALSE ;     xTaskNotifyFromISR(taskHandle, mask, eSetBits, &amp;xHigherPriorityTaskWoken) ;     portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) ;      }      \/****************************************************************************   * Function Name: wWaitForSignal()   * Description: Waits for the specified events for a given time, and clears    * the event memory when the function returns   *   * Assumptions: No   * Parameters: [in] mask - The event bit mask containing the event bits,    *             which shall be waited for   *             [in] timeOut - Maximum time in system ticks waiting for events    *             to be signaled.   * Returns: Set bits   ****************************************************************************\/     tTaskEventMask wWaitForSignal(const tTaskEventMask mask, tTime timeOut)   {     uint32_t ulNotifiedValue = 0U ;     xTaskNotifyWait( 0U,                                     std::numeric_limits&lt;uint32_t&gt;::max(),                                &amp;ulNotifiedValue,                       timeOut);     return (ulNotifiedValue &amp; mask) ;   }  \/****************************************************************************   * Function Name: wCreateEvent()   * Description:  Create an Event object   *   * Assumptions: No   * Parameters: [in] event - reference on tEvent object   *   * Returns: Handle of created Event   ****************************************************************************\/   tEventHandle wCreateEvent(tEvent &amp;event)   { #if (configSUPPORT_STATIC_ALLOCATION == 1)     return xEventGroupCreateStatic(&amp;event); #else     return xEventGroupCreate(); #endif   }    \/****************************************************************************   * Function Name: wDeleteEvent()   * Description:  Create an Event object   *   * Assumptions: No   * Parameters: [in] eventHandle - reference on tEventHandle object   *   * Returns: No   ****************************************************************************\/    void wDeleteEvent(tEventHandle &amp;eventHandle)   {     vEventGroupDelete(eventHandle);   }      \/****************************************************************************   * Function Name: wSignalEvent()   * Description:  Sets an  resumes tasks which are waiting at the event object    *   * Assumptions: No   * Parameters: [in] event - reference on eventHandle object   *             [in] mask - The event bit mask containing the event bits,    *             which shall be signaled   *   * Returns: No   ****************************************************************************\/   void wSignalEvent(tEventHandle const &amp;eventHandle, const tEventBits mask)   {     BaseType_t xHigherPriorityTaskWoken = pdFALSE;     xEventGroupSetBitsFromISR(eventHandle, mask, &amp;xHigherPriorityTaskWoken) ;      portYIELD_FROM_ISR(xHigherPriorityTaskWoken) ;    }      \/****************************************************************************   * Function Name: wWaitEvent()   * Description:  Waits for an event and suspends the task for a specified time    * or until the event has been signaled.    *   * Assumptions: No   * Parameters: [in] event - Reference on eventHandle object   *             [in] mask - The event bit mask containing the event bits,    *             which shall be signaled   *             [in] timeOut - Maximum time in RTOS system ticks until the    *             event must be signaled.    *             [in] mode - Indicate mask bit behaviour   *   * Returns: Set bits   ****************************************************************************\/   tEventBits wWaitEvent(tEventHandle const &amp;eventHandle, const tEventBits mask,                         const tTime timeOut, OsWrapper::EventMode mode)   {     BaseType_t xWaitForAllBits = pdFALSE ;      if (mode == OsWrapper::EventMode::waitAnyBits)     {       xWaitForAllBits = pdFALSE;     }     return xEventGroupWaitBits(eventHandle, mask, pdTRUE, xWaitForAllBits, timeOut) ;   }  \/**************************************************************************** * Function Name: wCreateMutex() * Description:  Create an mutex. Mutexes are used for managing resources by * avoiding conflicts caused by simultaneous use of a resource. The resource * managed can be of any kind: a part of the program that is not reentrant, a * piece of hardware like the display, a flash prom that can only be written to * by a single task at a time, a motor in a CNC control that can only be * controlled by one task at a time, and a lot more. * * Assumptions: No * Parameters: [in] mutex - Reference on tMutex structure *             [in] mode - Indicate mask bit behaviour * * Returns: Mutex handle ****************************************************************************\/   tMutexHandle wCreateMutex(tMutex &amp;mutex)   { #if (configSUPPORT_STATIC_ALLOCATION == 1)     return xSemaphoreCreateMutexStatic(&amp;mutex) ; #else     return xSemaphoreCreateMutex(); #endif   }  \/**************************************************************************** * Function Name: wDeleteMutex() * Description:  Delete the mutex. * * Assumptions: No * Parameters: [in] mutex - handle of mutex * * Returns: Mutex handle ****************************************************************************\/   void wDeleteMutex(tMutexHandle &amp;handle)   {     vSemaphoreDelete(handle) ;   }  \/**************************************************************************** * Function Name: wLockMutex() * Description:  Claim the resource * * Assumptions: No * Parameters: [in] handle - handle of mutex *             [in] timeOut - Maximum time until the mutex should be available * * Returns: true if resource has been claimed, false if timeout is expired ****************************************************************************\/   bool wLockMutex(tMutexHandle const &amp;handle, tTime timeOut)   {     return static_cast&lt;bool&gt;(xSemaphoreTake(handle, timeOut)) ;   }  \/**************************************************************************** * Function Name: wUnLockMutex() * Description:  Releases a mutex currently in use by a task * * Assumptions: No * Parameters: [in] handle - handle of mutex * * Returns: No ****************************************************************************\/   void wUnLockMutex(tMutexHandle const &amp;handle)   {     BaseType_t  xHigherPriorityTaskWoken = pdFALSE ;     xSemaphoreGiveFromISR(handle, &amp;xHigherPriorityTaskWoken) ;      portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) ;   }  \/**************************************************************************** * Function Name: wSleepUntil() * Description:  Suspends the calling task until a specified time, or waits * actively when called from main() * * Assumptions: No * Parameters: [in] last - Refence to a variable that holds the time at which *             the task was last unblocked. The variable must be initialised *             with the current time prior to its first use *             [in] timeOut - Time to delay until, the task will be unblocked *             at time * * Returns: No ****************************************************************************\/   void wSleepUntil(tTime &amp; last, const tTime timeOut)   {     vTaskDelayUntil( &amp;last, timeOut) ;   }  \/**************************************************************************** * Function Name: wGetTicks() * Description:  Returns the current system time in ticks as a native integer * value * * Assumptions: No * Parameters:  No * * Returns: Current system time in ticks ****************************************************************************\/   tTime wGetTicks()   {     return xTaskGetTickCount();   } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/4a\/sm\/mm\/4asmmm71hosjm510maad5hcadrm.png\" alt=\"image\"><\/p>\n<h2>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0434\u043e\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443<\/h2>\n<p>  \u0412 \u0437\u0430\u0434\u0430\u0447\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u0442\u044c \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 Sleep(). \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u044d\u0442\u043e\u0433\u043e \u0445\u0432\u0430\u0442\u0430\u0435\u0442, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0447\u0435\u0442\u043a\u043e \u0434\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u0442\u043e Sleep() \u0432\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0435\u043a\u0438\u0439 \u0440\u0430\u0441\u0447\u0435\u0442 \u0438 \u043c\u043e\u0440\u0433\u043d\u0443\u0442\u044c \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0440\u043e\u0432\u043d\u043e \u0440\u0430\u0437 \u0432 100 ms<\/p>\n<pre><code class=\"cpp\">void MyTask::Execute() {     while(true)  {        DoCalculation(); \/\/It takes about 10ms        Led1.Toggle() ;        Sleep(100ms) ;     } } <\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u043c\u043e\u0440\u0433\u0430\u0442\u044c \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c \u0440\u0430\u0437 \u0432 110 ms. \u041d\u043e \u0432\u044b \u0436\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0430\u0437 \u0432 100ms, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c Sleep(90ms). \u041d\u043e \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0442\u043e \u043c\u043e\u0440\u0433\u0430\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0434\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c. \u0414\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0432\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0432\u043e \u00ab\u0432\u0441\u0435\u0445\u00bb \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0430\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u0442\u0438\u043f\u0430 DelayUntil(). \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u043d \u043f\u043e \u0442\u0430\u043a\u043e\u043c\u0443 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u2014 \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430 \u0442\u0438\u043a\u043e\u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u044d\u0442\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0438\u043a\u043e\u0432 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0442\u0438\u043a\u043e\u0432 \u0434\u043e\u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0437\u0430\u0434\u0430\u0447\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0440\u043e\u0432\u043d\u043e \u043d\u0430 \u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b \u0437\u0430\u0434\u0430\u043b\u0438 \u0438 \u0432\u0430\u0448 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u043c\u043e\u0440\u0433\u0430\u0442\u044c \u0440\u043e\u0432\u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0435 100ms \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u0447\u0435\u0442\u0430.<br \/>  \u042d\u0442\u043e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u043e \u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0430\u0445, \u043d\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0443 \u043d\u0435\u0433\u043e \u043e\u0434\u0438\u043d. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u0441\u043a\u0430\u0436\u0435\u043c, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 FreeRTOS, \u0431\u0443\u0434\u0435\u0442 \u0443\u043f\u0440\u043e\u0449\u0435\u043d \u0434\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tg\/n1\/hb\/tgn1hba-pczt2p5b0dzy0kut-ua.png\" alt=\"image\"><\/p>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430 \u0422\u0438\u043a\u043e\u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438 \u0434\u043e \u0432\u0445\u043e\u0434\u0430 \u0432 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b, \u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c. \u041d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A8%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9_%D0%BC%D0%B5%D1%82%D0%BE%D0%B4_(%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD_%D0%BF%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F)\"> \u0428\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434<\/a>. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u043d \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e, \u043d\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043d\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0433\u0434\u0435 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u043c\u0435\u0442\u043e\u0434, \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0438 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0449\u0438\u0439 \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0422\u0438\u043a\u043e\u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0438, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 Execute(), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432 \u043f\u043e\u0442\u043e\u043c\u043a\u0435, \u0442.\u0435. \u0432 \u0432\u0430\u0448\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0442\u043e\u0440\u0447\u0430\u043b \u043d\u0430\u0440\u0443\u0436\u0443 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (\u043e\u043d \u0432\u0435\u0434\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439), \u0442\u043e \u0441\u043a\u0440\u043e\u0435\u043c \u0435\u0433\u043e \u0432 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438. <\/p>\n<pre><code class=\"cpp\"> class Thread  {     public:       virtual void Execute() = 0 ;       friend class Rtos ;    private:       void Run()      {         lastWakeTime = wGetTicks() ;         Execute();       } ...              tTime lastWakeTime = 0ms ; ... }       <\/code><\/pre>\n<p>  \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 Run \u043a\u043b\u0430\u0441\u0441\u0430 Rtos, \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043d\u0435 Execute(), \u0430 \u043c\u0435\u0442\u043e\u0434 Run() \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Thread. \u041c\u044b \u043a\u0430\u043a \u0440\u0430\u0437 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043a\u043b\u0430\u0441\u0441 Rtos \u0434\u0440\u0443\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u0443 Run() \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 Thread.<\/p>\n<pre><code class=\"cpp\">static void Run(void *pContext )      {         static_cast&lt;Thread*&gt;(pContext)-&gt;Run() ;       } <\/code><\/pre>\n<p>  \u041a\u0440\u0430\u0439\u043d\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/aw\/nx\/ts\/awnxtsvd-odgyfaagkl3egc_tvs.png\" alt=\"image\"><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">thread.hpp<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/******************************************************************************* * Filename  \t: thread.hpp *  * Details   \t: Base class for any Taskis which contains the pure virtual  * method Execute().  Any active classes which will have a method for running as  * a task of RTOS should inherit the Thread and override the Execute() method.  * For example: *            class MyTask : public OsWrapper::Thread *            { *            public: *               virtual void Execute() override {  *                 while(true) { *                    \/\/do something.. *                 }   *            } ; * * Author        : Sergey Kolody *******************************************************************************\/ #ifndef __THREAD_HPP #define __THREAD_HPP    #include \"FreeRtos\/rtosdefs.hpp\" #include \"..\/..\/Common\/susudefs.hpp\"  namespace OsWrapper  {   extern void wSleep(const tTime) ;   extern void wSleepUntil(tTime &amp;, const tTime) ;   extern tTime wGetTicks() ;   extern void wSignal(tTaskHandle const &amp;, const tTaskEventMask) ;   extern tTaskEventMask wWaitForSignal(const tTaskEventMask, tTime) ;   constexpr tTaskEventMask defaultTaskMaskBits = 0b010101010 ;    enum class ThreadPriority   {       clear = 0,       lowest = 10,       belowNormal = 20,       normal = 30,       aboveNormal = 80,       highest = 90,       priorityMax = 255   } ;    enum class StackDepth: tU16   {       minimal = 128U,       medium = 256U,       big = 512U,       biggest = 1024U   };      class Thread   {     public:       virtual void Execute() = 0 ;        inline tTaskHandle GetTaskHanlde() const       {         return handle;       }       static void Sleep(const tTime timeOut = 1000ms)       {         wSleep(timeOut) ;       };        void SleepUntil(const tTime timeOut = 1000ms)       {         wSleepUntil(lastWakeTime, timeOut);       };        inline void Signal(const tTaskEventMask mask = defaultTaskMaskBits)       {         wSignal(handle, mask);       };              inline tTaskEventMask WaitForSignal(tTime timeOut = 1000ms,                                       const tTaskEventMask mask = defaultTaskMaskBits)       {         return wWaitForSignal(mask, timeOut) ;       }       friend void wCreateThread(Thread &amp;, const char *, ThreadPriority, const tU16, tStack *);       friend class Rtos ;     private:       tTaskHandle handle ;       tTaskContext context ;       tTime lastWakeTime = 0ms ;       void Run()       {         lastWakeTime = wGetTicks() ;         Execute();       }   } ; } ; #endif \/\/ __THREAD_HPP  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">rtos.hpp<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/******************************************************************************* * Filename  \t: Rtos.hpp *  * Details   \t: Rtos class is used to create tasks, work with special Rtos  * functions and also it contains a special static method Run. In this method  * the pointer on Thread should be pass. This method is input point as  * the task of Rtos. In the body of the method, the method of concrete Thread  * will run.  *******************************************************************************\/  #ifndef __RTOS_HPP #define __RTOS_HPP  #include \"thread.hpp\"        \/\/ for Thread #include \"..\/..\/Common\/susudefs.hpp\" #include \"FreeRtos\/rtosdefs.hpp\"  namespace OsWrapper  {     extern void wCreateThread(Thread &amp;, const char *, ThreadPriority, const tU16, tStack *) ;   extern void wStart() ;   extern void wHandleSvcInterrupt() ;   extern void wHandleSvInterrupt() ;   extern void wHandleSysTickInterrupt() ;     extern void wEnterCriticalSection();   extern void wLeaveCriticalSection();       class Rtos   {     public:                  static void CreateThread(Thread &amp;thread ,                                tStack * pStack = nullptr,                                const char * pName = nullptr,                                ThreadPriority prior = ThreadPriority::normal,                                const tU16 stackDepth = static_cast&lt;tU16&gt;(StackDepth::minimal)) ;       static void Start() ;              static void HandleSvcInterrupt() ;       static void HandleSvInterrupt() ;       static void HandleSysTickInterrupt() ;              friend void wCreateThread(Thread &amp;, const char *, ThreadPriority, const tU16, tStack *);       friend  class Thread ;     private:       \/\/cstat !MISRAC++2008-7-1-2 To prevent reinterpet_cast in the CreateTask       static void Run(void *pContext )        {         static_cast&lt;Thread*&gt;(pContext)-&gt;Run() ;       }   } ; } ; #endif \/\/ __RTOS_HPP <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h2>\u0421\u043e\u0431\u044b\u0442\u0438\u044f<\/h2>\n<p>  \u0418\u0442\u0430\u043a \u0437\u0430\u0434\u0430\u0447\u0430, \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f, \u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043b\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u043d\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c \u043d\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435, \u0430 \u043b\u044e\u0431\u043e\u043c\u0443 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0448\u0438\u0442 \u044d\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043e\u0436\u0438\u0434\u0430\u0442\u044c. \u0413\u0440\u0443\u0431\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u043d\u0430\u0434\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u043d\u0430\u0434 \u0421\u043e\u0431\u044b\u0442\u0438\u0435\u043c.<\/p>\n<p>  \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432\u043e\u043e\u0431\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u0441\u044f\u043a\u0438\u0445 \u043e\u043f\u0446\u0438\u0439, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043f\u043e\u0441\u043b\u0430\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044f \u0431\u0438\u0442\u044b, \u0430 \u043e\u0434\u043d\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u043e\u0434\u043d\u0438\u0445 \u0431\u0438\u0442\u043e\u0432, \u0434\u0440\u0443\u0433\u0438\u0435 \u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0434\u0440\u0443\u0433\u0438\u0445, \u043c\u043e\u0436\u043d\u043e \u0438\u0445 \u0432\u0441\u0435\u0445 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443, \u043c\u043e\u0436\u043d\u043e \u0431\u0438\u0442\u044b \u043e\u0447\u0438\u0449\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043e\u0447\u0438\u0449\u0430\u0442\u044c, \u043a\u043e\u0440\u043e\u0447\u0435 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u0441\u044f\u043a\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u043d\u043e \u0432 \u043c\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u043d\u0430\u0434\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043f\u043e\u0441\u043b\u0430\u0442\u044c \u0438 \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0438 \u0432\u0441\u0435 \u0431\u0438\u0442\u044b \u0441\u043a\u0438\u043d\u0443\u0442\u044c. \u041e\u0434\u043d\u0430\u043a\u043e, \u043d\u0430\u0434\u043e \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041f\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u043e\u0445\u043e\u0436\u0438 \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0438, \u0443 \u043d\u0438\u0445 \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440, \u0442\u0430\u043a\u0436\u0435 \u043c\u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0447\u0442\u043e\u0431\u044b \u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043c\u043e\u0433\u043b\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0440\u0435\u043c\u044f \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0438 \u043c\u0430\u0441\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0435\u0449\u0435 \u0434\u0432\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0445 \u043f\u043e\u043b\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gv\/na\/8k\/gvna8ktlrzvrposxbpwhzpn0keq.png\"><\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">OsWrapper::Event event{10000ms, 3}; \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u0432\u0440\u0435\u043c\u044f \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f 10000ms,  \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0431\u0438\u0442\u044b \u043d\u043e\u043c\u0435\u0440 0 \u0438 \u0431\u0438\u0442 \u043d\u043e\u043c\u0435\u0440 1.  void SomeTask::Execute() {      while(true)  {       using OsWrapper::operator\"\"ms ;       Sleep(1000ms);       event.Signal() ; \/\/ \u041f\u043e\u0441\u044b\u043b\u0430\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u0431\u0438\u0442\u043e\u043c 0 \u0438 \u0431\u0438\u0442\u043e\u043c 1.       Sleep(1000ms);       event.SetMaskBits(4) \/\/\u0422\u0435\u043f\u0435\u0440\u044c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0438\u0442 2.       event.Signal() ; \/\/ \u041f\u043e\u0441\u044b\u043b\u0430\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u0431\u0438\u0442\u043e\u043c 2.      }   } ;  void AnotherTask::Execute() {    while(true)  {     using namespace::OsWrapper ;       \/\/\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043d\u0435 \u043f\u043e \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u0443, \u0442\u0430\u0439\u043c\u0430\u0443\u0442 \u0435\u0441\u043b\u0438 \u0447\u0442\u043e 10000ms       if ((event.Wait() &amp; defaultTaskMaskBits) != 0)   {         GPIOC-&gt;ODR ^= (1 &lt;&lt; 5) ;       }     }   } ; <\/code><\/pre>\n<h2>\u041c\u044c\u044e\u0442\u0435\u043a\u0441, \u0421\u0435\u043c\u0430\u0444\u043e\u0440\u044b \u0438 \u041e\u0447\u0435\u0440\u0435\u0434\u0438<\/h2>\n<p>  \u0410 \u0438\u0445 \u044f \u043f\u043e\u043a\u0430 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b, \u0442\u043e\u0447\u043d\u0435\u0435 \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u044b \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043b, \u043d\u043e \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b, \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0436\u0435 \u0436\u0434\u0443\u0442 \u0441\u0432\u043e\u0435\u0439 \u043e\u0447\u0435\u0440\u0435\u0434\u0438, \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0434\u043e\u0434\u0435\u043b\u0430\u044e \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0435 \u0432\u0440\u0435\u043c\u044f.<\/p>\n<h2>\u041a\u0430\u043a \u0432\u0441\u0435\u043c \u044d\u0442\u0438\u043c \u0434\u0435\u043b\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f<\/h2>\n<p>  \u041e\u0441\u043d\u043e\u0432\u0430 \u0441\u0434\u0435\u043b\u0430\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u043a\u0430\u043a \u0432\u0441\u0435\u043c \u044d\u0442\u0438\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u044f \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: \u0417\u0430\u0434\u0430\u0447\u0430 <i>LedTask<\/i>, \u043c\u043e\u0440\u0433\u0430\u0435\u0442 \u0440\u0430\u0437 \u0432 \u0440\u043e\u0432\u043d\u043e 2 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c, \u0438 \u043a\u0430\u0436\u0434\u044b\u0435 \u0436\u0435 2 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u0441\u0438\u0433\u043d\u0430\u043b \u0437\u0430\u0434\u0430\u0447\u0435 <i>myTask<\/i>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0436\u0434\u0435\u0442 10 \u0441\u0435\u043a\u0443\u043d\u0434 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043f\u0440\u0438\u0448\u043b\u043e, \u043e\u043d\u0430 \u043c\u043e\u0440\u0433\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c. \u0412 \u043e\u0431\u0449\u0435\u043c \u0432 \u0438\u0442\u043e\u0433\u0435 \u0434\u0432\u0430 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430 \u043c\u043e\u0440\u0433\u0430\u044e\u0442 \u0440\u0430\u0437 \u0432 2 \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u042f \u043d\u0435 \u0441\u0442\u0430\u043b \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043d\u043e\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443, \u0430 \u0441\u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u0447\u0435\u0440\u0435\u0437 <i>event<\/i>. \u041d\u0435\u043f\u0440\u0430\u0432\u0434\u0430 \u043b\u0438 \u0438\u0437\u044b\u0441\u043a\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0440\u0433\u043d\u0443\u0442\u044c \u0434\u0432\u0443\u043c\u044f \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430\u043c\u0438 \ud83d\ude42<\/p>\n<pre><code class=\"cpp\">using OsWrapper::operator\"\"ms ; OsWrapper::Event event{10000ms, 1};  class MyTask : public OsWrapper::Thread { public:   virtual void Execute() override {     while(true) {           if (event.Wait() != 0) {         GPIOC-&gt;ODR ^= (1 &lt;&lt; 9);           }     }   }   using tMyTaskStack = std::array&lt;OsWrapper::tStack,                                     static_cast&lt;tU16&gt;(OsWrapper::StackDepth::minimal)&gt; ;   inline static tMyTaskStack Stack; \/\/C++17 \u0444\u0438\u0448\u043a\u0430 \u0432 IAR 8.30   } ;  class LedTask : public OsWrapper::Thread { public:   virtual void Execute() override {     while(true)   {             GPIOC-&gt;ODR ^= (1 &lt;&lt; 5) ;       using OsWrapper::operator\"\"ms ;       SleepUntil(2000ms);       event.Signal() ;      }   }   using tLedStack = std::array&lt;OsWrapper::tStack,                                static_cast&lt;tU16&gt;(OsWrapper::StackDepth::minimal)&gt; ;   inline static tLedStack Stack; \/\/C++17 \u0444\u0438\u0448\u043a\u0430 \u0432 IAR 8.30 } ;  MyTask myTask; LedTask ledTask;  int main() {   using namespace OsWrapper ;     Rtos::CreateThread(myTask, MyTask::Stack.data(), \"myTask\",                       ThreadPriority::lowest, MyTask::Stack.size()) ;   Rtos::CreateThread(ledTask, LedTask::Stack.data()) ;   Rtos::Start();      return 0; }<\/code><\/pre>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0420\u0438\u0441\u043a\u043d\u0443 \u0432\u044b\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u041f\u041e \u0434\u043b\u044f \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432. \u041f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432\u0440\u0435\u043c\u044f \u0421++\u0438 \u0440\u0430\u043d\u043e \u0438\u043b\u0438 \u043f\u043e\u0437\u0434\u043d\u043e \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0432\u0441\u0435 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043e\u043a \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u0421++ \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f\u043c \u0443\u0436\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043d\u0430 \u0421++. <br \/>  \u0421 \u044d\u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u044f \u0431\u044b \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u041e\u0421\u0420\u0412, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u043d\u0430 \u0421++, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u0448\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e <a href=\"https:\/\/habr.com\/post\/336308\/\"><b>\u041e\u0421\u0420\u0412 \u041c\u0410\u041a\u0421<\/b><\/a>, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c, \u0432\u044b \u0434\u0430\u0436\u0435 \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0435, \u0430 \u0432\u0435\u0434\u044c \u0442\u0430\u043c \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u0442\u0430\u043a\u0438\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0438\u0448\u043a\u0438 \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0437\u0430\u0434\u0430\u0447, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445. \u0415\u0441\u043b\u0438 \u0431\u044b \u043e\u043d\u0430 \u0438\u043c\u0435\u043b\u0430 \u0431\u044b \u0435\u0449\u0435 \u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u0442\u043e \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435 \u043d\u0430\u0439\u0442\u0438.<\/p>\n<p>  \u041d\u043e \u0430 \u043f\u043e\u043a\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u043d\u0430\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0421\u0438\u0448\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043a\u0438, \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0435\u0440\u0442\u043a\u0443, \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0442\u0430\u0440\u0442 \u043a \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0443 \u043a \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432\u043e\u043c\u0443 \u0431\u0443\u0434\u0443\u0449\u0435\u043c\u0443 \u0441 \u0421++ \ud83d\ude42 <\/p>\n<p>  \u042f \u0441\u043e\u0431\u0440\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 <a href=\"https:\/\/habr.com\/company\/JetBrains\/blog\/418729\/\">Clion<\/a>. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f \u0441 \u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438, \u043e\u043d \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u041f\u041e \u043f\u043e\u0434 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b, \u0438 \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0434\u0440\u0443\u0436\u0438\u0442 \u0441 IAR toolchain, \u043d\u043e \u0432\u0441\u0435 \u0436\u0435, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043e\u0442\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043e\u0442\u043b\u0438\u043d\u043a\u043e\u0432\u0430\u0442\u044c \u0432 elf \u0444\u043e\u0440\u043c\u0430\u0442, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432 hex \u0444\u043e\u0440\u043c\u0430\u0442, \u043f\u0440\u043e\u0448\u0438\u0442\u044c, \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0442\u043b\u0430\u0434\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e GDB. \u0418 \u044d\u0442\u043e \u0442\u043e\u0433\u043e \u0441\u0442\u043e\u0438\u043b\u043e \u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u043d\u0430\u044f \u0441\u0440\u0435\u0434\u0430, \u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430 \u0445\u043e\u0434\u0443 \u043f\u0440\u0430\u0432\u0438\u0442, \u0438 \u0435\u0441\u043b\u0438 \u043d\u0430\u0434\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443 \u043c\u0435\u0442\u043e\u0434\u0430, \u0442\u043e \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u0432 2 \u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0434\u0443\u043c\u0430\u0442\u044c \u0443\u0436\u0435 \u043d\u0435 \u043d\u0430\u0434\u043e, \u043e\u043d\u0430 \u0441\u0430\u043c\u0430 \u0441\u043a\u0430\u0436\u0435\u0442, \u0447\u0442\u043e \u0433\u0434\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c, \u043a\u0430\u043a \u043b\u0443\u0447\u0448\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u043b\u0438 \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440. \u0423 \u043c\u0435\u043d\u044f \u0434\u0430\u0436\u0435 \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0430 \u0441\u0430\u043c\u0430 Clion. \u0412 \u043e\u0431\u0449\u0435\u043c \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0431\u0430\u0433\u0438, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 IAR toolchain \u043f\u043e\u0444\u0438\u043a\u0441\u044f\u0442, \u043c\u043e\u0436\u043d\u043e \u0431\u0440\u0430\u0442\u044c.<\/p>\n<p>  \u041d\u043e \u043f\u043e \u0441\u0442\u0430\u0440\u0438\u043d\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f IAR \u044f \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u043b \u0434\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0438 8.30.1, \u043d\u0430 \u043d\u0435\u043c \u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u043a\u0430\u043a \u0432\u0441\u0435 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0435: <a href=\"https:\/\/www.waveshare.com\/wiki\/XNUCLEO-F411RE\">XNUCLEO-F411RE<\/a>, \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a ST-Link. \u0418 \u0432\u0441\u0435 \u0436\u0435, \u0435\u0449\u0435 \u0440\u0430\u0437, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043a\u0430\u043a \u043e\u0442\u043b\u0430\u0434\u043a\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 <a href=\"https:\/\/habr.com\/company\/JetBrains\/blog\/418729\/\">Clion<\/a> \u2014 \u043d\u0443 \u0441\u0438\u043c\u043f\u0430\u0442\u0438\u0447\u043d\u043e \u0436\u0435, \u043d\u043e \u043f\u043e\u043a\u0430 \u0433\u043b\u044e\u0447\u043d\u043e \ud83d\ude42<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tx\/m_\/e8\/txm_e8pms1viazgy6cypd-kjj3q.png\" alt=\"image\"><\/p>\n<p>  \u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 <i>IAR<\/i> \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0437\u044f\u0442\u044c \u0442\u0443\u0442: <a href=\"https:\/\/yadi.sk\/d\/kgp_-bz_3aKnQr\">\u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 IAR 8.30.1<\/a> \u041f\u043e\u043a\u0430 \u044d\u0442\u043e \u043d\u0435\u043f\u043e\u043b\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f, \u0431\u0435\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439 \u0438 \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u043e\u0432, \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u043d\u0443\u044e \u044f \u043f\u043e\u043b\u043e\u0436\u0443 \u0432 github, \u043a\u043e\u0433\u0434\u0430 \u0440\u0443\u043a\u0438 \u0434\u043e\u0439\u0434\u0443\u0442, \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0440\u0430 \u0443\u0447\u0435\u0431\u044b \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u0442\u0430\u0441\u0442\u0440\u043e\u0444\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0430\u043b\u043e, \u041d\u043e \u044f \u0434\u0443\u043c\u0430\u044e \u0447\u0442\u043e \u0443\u0436\u0435 \u044d\u0442\u0443 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 FreeRtos.<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/420467\/\"> https:\/\/habr.com\/post\/420467\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/420467\/\" class=\"post__text post__text-html js-mediator-article\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/s0\/2o\/ve\/s02ovegatxm9x39z6c8x_5fydki.png\" alt=\"image\"><\/p>\n<p>  \u042f \u0443\u0436\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c FreeRtos \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0421++ \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/habr.com\/post\/261807\/\">STM32, C++ \u0438 FreeRTOS. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441 \u043d\u0443\u043b\u044f. \u0427\u0430\u0441\u0442\u044c 1<\/a>. \u0421 \u0442\u0435\u0445 \u043f\u043e\u0440 \u043f\u0440\u043e\u0448\u043b\u043e \u0446\u0435\u043b\u044b\u0445 3 \u0433\u043e\u0434\u0430, \u044f \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0440\u0435\u043b, \u043f\u043e\u0442\u0435\u0440\u044f\u043b \u043a\u0443\u0447\u0443 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0432\u044f\u0437\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0438\u043b \u0432\u0441\u0442\u0440\u044f\u0445\u043d\u0443\u0442\u044c \u0441\u0442\u0430\u0440\u0438\u043d\u043e\u0439 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u0438 \u0441\u0432\u044f\u0437\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438 \u0437\u0430\u043c\u0430\u0445\u043d\u0443\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u0434\u043b\u044f \u00ab\u043b\u044e\u0431\u043e\u0439\u00bb \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0439 \u041e\u0421\u0420\u0412. \u042d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0448\u0443\u0442\u043a\u0430, \u044f \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0432\u0437\u044f\u043b \u00ab\u0432\u0441\u0435\u0445\u00bb \u0432 \u043a\u0430\u0432\u044b\u0447\u043a\u0438, \u043d\u043e \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0448\u0443\u0442\u043a\u0435 \u0435\u0441\u0442\u044c \u0434\u043e\u043b\u044f \u043f\u0440\u0430\u0432\u0434\u044b.   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-288326","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/288326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=288326"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/288326\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=288326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=288326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=288326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}