{"id":313053,"date":"2020-11-12T21:00:18","date_gmt":"2020-11-12T21:00:18","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=313053"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=313053","title":{"rendered":"\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432 ARMCC, IAR \u0438 GCC"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/412\/378\/cfc\/412378cfccf46a54f176723156359eb1.jpg\" alt=\"image\"><\/div>\n<p>  \u042f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u043d\u0430\u0434 \u043e\u0434\u043d\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0442\u0440\u0443\u0434\u043e\u043c \u0432\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 64\u043a \u043f\u0430\u043c\u044f\u0442\u0438 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u0418 \u043f\u043e\u0434\u0443\u043c\u0430\u043b\u043e\u0441\u044c \u043c\u043d\u0435, \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0440\u0430 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439 \u0431\u043e\u043b\u0435\u0435 \u0430\u0433\u0440\u0435\u0441\u0441\u0438\u0432\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0430 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 Cube MX, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f USB_DEVICE \u0438 Mass Storage Class. \u042d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0430.<\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f main.c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">int main()  {   HAL_Init();   SystemClock_Config();   MX_GPIO_Init();   MX_USB_DEVICE_Init(); } <\/code><\/pre>\n<p>  \u0414\u0435\u0444\u0430\u0439\u043d USBD_DEBUG_LEVEL \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0432 0, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f USB \u0441\u0442\u0435\u043a\u0430 \u043d\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u044f printf<\/p>\n<p>  \u041f\u043e\u0434\u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b:<\/p>\n<ul>\n<li> IAR EWARM 8.32.1 <\/li>\n<li> arm-none-eab-gcc 7-2018-q2-update (\u0441\u0440\u0435\u0434\u0430 STM32 Cube IDE 1.4.2)<\/li>\n<li> ARMCC v5.06 update 7 (\u0441\u0440\u0435\u0434\u0430 Keil uVision 5.32) <\/li>\n<li> ARMCC v6.14.1 (\u0441\u0440\u0435\u0434\u0430 Keil uVision 5.32) <\/li>\n<\/ul>\n<p>  \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 IAR:<\/p>\n<ul>\n<li> \u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0443 <\/li>\n<li> Run-time \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 NORMAL <\/li>\n<li> \u0411\u0435\u0437 low level IO (\u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d printf) <\/li>\n<li> \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043b\u0438\u043d\u043a\u0435\u0440\u0430: Inline small routines, merge duplicate sections <\/li>\n<\/ul>\n<p>  \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 GCC:<\/p>\n<ul>\n<li> Reduced runtime library &#8212;specs=nano.specs <\/li>\n<li> Optimize for size -Os <\/li>\n<li>Place functions in their own sections &#8212;ffunction-sections <\/li>\n<li>Place data in their own sections &#8212;ffdata-sections <\/li>\n<li>Discard unused sections -Wl, &#8212;gc-sections <\/li>\n<\/ul>\n<p>  \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 armcc5:<\/p>\n<ul>\n<li> Use micro lib <\/li>\n<li> Use cross module optimization <\/li>\n<li> Optimization -O3 <\/li>\n<li> One ELF section per function &#8212;split_sections <\/li>\n<\/ul>\n<p>  \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 armcc6:<\/p>\n<ul>\n<li> Use micro lib <\/li>\n<li> Optimization image size -Oz <\/li>\n<li> One ELF section per function &#8212;split_sections <\/li>\n<\/ul>\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<td><\/td>\n<td>GCC<\/td>\n<td>armcc5<\/td>\n<td>IAR<\/td>\n<td>armcc6<\/td>\n<\/tr>\n<tr>\n<td>\u0420\u0430\u0437\u043c\u0435\u0440 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438<\/td>\n<td>14036<\/td>\n<td>13548<\/td>\n<td>12997<\/td>\n<td>12984<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, armcc6 \u043d\u0430 \u0441\u0430\u043c\u0443\u044e \u043c\u0430\u043b\u043e\u0441\u0442\u044c \u043b\u0443\u0447\u0448\u0435 IAR. \u0417\u0430 \u043d\u0438\u043c \u0438\u0434\u0435\u0442 armcc5 \u0441 \u043e\u0442\u0441\u0442\u0430\u0432\u0430\u043d\u0438\u0435\u043c \u043d\u0430 4%, \u0430 gcc \u043e\u0442\u0441\u0442\u0430\u0435\u0442 \u043e\u0442 \u043b\u0438\u0434\u0435\u0440\u0430 \u043d\u0430 8%.<\/p>\n<p>  \u041d\u0430\u0434\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u043f\u0446\u0438\u044f KEIL \u00abUse cross module optimization\u00bb \u0417\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0430 \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u043d\u043e \u043d\u0438 \u0447\u0443\u0442\u044c \u043d\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u0434\u0430.<\/p><\/div>\n<p> \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\/ru\/post\/527820\/\"> https:\/\/habr.com\/ru\/post\/527820\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/412\/378\/cfc\/412378cfccf46a54f176723156359eb1.jpg\" alt=\"image\"><\/div>\n<p>  \u042f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u043d\u0430\u0434 \u043e\u0434\u043d\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0442\u0440\u0443\u0434\u043e\u043c \u0432\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 64\u043a \u043f\u0430\u043c\u044f\u0442\u0438 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u0418 \u043f\u043e\u0434\u0443\u043c\u0430\u043b\u043e\u0441\u044c \u043c\u043d\u0435, \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0440\u0430 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439 \u0431\u043e\u043b\u0435\u0435 \u0430\u0433\u0440\u0435\u0441\u0441\u0438\u0432\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435.  <\/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-313053","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313053","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=313053"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313053\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=313053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=313053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=313053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}