{"id":409593,"date":"2024-06-29T20:53:18","date_gmt":"2024-06-29T20:53:18","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=409593"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=409593","title":{"rendered":"<span>CLion + STM32 \u0431\u0435\u0437 \u0448\u0435\u043b\u0443\u0445\u0438<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/674\/412\/be4\/674412be4a44dd421d0d75ed1f962e49.png\" width=\"2560\" height=\"1600\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/674\/412\/be4\/674412be4a44dd421d0d75ed1f962e49.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u043a\u0440\u0430\u0442\u043a\u0438\u0439 \u0433\u0430\u0439\u0434 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441 \u043d\u0443\u043b\u044f \u0437\u0430\u0432\u0435\u0441\u0442\u0438 STM32 \u043f\u043e\u0434 CLion, \u0431\u0435\u0437 \u0448\u0435\u043b\u0443\u0445\u0438 \u0432 \u0432\u0438\u0434\u0435 HAL \u0438 STM32CubeMX. <\/p>\n<h2>\u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f<\/h2>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0433\u043e\u0434 \u043d\u0430\u0437\u0430\u0434 STMicroelectronics \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0441\u0432\u043e\u044e IDE \u043d\u0430 \u0431\u0430\u0437\u0435 Eclipse \u0438 CDT, \u043e\u043d\u0430 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0440\u044f\u0434 \u043c\u0438\u043d\u0443\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u043f\u043e \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0447\u0430\u0441\u0442\u0438, \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0432\u0430\u0435\u0442 CLion.<\/p>\n<p>\u041d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0440\u0430\u043d\u0435\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 <a href=\"https:\/\/habr.com\/ru\/post\/345670\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u044f<\/a>, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u0441\u0432\u044f\u0437\u043a\u0438 CLion + STM32, \u043d\u043e \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u0441\u0442\u0430\u0440\u0430\u044f, \u0430 \u043d\u043e\u0432\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 CLion \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c.<\/p>\n<p>\u0412 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439 \u043d\u0430 \u0442\u0435\u043c\u0443 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0432\u044f\u0437\u043a\u0443 CLion + STM32CubeMX, \u043d\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438 &#8212; \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u044f \u043e\u0447\u0435\u043d\u044c \u043f\u043b\u043e\u0445\u043e \u0438\u0441\u043a\u0430\u043b.<\/p>\n<p>\u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0441\u0435\u0440\u0438\u0438 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u043e\u0442 STMicroelectronics, \u043d\u043e \u0438 \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 \u0442\u0435 \u0436\u0435 \u0441\u0435\u0440\u0438\u0438 \u044f\u0434\u0435\u0440. <\/p>\n<h2>\u041c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f<\/h2>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435, STM32CubeIDE &#8212; \u0441\u0440\u0435\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0442 STMicroelectronics &#8212; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0440\u044f\u0434 \u043c\u0438\u043d\u0443\u0441\u043e\u0432, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 Eclipse \u0438 CDT \u0432 \u0446\u0435\u043b\u043e\u043c. \u0421\u0440\u0435\u0434\u0438 \u043d\u0438\u0445: \u043e\u0442\u0441\u0443\u0442\u0441\u0432\u0438\u0435 \u0430\u0432\u0442\u043e\u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430, \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u0432\u044b\u0448\u0435, \u0447\u0435\u043c C++14, \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0430\u043c\u044b\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0442\u0443\u043b\u0447\u0435\u0439\u043d \u0441 \u0441\u0430\u0439\u0442\u0430 ARM \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435. \u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b Eclipse \u0438 STM32CubeIDE \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 &#8212; \u043e\u043d\u0430 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0436\u0435\u043b\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435\u0433\u043e. \u0423 \u043c\u0435\u043d\u044f \u043d\u0435\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0441\u043b\u0443\u0447\u0430\u043b\u043e\u0441\u044c \u0442\u0430\u043a, \u0447\u0442\u043e \u044f \u0431\u044b\u043b \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043d\u043e\u0441\u0438\u0442\u044c IDE \u0438 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0435 \u0437\u0430\u043d\u043e\u0432\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u043e\u0448\u0438\u0431\u043a\u0430.<\/p>\n<h2>\u041f\u0430\u0440\u0443 \u0440\u0435\u043c\u0430\u0440\u043e\u043a<\/h2>\n<p>\u0412\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a \u0438 \u0442.\u0434. \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0434\u043b\u044f macOS, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0430. \u0422\u0430\u043a\u0436\u0435 \u044f \u0441\u0447\u0438\u0442\u0430\u044e \u0447\u0442\u043e \u0441 \u044d\u0442\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 (\u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 Linux \u0438 Windows) \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0445 \u043a\u0430\u043c\u043d\u0435\u0439 \u0438 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 C++. \u0412 \u043c\u043e\u0435\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e C++20. CLion \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u043e\u0442 C++98 \u0434\u043e C++23. \u0415\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 C90, C99, C11.<\/p>\n<h2>CLion<\/h2>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e IDE \u0440\u0430\u0434\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u0441\u0435 \u0437\u0430\u0442\u0435\u0432\u0430\u0435\u0442\u0441\u044f. \u041c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043d\u0430 <a href=\"https:\/\/www.jetbrains.com\/ru-ru\/clion\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0430\u0439\u0442\u0435 JetBrains<\/a> \u0438 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0441\u044f\u0447\u043d\u044b\u0439 \u0442\u0440\u0438\u0430\u043b. \u0414\u043b\u044f \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432\u044b\u0445 \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u0435\u043b\u0435\u0439 \u0441\u0442\u0443\u0434\u0435\u043d\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0431\u0438\u043b\u0435\u0442\u0430 <a href=\"https:\/\/www.jetbrains.com\/ru-ru\/community\/education\/#students\" rel=\"noopener noreferrer nofollow\">\u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c<\/a> \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0435\u0441\u044c \u0441\u043e\u0444\u0442 JetBrains \u0432 \u043f\u043e\u043b\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0430\u0446\u0438\u0438 \u0441\u0440\u043e\u043a\u043e\u043c \u043d\u0430 \u0433\u043e\u0434.<\/p>\n<h2>OpenOCD<\/h2>\n<p>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043d\u0430 \u0446\u0435\u043b\u0435\u0432\u043e\u043c (target) \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435. \u0421\u043a\u0430\u0447\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0441 <a href=\"http:\/\/openocd.org\/\" rel=\"noopener noreferrer nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430<\/a>. \u041b\u0438\u0431\u043e \u043d\u0430\u0431\u0440\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 (\u0434\u043b\u044f macOS) \u0447\u0442\u043e-\u0442\u043e \u0442\u0430\u043a\u043e\u0435: <\/p>\n<pre><code class=\"bash\">brew install openocd<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>What is brew?<\/summary>\n<div class=\"spoiler__content\">\n<p>\u042d\u0442\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0434\u043b\u044f macOS. \u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0447\u0442\u043e \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f apt-get \u0432 Ubuntu. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0442\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u0438 \u043a\u0430\u043a \u044d\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c <a href=\"https:\/\/brew.sh\/index_ru\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<\/div>\n<\/details>\n<h2>Toolchain<\/h2>\n<p>\u042d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0446\u0435\u043b\u0435\u0432\u044b\u043c (target) \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c. \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b, \u043b\u0438\u043d\u043a\u043e\u0432\u0449\u0438\u043a\u0438, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 \u043f\u0440\u043e\u0447\u0435\u0435. \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0441 <a href=\"https:\/\/developer.arm.com\/tools-and-software\/open-source-software\/developer-tools\/gnu-toolchain\/gnu-rm\/downloads\" rel=\"noopener noreferrer nofollow\">\u0441\u0430\u0439\u0442\u0430 ARM<\/a>. \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0432\u0435\u0440\u0441\u0438\u044f, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430\u044f \u043a \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435, <strong>gcc-arm-none-eabi-10.3-2021.07<\/strong>. \u0414\u043b\u044f macOS \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438: \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u0440\u0445\u0438\u0432, \u0438 .pkg \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442 \u0432\u0441\u0435 \u0441\u0430\u043c. \u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 macOS Catalina \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u0445\u0438\u043b\u043e \u0442\u0430\u043a \u043f\u043e\u0432\u043e\u0435\u0432\u0430\u0442\u044c \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043e\u0442 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430. \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0440\u0443\u0447\u043d\u0443\u044e <a href=\"https:\/\/www.architectryan.com\/2012\/10\/02\/add-to-the-path-on-mac-os-x-mountain-lion\/\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c<\/a> \u043f\u0443\u0442\u044c \u0434\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e $PATH, \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043c CLion \u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u0434\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u044d\u0442\u043e, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0441\u0432\u0435\u0436\u0443\u044e, \u043d\u043e \u043d\u0435 \u0441\u0430\u043c\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">brew install --cask gcc-arm-embedded<\/code><\/pre>\n<p>\u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f\u0445 brew &#8212; 10.2. <\/p>\n<h2>\u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c!<\/h2>\n<p>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0430 macOS \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e OpenOCD, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0432 CLion \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d brew, \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430. \u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0430\u043c \u0436\u0435. \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0438 \u043f\u0438\u0448\u0435\u043c:<\/p>\n<pre><code class=\"bash\">brew install openocd<\/code><\/pre>\n<p>\u0410 \u0437\u0430\u0442\u0435\u043c, \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 OpenOCD<\/p>\n<pre><code class=\"bash\">brew install --cask gcc-arm-embedded<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u043e\u043c \u043e\u043a\u043e\u043d\u0447\u0435\u043d\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c, \u0435\u0441\u043b\u0438 \u0435\u0449\u0435 \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e\u0433\u043e CLion. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c&#8230;<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4a7\/fdb\/094\/4a7fdb09467fc1b722dfabcc47e50759.png\" width=\"1588\" height=\"1196\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4a7\/fdb\/094\/4a7fdb09467fc1b722dfabcc47e50759.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c &#171;New Project&#187;. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043b\u0438\u0431\u043e \u0432\u0437\u044f\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 Git \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0439.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/914\/d14\/7ed\/914d147edda007861caaea70b28264d0.png\" width=\"1582\" height=\"1190\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/914\/d14\/7ed\/914d147edda007861caaea70b28264d0.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u044f\u0437\u044b\u043a\u0430.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 CLion \u043b\u0438\u0431\u043e \u0441\u0430\u043c \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442 \u0432\u0430\u0441 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u0434\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430, \u043b\u0438\u0431\u043e \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ac8\/eb9\/9ed\/ac8eb99ed2abfbc8897c7ccc20c9be78.png\" width=\"1864\" height=\"824\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ac8\/eb9\/9ed\/ac8eb99ed2abfbc8897c7ccc20c9be78.png\"\/><figcaption><\/figcaption><\/figure>\n<p>Settings->Preferences->Build, Execution, Deployment->Toolchains. \u0412 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u0439\u0441\u044f \u0432\u043a\u043b\u0430\u0434\u043a\u0435 \u0441\u043b\u0435\u0432\u0430 \u0441\u043f\u0438\u0441\u043e\u043a, \u043d\u0430\u0434 \u043d\u0438\u043c \u0438\u043a\u043e\u043d\u043a\u0430 &#171;+&#187;, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c System. \u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0430\u0442 \u0432\u0432\u0435\u0441\u0442\u0438 \u0438\u043c\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u043f\u0443\u0442\u0438 \u0434\u043e make \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 brew \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0442\u0443\u043b\u0447\u0435\u0439\u043d\u0430, \u0442\u043e \u043f\u0443\u0442\u0438 \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/57d\/257\/a0a\/57d257a0ab2a8e12152754e1342d9968.png\" width=\"1132\" height=\"576\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/57d\/257\/a0a\/57d257a0ab2a8e12152754e1342d9968.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f &#171;Ok&#187; \u0438\u043b\u0438 &#171;Apply&#187; \u0432 \u043f\u0440\u0430\u0432\u043e\u0439 \u043d\u0438\u0436\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043d\u0430\u0441 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u043e\u0434\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>Error<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">CMake Error at \/Applications\/CLion.app\/Contents\/bin\/cmake\/mac\/share\/cmake-3.20\/Modules\/CMakeTestCCompiler.cmake:66 (message):   The C compiler      \"\/usr\/local\/bin\/arm-none-eabi-gcc\"    is not able to compile a simple test program.<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e \u0432 \u044d\u0442\u043e\u043c \u043d\u0435\u0442, \u043f\u0440\u043e\u0441\u0442\u043e CMake \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0442\u0435\u0441\u0442 \u0434\u043b\u044f \u0445\u043e\u0441\u0442\u043e\u0432\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b (\u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442) \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u043a\u0430\u043a-\u0442\u043e \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b CMakeLists.txt \u0432 \u043f\u0430\u043f\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0440\u0435\u0434\u0430\u0447\u0438\u0442\u044c&#8230; \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0443\u0436\u0435 \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e CMakeLists.txt \u0444\u0430\u0439\u043b\u0430, \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043b\u0438\u0448\u044c \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c.<\/p>\n<details class=\"spoiler\">\n<summary>CMakeLists.txt<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cmake\">#\u0418\u043c\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0431\u043e\u0440\u043a\u0430 \u0438 \u0435\u0435 \u0432\u0435\u0440\u0441\u0438\u044f set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_SYSTEM_VERSION 1)  #\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u0440\u0435\u0441\u0438\u044f CMake \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 cmake_minimum_required(VERSION 3.20)  #\u041d\u0438\u0436\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0438\u043c\u0435\u043d\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432 \u0438 \u0443\u0442\u0438\u043b\u0438\u0442 \u0442\u0443\u043b\u0447\u0435\u0439\u043d\u0430 #CXX - \u043a\u043e\u043c\u043f\u0438\u044f\u043b\u0442\u043e\u0440 C++ set(CMAKE_C_COMPILER arm-none-eabi-gcc) set(CMAKE_CXX_COMPILER arm-none-eabi-g++) set(CMAKE_ASM_COMPILER  arm-none-eabi-gcc) set(CMAKE_AR arm-none-eabi-ar) set(CMAKE_OBJCOPY arm-none-eabi-objcopy) set(CMAKE_OBJDUMP arm-none-eabi-objdump) set(SIZE arm-none-eabi-size)  #\u0418\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u0434 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u0430 \u043d\u0435 \u043f\u043e\u0434 \u0445\u043e\u0441\u0442 #\u043d\u0443\u0436\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c CMAKE set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)  #\u0418\u043c\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 project(test_stm32f0 C CXX ASM)  #\u0418\u043c\u044f \u044f\u0434\u0440\u0430 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 set(CMAKE_SYSTEM_PROCESSOR cortex-m0) #\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 set(CMAKE_EXECUTABLE_SUFFIX \".elf\")  #\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u044b C++ \u0438 C \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 set(CMAKE_CXX_STANDARD 20) set(CMAKE_C_STANDARD 11)  #\u0418\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u043b\u0438\u043d\u043a\u0435\u0440\u0430 \u043f\u043e\u0434 \u0432\u0430\u0448 \u041c\u041a set(LINKER_SCRIPT_NAME STM32F072RBTX_FLASH) #\u0410 \u0442\u0430\u043a \u0436\u0435 \u043f\u0443\u0442\u044c \u0434\u043e \u043d\u0435\u0433\u043e. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0435 \u0441\u043a\u0440\u0438\u043f\u0442 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043f\u0430\u043f\u043a\u0435 startup \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 set(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}\/startup\/${LINKER_SCRIPT_NAME}.ld)  # \u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0443\u0442 \u0444\u043b\u0430\u0433\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 (\u0421\u0438, \u0421\u0438++ \u0438 \u0410\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440) # \u0422\u0430\u043a \u043a\u0430\u043a \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u043d\u0443\u0436\u0434 \u044f \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043b \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 STM32CubeIDE, \u0432\u0441\u0435 \u0444\u043b\u0430\u0433\u0438 \u043f\u0435\u0440\u0435\u0448\u043b\u0438 \u043e\u0442\u0442\u0443\u0434\u0430 \u0436\u0435 # \u041e\u043f\u0446\u0438\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043e\u0444\u0444 \u0441\u0430\u0439\u0442\u0435 https:\/\/gcc.gnu.org\/onlinedocs\/gcc\/ARM-Options.html # \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u043b\u0430\u0433\u0438: # -mcpu - \u044f\u0434\u0440\u043e \u041c\u041a # -g - \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 # -std - \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u044f\u0437\u044b\u043a\u0430, gcc \u0434\u043b\u044f C, g++ (\u0438\u043b\u0438 c++) \u0434\u043b\u044f C++ # -O - \u0441\u0442\u0435\u043f\u0435\u043d\u044c (\u0438\u043b\u0438 \u0442\u0438\u043f) \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. -O0 - \u0431\u0435\u0437 \u043e\u043f\u0442\u0438\u043c\u0437\u0430\u0446\u0438\u0438, # -O1, -O2, -O3 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0442 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u043a \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0439, \u0447\u0435\u043c \u0432\u044b\u0448\u0435 \u0446\u0438\u0444\u0440\u0430, \u0442\u0435\u043c \u0441\u0438\u043b\u044c\u043d\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f # \u0441\u0442\u043e\u0438\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0447\u0442\u043e \u0447\u0435\u043c \u0432\u044b\u0448\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0442\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0434\u0435\u0431\u0430\u0433\u0430 # -Os - \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0443, \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 # -Ofast - \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 # -Og - \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0434\u0435\u0431\u0430\u0433\u0430 set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -mcpu=${CMAKE_SYSTEM_PROCESSOR} -g3 -std=gnu++${CMAKE_CXX_STANDARD} -Os -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-use-cxa-atexit -Wall -std=gnu++2a -fstack-usage --specs=nano.specs -mfloat-abi=soft -mthumb\") set(CMAKE_C_FLAGS \"${CMAKE_C_FLAGS} -mcpu=${CMAKE_SYSTEM_PROCESSOR} -std=gnu${CMAKE_C_STANDARD} -g3 -Os -ffunction-sections -fdata-sections -fno-strict-aliasing -Wall -fstack-usage --specs=nano.specs -mfloat-abi=soft -mthumb\") set(CMAKE_EXE_LINKER_FLAGS \"-mcpu=${CMAKE_SYSTEM_PROCESSOR} -g3 -T ${LINKER_SCRIPT} --specs=nosys.specs -Wl,-Map=${PROJECT_NAME}.map  -Wl,--gc-sections -static --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group\") set(CMAKE_ASM_FLAGS \"-mcpu=${CMAKE_SYSTEM_PROCESSOR} -g3 -c -x assembler-with-cpp --specs=nano.specs -mfloat-abi=soft -mthumb\")  #\u0413\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0441 \u0442\u0430\u043a\u0438\u043c-\u0442\u043e \u043b\u0438\u043d\u043a\u043e\u0432\u0449\u0438\u043a\u043e\u043c \u0438 \u0442.\u0434. set(CMAKE_C_LINK_EXECUTABLE \"&lt;CMAKE_C_COMPILER> &lt;LINK_FLAGS> -o &lt;TARGET> &lt;OBJECTS>\") set(CMAKE_CXX_LINK_EXECUTABLE \"&lt;CMAKE_CXX_COMPILER> &lt;LINK_FLAGS> -o &lt;TARGET> &lt;OBJECTS>\")  #\u0418\u043c\u044f \u0438 \u043f\u0443\u0442\u044c \u043a \u0441\u0442\u0430\u0440\u0442\u0430\u043f \u0444\u0430\u0439\u043b\u0443 set(STARTUP_FILE_NAME startup_stm32f072rbtx) set(STARTUP_LOCATION \"${CMAKE_SOURCE_DIR}\/startup\/${STARTUP_FILE_NAME}.s\")  #\u041f\u0443\u0442\u0438 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043b\u0435\u0436\u0430\u0442 \u0438\u043d\u043a\u043b\u0443\u0434\u044b, '.' \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043a\u043e\u0440\u0435\u043d\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 include_directories(.) include_directories(cmsis)  #\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0435\u0444\u0430\u0439\u043d, \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f CMSIS add_definitions(-DSTM32F072xB)  #\u0438\u043c\u0435\u043d\u0430 .cpp, .c \u0438 .s \u0444\u0430\u0439\u043b\u043e\u0432 set(SOURCE_FILES main.cpp syscalls.c cmsis\/system_stm32f0xx.c) #\u0438\u043c\u0435\u043d\u0430 \u0445\u0435\u0434\u0435\u0440\u043e\u0432 set(INCLUDE_FILES cmsis\/cmsis_compiler.h cmsis\/cmsis_gcc.h cmsis\/cmsis_version.h cmsis\/core_cm0.h cmsis\/stm32f072xb.h cmsis\/stm32f0xx.h cmsis\/system_stm32f0xx.h)  #\u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0438 \u043b\u0438\u043d\u043a\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 .elf add_executable(${PROJECT_NAME} ${STARTUP_LOCATION} ${INCLUDE_FILES} ${SOURCE_FILES})  #\u041f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u043c .elf \u0432 .hex add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_OBJCOPY} ARGS -Oihex ${PROJECT_NAME}.elf ${PROJECT_NAME}.hex) #\u041f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u043c .elf \u0432 .bin add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_OBJCOPY} ARGS -Obinary ${PROJECT_NAME}.elf ${PROJECT_NAME}.bin) #\u0412\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u0441\u0435\u043a\u0446\u0438\u0439 .bss, .data \u0438 \u0442.\u0434., \u0430 \u0442\u0430\u043a \u0436\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${SIZE} ARGS --format=berkeley ${PROJECT_NAME}.elf)<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0427\u0442\u043e\u0431\u044b \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043f\u043e\u0434 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u0447\u043a\u0438 <\/p>\n<pre><code class=\"cmake\">#\u0418\u043c\u044f \u044f\u0434\u0440\u0430 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 set(CMAKE_SYSTEM_PROCESSOR cortex-m0)  #\u0418\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u043b\u0438\u043d\u043a\u0435\u0440\u0430 \u043f\u043e\u0434 \u0432\u0430\u0448 \u041c\u041a set(LINKER_SCRIPT_NAME STM32F072RBTX_FLASH) #\u0410 \u0442\u0430\u043a \u0436\u0435 \u043f\u0443\u0442\u044c \u0434\u043e \u043d\u0435\u0433\u043e. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0435 \u0441\u043a\u0440\u0438\u043f\u0442 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043f\u0430\u043f\u043a\u0435 startup \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 set(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}\/startup\/${LINKER_SCRIPT_NAME}.ld)  #\u0418\u043c\u044f \u0438 \u043f\u0443\u0442\u044c \u043a \u0441\u0442\u0430\u0440\u0442\u0430\u043f \u0444\u0430\u0439\u043b\u0443 set(STARTUP_FILE_NAME startup_stm32f072rbtx) set(STARTUP_LOCATION \"${CMAKE_SOURCE_DIR}\/startup\/${STARTUP_FILE_NAME}.s\")  #\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0435\u0444\u0430\u0439\u043d, \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f CMSIS add_definitions(-DSTM32F072xB)<\/code><\/pre>\n<p>\u0418 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435. \u041f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e&#8230;<\/p>\n<pre><code class=\"cmake\">set(CMAKE_CXX_STANDARD 20) set(CMAKE_C_STANDARD 11)  set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -mcpu=${CMAKE_SYSTEM_PROCESSOR} -g3 -std=gnu++${CMAKE_CXX_STANDARD} -Os -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-use-cxa-atexit -Wall -std=gnu++2a -fstack-usage --specs=nano.specs -mfloat-abi=soft -mthumb\") set(CMAKE_C_FLAGS \"${CMAKE_C_FLAGS} -mcpu=${CMAKE_SYSTEM_PROCESSOR} -std=gnu${CMAKE_C_STANDARD} -g3 -Os -ffunction-sections -fdata-sections -fno-strict-aliasing -Wall -fstack-usage --specs=nano.specs -mfloat-abi=soft -mthumb\") set(CMAKE_EXE_LINKER_FLAGS \"-mcpu=${CMAKE_SYSTEM_PROCESSOR} -g3 -T ${LINKER_SCRIPT} --specs=nosys.specs -Wl,-Map=${PROJECT_NAME}.map  -Wl,--gc-sections -static --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group\") set(CMAKE_ASM_FLAGS \"-mcpu=${CMAKE_SYSTEM_PROCESSOR} -g3 -c -x assembler-with-cpp --specs=nano.specs -mfloat-abi=soft -mthumb\")  include_directories(.) include_directories(cmsis)<\/code><\/pre>\n<p>\u0423\u0445, \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u043d\u043e \u0441\u0430\u043c\u043e\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0435 \u043f\u043e\u0437\u0430\u0434\u0438! \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/500\/525\/b97\/500525b97cb68c4900cf187cdae2290f.png\" width=\"1652\" height=\"1188\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/500\/525\/b97\/500525b97cb68c4900cf187cdae2290f.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/351\/88e\/338\/35188e338631fe70a3a9876518503866.png\" width=\"1662\" height=\"1192\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/351\/88e\/338\/35188e338631fe70a3a9876518503866.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u0435 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043f\u0443\u0442\u044f\u043c\u0438 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432.<\/p>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u0432\u0441\u0435. \u041d\u0430 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u043e\u0434\u043d\u0430 \u043c\u0435\u043b\u043e\u0447\u044c, \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u0430\u044f. \u041f\u0440\u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u041c\u041a. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c .svd \u0444\u0430\u0439\u043b. \u0418\u0445 \u043f\u043e\u0434 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c <a href=\"https:\/\/github.com\/posborne\/cmsis-svd\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c \u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u043b, \u0438 \u0443 \u0432\u0430\u0441 \u0442\u043e\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 CLion. \u0421\u0442\u0430\u0442\u044c\u044e \u044f \u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0441 \u0443\u043f\u043e\u0440\u043e\u043c \u043d\u0430 \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432 \u0438, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u044f \u0438\u043c \u0445\u043e\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043c\u043e\u0433. \u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435, \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d <a href=\"https:\/\/github.com\/in-text\/CLion_stm32_test_project.git\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>. \u0422\u0430\u043c \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 CMSIS \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0440\u0433\u0430\u043d\u0438\u044f \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c. \u0415\u0441\u043b\u0438 \u0447\u0442\u043e, \u043f\u043b\u0430\u0442\u0430 NUCLEO-F072RB.<\/p>\n<h2>\u041f\u0430\u0440\u043e\u0447\u043a\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c<\/h2>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441 \u043a \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c:<\/p>\n<ol>\n<li>\n<p>\u041a\u0430\u043a \u043f\u0435\u0440\u0435\u043a\u0440\u0430\u0441\u0438\u0442\u044c \u0446\u0432\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0430 OpenOCD \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c? \u041e\u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u043b\u043e\u0432\u0435\u0449\u0438\u043c \u043a\u0440\u0430\u0441\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c, \u0438 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0447\u0442\u043e \u044d\u0442\u043e \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430, \u0445\u043e\u0442\u044f \u0432\u0441\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e&#8230;<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u0442\u044c \u043b\u0438 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u043b\u0430\u0433\u0438\u043d \u043f\u043e \u0442\u0438\u043f\u0443 \u0442\u043e\u0433\u043e, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0435\u0441\u0442\u044c \u0432 STM32CubeIDE, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0435\u0441\u044f \u043c\u0435\u0441\u0442\u043e \u0432 RAM \u0438 ROM (\u0432 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438)?<\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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\/ru\/articles\/572044\/\"> https:\/\/habr.com\/ru\/articles\/572044\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u043a\u0440\u0430\u0442\u043a\u0438\u0439 \u0433\u0430\u0439\u0434 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441 \u043d\u0443\u043b\u044f \u0437\u0430\u0432\u0435\u0441\u0442\u0438 STM32 \u043f\u043e\u0434 CLion, \u0431\u0435\u0437 \u0448\u0435\u043b\u0443\u0445\u0438 \u0432 \u0432\u0438\u0434\u0435 HAL \u0438 STM32CubeMX. <\/p>\n<h2>\u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f<\/h2>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0433\u043e\u0434 \u043d\u0430\u0437\u0430\u0434 STMicroelectronics \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0441\u0432\u043e\u044e IDE \u043d\u0430 \u0431\u0430\u0437\u0435 Eclipse \u0438 CDT, \u043e\u043d\u0430 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0440\u044f\u0434 \u043c\u0438\u043d\u0443\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u043f\u043e \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0447\u0430\u0441\u0442\u0438, \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0432\u0430\u0435\u0442 CLion.<\/p>\n<p>\u041d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0440\u0430\u043d\u0435\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 <a href=\"https:\/\/habr.com\/ru\/post\/345670\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u044f<\/a>, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u0441\u0432\u044f\u0437\u043a\u0438 CLion + STM32, \u043d\u043e \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u0441\u0442\u0430\u0440\u0430\u044f, \u0430 \u043d\u043e\u0432\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 CLion \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c.<\/p>\n<p>\u0412 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439 \u043d\u0430 \u0442\u0435\u043c\u0443 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0432\u044f\u0437\u043a\u0443 CLion + STM32CubeMX, \u043d\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438 &#8212; \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u044f \u043e\u0447\u0435\u043d\u044c \u043f\u043b\u043e\u0445\u043e \u0438\u0441\u043a\u0430\u043b.<\/p>\n<p>\u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0441\u0435\u0440\u0438\u0438 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u043e\u0442 STMicroelectronics, \u043d\u043e \u0438 \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 \u0442\u0435 \u0436\u0435 \u0441\u0435\u0440\u0438\u0438 \u044f\u0434\u0435\u0440. <\/p>\n<h2>\u041c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f<\/h2>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435, STM32CubeIDE &#8212; \u0441\u0440\u0435\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0442 STMicroelectronics &#8212; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0440\u044f\u0434 \u043c\u0438\u043d\u0443\u0441\u043e\u0432, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 Eclipse \u0438 CDT \u0432 \u0446\u0435\u043b\u043e\u043c. \u0421\u0440\u0435\u0434\u0438 \u043d\u0438\u0445: \u043e\u0442\u0441\u0443\u0442\u0441\u0432\u0438\u0435 \u0430\u0432\u0442\u043e\u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430, \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u0432\u044b\u0448\u0435, \u0447\u0435\u043c C++14, \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0430\u043c\u044b\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0442\u0443\u043b\u0447\u0435\u0439\u043d \u0441 \u0441\u0430\u0439\u0442\u0430 ARM \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435. \u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b Eclipse \u0438 STM32CubeIDE \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 &#8212; \u043e\u043d\u0430 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0436\u0435\u043b\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435\u0433\u043e. \u0423 \u043c\u0435\u043d\u044f \u043d\u0435\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0441\u043b\u0443\u0447\u0430\u043b\u043e\u0441\u044c \u0442\u0430\u043a, \u0447\u0442\u043e \u044f \u0431\u044b\u043b \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043d\u043e\u0441\u0438\u0442\u044c IDE \u0438 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0435 \u0437\u0430\u043d\u043e\u0432\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u043e\u0448\u0438\u0431\u043a\u0430.<\/p>\n<h2>\u041f\u0430\u0440\u0443 \u0440\u0435\u043c\u0430\u0440\u043e\u043a<\/h2>\n<p>\u0412\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a \u0438 \u0442.\u0434. \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0434\u043b\u044f macOS, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0430. \u0422\u0430\u043a\u0436\u0435 \u044f \u0441\u0447\u0438\u0442\u0430\u044e \u0447\u0442\u043e \u0441 \u044d\u0442\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 (\u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 Linux \u0438 Windows) \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0445 \u043a\u0430\u043c\u043d\u0435\u0439 \u0438 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 C++. \u0412 \u043c\u043e\u0435\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e C++20. CLion \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u043e\u0442 C++98 \u0434\u043e C++23. \u0415\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 C90, C99, C11.<\/p>\n<h2>CLion<\/h2>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e IDE \u0440\u0430\u0434\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u0441\u0435 \u0437\u0430\u0442\u0435\u0432\u0430\u0435\u0442\u0441\u044f. \u041c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043d\u0430 <a href=\"https:\/\/www.jetbrains.com\/ru-ru\/clion\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0430\u0439\u0442\u0435 JetBrains<\/a> \u0438 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0441\u044f\u0447\u043d\u044b\u0439 \u0442\u0440\u0438\u0430\u043b. \u0414\u043b\u044f \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432\u044b\u0445 \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u0435\u043b\u0435\u0439 \u0441\u0442\u0443\u0434\u0435\u043d\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0431\u0438\u043b\u0435\u0442\u0430 <a href=\"https:\/\/www.jetbrains.com\/ru-ru\/community\/education\/#students\" rel=\"noopener noreferrer nofollow\">\u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c<\/a> \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0435\u0441\u044c \u0441\u043e\u0444\u0442 JetBrains \u0432 \u043f\u043e\u043b\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0430\u0446\u0438\u0438 \u0441\u0440\u043e\u043a\u043e\u043c \u043d\u0430 \u0433\u043e\u0434.<\/p>\n<h2>OpenOCD<\/h2>\n<p>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043d\u0430 \u0446\u0435\u043b\u0435\u0432\u043e\u043c (target) \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435. \u0421\u043a\u0430\u0447\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0441 <a href=\"http:\/\/openocd.org\/\" rel=\"noopener noreferrer nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430<\/a>. \u041b\u0438\u0431\u043e \u043d\u0430\u0431\u0440\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 (\u0434\u043b\u044f macOS) \u0447\u0442\u043e-\u0442\u043e \u0442\u0430\u043a\u043e\u0435: <\/p>\n<pre><code class=\"bash\">brew install openocd<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>What is brew?<\/summary>\n<div class=\"spoiler__content\">\n<p>\u042d\u0442\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0434\u043b\u044f macOS. \u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0447\u0442\u043e \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f apt-get \u0432 Ubuntu. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0442\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u0438 \u043a\u0430\u043a \u044d\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c <a href=\"https:\/\/brew.sh\/index_ru\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<\/div>\n<\/details>\n<h2>Toolchain<\/h2>\n<p>\u042d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0446\u0435\u043b\u0435\u0432\u044b\u043c (target) \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c. \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b, \u043b\u0438\u043d\u043a\u043e\u0432\u0449\u0438\u043a\u0438, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 \u043f\u0440\u043e\u0447\u0435\u0435. \u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0441 <a href=\"https:\/\/developer.arm.com\/tools-and-software\/open-source-software\/developer-tools\/gnu-toolchain\/gnu-rm\/downloads\" rel=\"noopener noreferrer nofollow\">\u0441\u0430\u0439\u0442\u0430 ARM<\/a>. \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0432\u0435\u0440\u0441\u0438\u044f, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430\u044f \u043a \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435, <strong>gcc-arm-none-eabi-10.3-2021.07<\/strong>. \u0414\u043b\u044f macOS \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438: \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u0440\u0445\u0438\u0432, \u0438 .pkg \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442 \u0432\u0441\u0435 \u0441\u0430\u043c. \u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 macOS Catalina \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u0445\u0438\u043b\u043e \u0442\u0430\u043a \u043f\u043e\u0432\u043e\u0435\u0432\u0430\u0442\u044c \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043e\u0442 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430. \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0440\u0443\u0447\u043d\u0443\u044e <a href=\"https:\/\/www.architectryan.com\/2012\/10\/02\/add-to-the-path-on-mac-os-x-mountain-lion\/\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c<\/a> \u043f\u0443\u0442\u044c \u0434\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e $PATH, \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043c CLion \u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u0434\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u044d\u0442\u043e, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0441\u0432\u0435\u0436\u0443\u044e, \u043d\u043e \u043d\u0435 \u0441\u0430\u043c\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">brew install --cask gcc-arm-embedded<\/code><\/pre>\n<p>\u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f\u0445 brew &#8212; 10.2. <\/p>\n<h2>\u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c!<\/h2>\n<p>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0430 macOS \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e OpenOCD, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0432 CLion \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d brew, \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430. \u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0430\u043c \u0436\u0435. \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0438 \u043f\u0438\u0448\u0435\u043c:<\/p>\n<pre><code class=\"bash\">brew install openocd<\/code><\/pre>\n<p>\u0410 \u0437\u0430\u0442\u0435\u043c, \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 OpenOCD<\/p>\n<pre><code class=\"bash\">brew install --cask gcc-arm-embedded<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u043e\u043c \u043e\u043a\u043e\u043d\u0447\u0435\u043d\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c, \u0435\u0441\u043b\u0438 \u0435\u0449\u0435 \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e\u0433\u043e CLion. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c&#8230;<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c &#171;New Project&#187;. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043b\u0438\u0431\u043e \u0432\u0437\u044f\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 Git \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0439.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u044f\u0437\u044b\u043a\u0430.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 CLion \u043b\u0438\u0431\u043e \u0441\u0430\u043c \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442 \u0432\u0430\u0441 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u0434\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430, \u043b\u0438\u0431\u043e \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>Settings->Preferences->Build, Execution, Deployment->Toolchains. \u0412 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u0439\u0441\u044f \u0432\u043a\u043b\u0430\u0434\u043a\u0435 \u0441\u043b\u0435\u0432\u0430 \u0441\u043f\u0438\u0441\u043e\u043a, \u043d\u0430\u0434 \u043d\u0438\u043c \u0438\u043a\u043e\u043d\u043a\u0430 &#171;+&#187;, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c System. \u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0430\u0442 \u0432\u0432\u0435\u0441\u0442\u0438 \u0438\u043c\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u043f\u0443\u0442\u0438 \u0434\u043e make \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 brew \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0442\u0443\u043b\u0447\u0435\u0439\u043d\u0430, \u0442\u043e \u043f\u0443\u0442\u0438 \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f &#171;Ok&#187; \u0438\u043b\u0438 &#171;Apply&#187; \u0432 \u043f\u0440\u0430\u0432\u043e\u0439 \u043d\u0438\u0436\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043d\u0430\u0441 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u043e\u0434\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>Error<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">CMake Error at \/Applications\/CLion.app\/Contents\/bin\/cmake\/mac\/share\/cmake-3.20\/Modules\/CMakeTestCCompiler.cmake:66 (message):   The C compiler      \"\/usr\/local\/bin\/arm-none-eabi-gcc\"    is not able to compile a simple test program.<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e \u0432 \u044d\u0442\u043e\u043c \u043d\u0435\u0442, \u043f\u0440\u043e\u0441\u0442\u043e CMake \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0442\u0435\u0441\u0442 \u0434\u043b\u044f \u0445\u043e\u0441\u0442\u043e\u0432\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b (\u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442) \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u043a\u0430\u043a-\u0442\u043e \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b CMakeLists.txt \u0432 \u043f\u0430\u043f\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0440\u0435\u0434\u0430\u0447\u0438\u0442\u044c&#8230; \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0443\u0436\u0435 \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e CMakeLists.txt \u0444\u0430\u0439\u043b\u0430, \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043b\u0438\u0448\u044c \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c.<\/p>\n<details class=\"spoiler\">\n<summary>CMakeLists.txt<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cmake\">#\u0418\u043c\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0431\u043e\u0440\u043a\u0430 \u0438 \u0435\u0435 \u0432\u0435\u0440\u0441\u0438\u044f set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_SYSTEM_VERSION 1)  #\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u0440\u0435\u0441\u0438\u044f CMake \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 cmake_minimum_required(VERSION 3.20)  #\u041d\u0438\u0436\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0438\u043c\u0435\u043d\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432 \u0438 \u0443\u0442\u0438\u043b\u0438\u0442 \u0442\u0443\u043b\u0447\u0435\u0439\u043d\u0430 #CXX - \u043a\u043e\u043c\u043f\u0438\u044f\u043b\u0442\u043e\u0440 C++ set(CMAKE_C_COMPILER arm-none-eabi-gcc) set(CMAKE_CXX_COMPILER arm-none-eabi-g++) set(CMAKE_ASM_COMPILER  arm-none-eabi-gcc) set(CMAKE_AR arm-none-eabi-ar) set(CMAKE_OBJCOPY arm-none-eabi-objcopy) set(CMAKE_OBJDUMP arm-none-eabi-objdump) set(SIZE arm-none-eabi-size)  #\u0418\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u0434 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u0430 \u043d\u0435 \u043f\u043e\u0434 \u0445\u043e\u0441\u0442 #\u043d\u0443\u0436\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c CMAKE set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)  #\u0418\u043c\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 project(test_stm32f0 C CXX ASM)  #\u0418\u043c\u044f \u044f\u0434\u0440\u0430 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 set(CMAKE_SYSTEM_PROCESSOR cortex-m0) #\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 set(CMAKE_EXECUTABLE_SUFFIX \".elf\")  #\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u044b C++ \u0438 C \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 set(CMAKE_CXX_STANDARD 20) set(CMAKE_C_STANDARD 11)  #\u0418\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u043b\u0438\u043d\u043a\u0435\u0440\u0430 \u043f\u043e\u0434 \u0432\u0430\u0448 \u041c\u041a set(LINKER_SCRIPT_NAME STM32F072RBTX_FLASH) #\u0410 \u0442\u0430\u043a \u0436\u0435 \u043f\u0443\u0442\u044c \u0434\u043e \u043d\u0435\u0433\u043e. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0435 \u0441\u043a\u0440\u0438\u043f\u0442 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043f\u0430\u043f\u043a\u0435 startup \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 set(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}\/startup\/${LINKER_SCRIPT_NAME}.ld)  # \u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0443\u0442 \u0444\u043b\u0430\u0433\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 (\u0421\u0438, \u0421\u0438++ \u0438 \u0410\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440) # \u0422\u0430\u043a \u043a\u0430\u043a \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u043d\u0443\u0436\u0434 \u044f \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043b \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 STM32CubeIDE, \u0432\u0441\u0435 \u0444\u043b\u0430\u0433\u0438 \u043f\u0435\u0440\u0435\u0448\u043b\u0438 \u043e\u0442\u0442\u0443\u0434\u0430 \u0436\u0435 # \u041e\u043f\u0446\u0438\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043e\u0444\u0444 \u0441\u0430\u0439\u0442\u0435 https:\/\/gcc.gnu.org\/onlinedocs\/gcc\/ARM-Options.html # \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u043b\u0430\u0433\u0438: # -mcpu - \u044f\u0434\u0440\u043e \u041c\u041a # -g - \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 # -std - \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u044f\u0437\u044b\u043a\u0430, gcc \u0434\u043b\u044f C, g++ (\u0438\u043b\u0438 c++) \u0434\u043b\u044f C++ # -O - \u0441\u0442\u0435\u043f\u0435\u043d\u044c (\u0438\u043b\u0438 \u0442\u0438\u043f) \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. -O0 - \u0431\u0435\u0437 \u043e\u043f\u0442\u0438\u043c\u0437\u0430\u0446\u0438\u0438, # -O1, -O2, -O3 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0442 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u043a \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0439, \u0447\u0435\u043c \u0432\u044b\u0448\u0435 \u0446\u0438\u0444\u0440\u0430, \u0442\u0435\u043c \u0441\u0438\u043b\u044c\u043d\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f # \u0441\u0442\u043e\u0438\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0447\u0442\u043e \u0447\u0435\u043c \u0432\u044b\u0448\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0442\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0434\u0435\u0431\u0430\u0433\u0430 # -Os - \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0443, \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 # -Ofast - \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 # -Og - \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0434\u0435\u0431\u0430\u0433\u0430 set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -mcpu=${CMAKE_SYSTEM_PROCESSOR} -g3 -std=gnu++${CMAKE_CXX_STANDARD} -Os -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-use-cxa-atexit -Wall -std=gnu++2a -fstack-usage --specs=nano.specs -mfloat-abi=soft -mthumb\") set(CMAKE_C_FLAGS \"${CMAKE_C_FLAGS} -mcpu=${CMAKE_SYSTEM_PROCESSOR} -std=gnu${CMAKE_C_STANDARD} -g3 -Os -ffunction-sections -fdata-sections -fno-strict-aliasing -Wall -fstack-usage --specs=nano.specs -mfloat-abi=soft -mthumb\") set(CMAKE_EXE_LINKER_FLAGS \"-mcpu=${CMAKE_SYSTEM_PROCESSOR} -g3 -T ${LINKER_SCRIPT} --specs=nosys.specs -Wl,-Map=${PROJECT_NAME}.map  -Wl,--gc-sections -static --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group\") set(CMAKE_ASM_FLAGS \"-mcpu=${CMAKE_SYSTEM_PROCESSOR} -g3 -c -x assembler-with-cpp --specs=nano.specs -mfloat-abi=soft -mthumb\")  #\u0413\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0441 \u0442\u0430\u043a\u0438\u043c-\u0442\u043e \u043b\u0438\u043d\u043a\u043e\u0432\u0449\u0438\u043a\u043e\u043c \u0438 \u0442.\u0434. set(CMAKE_C_LINK_EXECUTABLE \"&lt;CMAKE_C_COMPILER> &lt;LINK_FLAGS> -o &lt;TARGET> &lt;OBJECTS>\") set(CMAKE_CXX_LINK_EXECUTABLE \"&lt;CMAKE_CXX_COMPILER> &lt;LINK_FLAGS> -o &lt;TARGET> &lt;OBJECTS>\")  #\u0418\u043c\u044f \u0438 \u043f\u0443\u0442\u044c \u043a \u0441\u0442\u0430\u0440\u0442\u0430\u043f \u0444\u0430\u0439\u043b\u0443 set(STARTUP_FILE_NAME startup_stm32f072rbtx) set(STARTUP_LOCATION \"${CMAKE_SOURCE_DIR}\/startup\/${STARTUP_FILE_NAME}.s\")  #\u041f\u0443\u0442\u0438 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043b\u0435\u0436\u0430\u0442 \u0438\u043d\u043a\u043b\u0443\u0434\u044b, '.' \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043a\u043e\u0440\u0435\u043d\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 include_directories(.) include_directories(cmsis)  #\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0435\u0444\u0430\u0439\u043d, \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f CMSIS add_definitions(-DSTM32F072xB)  #\u0438\u043c\u0435\u043d\u0430 .cpp, .c \u0438 .s \u0444\u0430\u0439\u043b\u043e\u0432 set(SOURCE_FILES main.cpp syscalls.c cmsis\/system_stm32f0xx.c) #\u0438\u043c\u0435\u043d\u0430 \u0445\u0435\u0434\u0435\u0440\u043e\u0432 set(INCLUDE_FILES cmsis\/cmsis_compiler.h cmsis\/cmsis_gcc.h cmsis\/cmsis_version.h cmsis\/core_cm0.h cmsis\/stm32f072xb.h cmsis\/stm32f0xx.h cmsis\/system_stm32f0xx.h)  #\u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0438 \u043b\u0438\u043d\u043a\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 .elf add_executable(${PROJECT_NAME} ${STARTUP_LOCATION} ${INCLUDE_FILES} ${SOURCE_FILES})  #\u041f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u043c .elf \u0432 .hex add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_OBJCOPY} ARGS -Oihex ${PROJECT_NAME}.elf ${PROJECT_NAME}.hex) #\u041f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u043c .elf \u0432 .bin add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_OBJCOPY} ARGS -Obinary ${PROJECT_NAME}.elf ${PROJECT_NAME}.bin) #\u0412\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u0441\u0435\u043a\u0446\u0438\u0439 .bss, .data \u0438 \u0442.\u0434., \u0430 \u0442\u0430\u043a \u0436\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${SIZE} ARGS --format=berkeley ${PROJECT_NAME}.elf)<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0427\u0442\u043e\u0431\u044b \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043f\u043e\u0434 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u0447\u043a\u0438 <\/p>\n<pre><code class=\"cmake\">#\u0418\u043c\u044f \u044f\u0434\u0440\u0430 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 set(CMAKE_SYSTEM_PROCESSOR cortex-m0)  #\u0418\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u043b\u0438\u043d\u043a\u0435\u0440\u0430 \u043f\u043e\u0434 \u0432\u0430\u0448 \u041c\u041a set(LINKER_SCRIPT_NAME STM32F072RBTX_FLASH) #\u0410<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-409593","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/409593","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=409593"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/409593\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=409593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=409593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=409593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}