{"id":1521,"date":"2023-05-09T10:32:43","date_gmt":"2023-05-09T01:32:43","guid":{"rendered":"https:\/\/twarelab.com\/?p=1521"},"modified":"2023-05-09T10:33:15","modified_gmt":"2023-05-09T01:33:15","slug":"stm32f4-how-to-create-a-cpp-project-on-stm32cubide","status":"publish","type":"post","link":"https:\/\/twarelab.com\/en\/blog\/stm32f4-how-to-create-a-cpp-project-on-stm32cubide\/","title":{"rendered":"[STM32F4] STM32CubIDE\uc5d0\uc11c CPP Project \ub9cc\ub4e4\uae30"},"content":{"rendered":"<h2 class=\"wp-block-heading\">Creating an empty project<\/h2>\n\n\n\n<p>The following example is based on the TW100PC from twareLAB.<\/p>\n\n\n\n<p>Because the TW100PC is based on the STM32F405RG MCU, this MCU should be specified when creating a new project.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"790\" src=\"https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-2-1024x790.png\" alt=\"\" class=\"wp-image-1523\" srcset=\"https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-2-1024x790.png 1024w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-2-600x463.png 600w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-2-300x231.png 300w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-2-768x593.png 768w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-2-16x12.png 16w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-2.png 1423w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Name the project BaseGPIOTest.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"612\" height=\"625\" src=\"https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-3.png\" alt=\"\" class=\"wp-image-1524\" srcset=\"https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-3.png 612w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-3-600x613.png 600w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-3-294x300.png 294w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-3-12x12.png 12w\" sizes=\"auto, (max-width: 612px) 100vw, 612px\" \/><\/figure>\n\n\n\n<p> <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Clock configuration<\/h2>\n\n\n\n<p>Since the TW100PC uses a 12 MHz external clock source, the clock should be configured as follows.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">RCC Setup<\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-4-1024x576.png\" alt=\"\" class=\"wp-image-1525\" srcset=\"https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-4-1024x576.png 1024w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-4-600x338.png 600w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-4-300x169.png 300w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-4-768x432.png 768w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-4-1536x865.png 1536w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-4-18x10.png 18w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-4.png 1922w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Clock Configuration<\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-5-1024x576.png\" alt=\"\" class=\"wp-image-1526\" srcset=\"https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-5-1024x576.png 1024w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-5-600x338.png 600w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-5-300x169.png 300w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-5-768x432.png 768w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-5-1536x865.png 1536w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-5-18x10.png 18w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-5.png 1922w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Specify the library<\/h3>\n\n\n\n<p>Since RCC and GPIO use the LL Driver, change the driver to LL in the \u201cProject Manager\u201d tab under the \u201cAdvanced Settings\u201d section.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-6-1024x576.png\" alt=\"\" class=\"wp-image-1527\" srcset=\"https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-6-1024x576.png 1024w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-6-600x338.png 600w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-6-300x169.png 300w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-6-768x432.png 768w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-6-1536x865.png 1536w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-6-18x10.png 18w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-6.png 1922w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Generating Code<\/h3>\n\n\n\n<p>Select Project \u2192 Generate Code to generate the code with the settings you configured.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Build the binary<\/h3>\n\n\n\n<p>Run Project \u2192 Build Project to verify that the .elf file is generated correctly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Generate the Bin and Hex files<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Select Project \u2192 Properties to open the Properties window.<\/li>\n\n\n\n<li>Select C\/C++ Build \u2192 Settings, then go to the Tool Settings tab and choose MCU Post Build Outputs.<\/li>\n\n\n\n<li>In the checkbox list on the right, select Binary File and Intel Hex File.<\/li>\n\n\n\n<li>Click <strong>Apply and Close<\/strong>.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"822\" height=\"1024\" src=\"https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-7-822x1024.png\" alt=\"\" class=\"wp-image-1528\" srcset=\"https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-7-822x1024.png 822w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-7-600x747.png 600w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-7-241x300.png 241w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-7-768x957.png 768w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-7-10x12.png 10w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-7.png 827w\" sizes=\"auto, (max-width: 822px) 100vw, 822px\" \/><figcaption class=\"wp-element-caption\">Afterward, if you build the project again, you can verify that the .bin and .hex files are generated along with the .elf file.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"727\" height=\"400\" src=\"https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-8.png\" alt=\"\" class=\"wp-image-1529\" srcset=\"https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-8.png 727w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-8-600x330.png 600w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-8-300x165.png 300w, https:\/\/twarelab.com\/wp-content\/uploads\/2023\/05\/image-8-18x10.png 18w\" sizes=\"auto, (max-width: 727px) 100vw, 727px\" \/><\/figure>","protected":false},"excerpt":{"rendered":"<p>\ube48 \ud504\ub85c\uc81d\ud2b8 \uc0dd\uc131 \ubcf8 \uc608\uc81c\ub294 twareLAB\uc758 TW100PC\ub97c \uae30\ubc18\uc73c\ub85c \ud55c\ub2e4. TW100PC\ub294 STM32F405RG MCU\ub97c \uc0ac\uc6a9\ud558\uae30 \ub54c\ubb38\uc5d0 \uc0c8\ub85c\uc6b4 \ud504\ub85c\uc81d\ud2b8\ub97c \uc0dd\uc131\ud560 \ub54c MCU \uc120\ud0dd\uc744 \ud574\ub2f9 MCU\ub97c \uc9c0\uc815\ud574\uc57c \ud55c\ub2e4. \ud504\ub85c\uc81d\ud2b8 \uc774\ub984\uc740 BaseGPIOTest\ub77c\uace0 \uc9c0\uc815\ud55c\ub2e4. Clock \uc9c0\uc815 TW100PC\ub294 12MHz \uc678\ubd80 Clock \uc18c\uc2a4\ub97c \uc0ac\uc6a9\ud55c\ub2e4. \ub530\ub77c\uc11c Clock \uc124\uc815\uc740 \ub2e4\uc74c\uacfc \uac19\uc774 \ud55c\ub2e4. RCC \uc124\uc815 Clock Configuration Library type \uc9c0\uc815 RCC\uc640 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_themeisle_gutenberg_block_has_review":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1,12],"tags":[],"class_list":["post-1521","post","type-post","status-publish","format-standard","hentry","category-blog","category-ko"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/posts\/1521","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/comments?post=1521"}],"version-history":[{"count":3,"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/posts\/1521\/revisions"}],"predecessor-version":[{"id":1532,"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/posts\/1521\/revisions\/1532"}],"wp:attachment":[{"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/media?parent=1521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/categories?post=1521"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/twarelab.com\/en\/wp-json\/wp\/v2\/tags?post=1521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}