[{"data":1,"prerenderedAt":3644},["ShallowReactive",2],{"wiki-page-/en-us/wiki/2025-07-18-linux-stm32-cmake-vscode-huan-jing-da-jian/ch2-linux":3,"wiki-doc-items-/en-us/wiki/2025-07-18-linux-stm32-cmake-vscode-huan-jing-da-jian/ch2-linux":3610,"language-switcher-data-/en-us/wiki/2025-07-18-linux-stm32-cmake-vscode-huan-jing-da-jian/ch2-linux":3628,"wiki-i18n-paths-/en-us/wiki/2025-07-18-linux-stm32-cmake-vscode-huan-jing-da-jian/ch2-linux":3643},{"id":4,"title":5,"body":6,"canonicalPath":3591,"chapter":3592,"chapterSort":3593,"date":3594,"description":49,"docI18nKey":3595,"docKey":3596,"docRoot":3597,"docTitle":3598,"extension":3599,"i18nKey":3600,"isBlogPost":3601,"isWikiDoc":60,"isWikiIndex":3601,"layout":3602,"legacyPath":3602,"locale":3603,"localeSlug":3604,"meta":3605,"navigation":60,"path":3591,"seo":3606,"sourcePath":3607,"sourceStem":3600,"stem":3608,"wikiDepth":57,"__hash__":3609},"content/_i18n/en-us/wiki/2025-07-18-Linux-STM32-CMake-VScode环境搭建/ch2-Linux.md","Linux",{"type":7,"value":8,"toc":3586},"minimark",[9,14,18,31,34,38,43,129,135,138,146,151,156,161,166,169,174,177,190,193,290,293,316,321,324,333,338,341,345,350,353,361,367,372,377,380,385,392,415,420,423,428,434,448,453,456,461,468,473,476,481,484,489,492,497,500,509,512,623,626,631,636,640,646,651,654,657,662,673,682,685,701,706,709,718,723,726,731,734,742,750,754,757,908,911,916,921,926,932,937,940,945,948,958,961,977,980,992,997,1007,1010,1026,1031,1034,1042,1061,1064,1073,1078,1084,1087,1099,1113,1131,1136,1139,1151,1155,1160,1205,1210,1213,1216,1229,1234,1238,1242,1245,1288,1293,1296,1302,1307,1310,1313,1316,1321,1324,1329,1336,1341,1357,1362,1365,1374,1379,1382,1385,1390,1394,1400,1405,1410,1412,1414,1416,1421,1426,1431,1447,1452,1455,1458,1467,1472,1476,1483,1486,1491,1494,1499,1502,1507,1510,1515,1518,1523,1526,1533,1538,1562,1567,1572,1576,1580,1583,1588,1591,1596,1599,1604,1609,1612,1617,1622,1625,1630,1635,1638,1641,1646,1651,1655,1658,1663,1666,1678,1683,1686,1691,1694,1700,1705,1710,1735,1738,1743,1746,1765,1770,1773,1786,1789,1794,1824,1836,1839,1844,1848,1851,1856,1859,1864,1867,1872,1875,1880,1883,1888,1893,1896,1901,1904,1909,1914,1919,1934,1937,1942,1949,1954,1984,1989,1998,2004,2007,2012,2016,2027,2043,2049,2054,2076,2081,2084,2241,2244,2328,2338,2367,2372,2375,2380,2403,2406,2422,2427,2457,2462,2467,2477,2482,2487,2495,2498,2512,2517,2521,2525,2528,2531,2536,2539,2544,2638,2641,2646,2651,2654,2668,2673,2676,2681,2685,2689,2704,2707,2712,2715,2720,2725,2728,2733,2736,2741,2745,2748,2752,2755,2773,2776,2787,2792,2797,3302,3307,3321,3326,3329,3334,3339,3346,3351,3364,3370,3377,3382,3387,3392,3395,3400,3403,3411,3415,3419,3426,3431,3436,3439,3444,3449,3452,3457,3460,3465,3468,3473,3476,3481,3484,3489,3492,3497,3500,3513,3516,3521,3524,3529,3532,3537,3542,3546,3552,3558,3563,3566,3571,3577,3582],[10,11,13],"h3",{"id":12},"environment-introduction","Environment Introduction",[15,16,17],"p",{},"This tutorial covers the environment setup:",[19,20,21,25,28],"ol",{},[22,23,24],"li",{},"System: Fedora 42 KDE Edition Linux",[22,26,27],{},"System kernel: Linux 6.15.6-200.fc42.x86_64",[22,29,30],{},"Architecture: X86_64",[15,32,33],{},"Other Linux environments are also acceptable.",[10,35,37],{"id":36},"setting-up-various-environments","Setting up various environments",[39,40,42],"h4",{"id":41},"setting-up-the-cc-environment","Setting up the C/C++ environment",[44,45,50],"pre",{"className":46,"code":47,"language":48,"meta":49,"style":49},"language-bash shiki shiki-themes github-light github-dark","\n# debian系\nsudo apt-get install gcc g++ gdb cmake-gui make\n\n# rhel系\nsudo dnf install gcc g++ gdb cmake-gui make\n","bash","",[51,52,53,62,69,98,103,109],"code",{"__ignoreMap":49},[54,55,58],"span",{"class":56,"line":57},"line",1,[54,59,61],{"emptyLinePlaceholder":60},true,"\n",[54,63,65],{"class":56,"line":64},2,[54,66,68],{"class":67},"sJ8bj","# debian系\n",[54,70,72,76,80,83,86,89,92,95],{"class":56,"line":71},3,[54,73,75],{"class":74},"sScJk","sudo",[54,77,79],{"class":78},"sZZnC"," apt-get",[54,81,82],{"class":78}," install",[54,84,85],{"class":78}," gcc",[54,87,88],{"class":78}," g++",[54,90,91],{"class":78}," gdb",[54,93,94],{"class":78}," cmake-gui",[54,96,97],{"class":78}," make\n",[54,99,101],{"class":56,"line":100},4,[54,102,61],{"emptyLinePlaceholder":60},[54,104,106],{"class":56,"line":105},5,[54,107,108],{"class":67},"# rhel系\n",[54,110,112,114,117,119,121,123,125,127],{"class":56,"line":111},6,[54,113,75],{"class":74},[54,115,116],{"class":78}," dnf",[54,118,82],{"class":78},[54,120,85],{"class":78},[54,122,88],{"class":78},[54,124,91],{"class":78},[54,126,94],{"class":78},[54,128,97],{"class":78},[15,130,131],{},[132,133],"img",{"alt":49,"src":134},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image1.webp",[15,136,137],{},"Check whether the environment was installed successfully.",[44,139,144],{"className":140,"code":142,"language":143},[141],"language-text","gcc -v\ng++ -v\ngdb -v\ncmake --version\n","text",[51,145,142],{"__ignoreMap":49},[15,147,148],{},[132,149],{"alt":49,"src":150},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image2.webp",[15,152,153],{},[132,154],{"alt":49,"src":155},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image3.webp",[15,157,158],{},[132,159],{"alt":49,"src":160},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image4.webp",[15,162,163],{},[132,164],{"alt":49,"src":165},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image5.webp",[15,167,168],{},"Next, test whether C/C++ can be compiled normally. Find a folder containing C++ code, then cd into it in the terminal.",[15,170,171],{},[132,172],{"alt":49,"src":173},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image6.webp",[15,175,176],{},"Then create a .cpp file and edit it with vim.",[44,178,180],{"className":46,"code":179,"language":48,"meta":49,"style":49},"vim hello.cpp\n",[51,181,182],{"__ignoreMap":49},[54,183,184,187],{"class":56,"line":57},[54,185,186],{"class":74},"vim",[54,188,189],{"class":78}," hello.cpp\n",[15,191,192],{},"Copy the following code into this file.",[44,194,198],{"className":195,"code":196,"language":197,"meta":49,"style":49},"language-cpp shiki shiki-themes github-light github-dark","#include \u003Ciostream> \nint main(int argc,char **argv) \n{ \n    std::cout \u003C\u003C \"你好，机电创新学会！\" \u003C\u003C std::endl; \n    return 0; \n}\n","cpp",[51,199,200,213,245,250,273,285],{"__ignoreMap":49},[54,201,202,206,209],{"class":56,"line":57},[54,203,205],{"class":204},"szBVR","#include",[54,207,208],{"class":78}," \u003Ciostream>",[54,210,212],{"class":211},"sVt8B"," \n",[54,214,215,218,221,224,226,230,233,236,239,242],{"class":56,"line":64},[54,216,217],{"class":204},"int",[54,219,220],{"class":74}," main",[54,222,223],{"class":211},"(",[54,225,217],{"class":204},[54,227,229],{"class":228},"s4XuR"," argc",[54,231,232],{"class":211},",",[54,234,235],{"class":204},"char",[54,237,238],{"class":204}," **",[54,240,241],{"class":228},"argv",[54,243,244],{"class":211},") \n",[54,246,247],{"class":56,"line":71},[54,248,249],{"class":211},"{ \n",[54,251,252,255,258,261,264,267,270],{"class":56,"line":100},[54,253,254],{"class":74},"    std",[54,256,257],{"class":211},"::cout ",[54,259,260],{"class":204},"\u003C\u003C",[54,262,263],{"class":78}," \"你好，机电创新学会！\"",[54,265,266],{"class":204}," \u003C\u003C",[54,268,269],{"class":74}," std",[54,271,272],{"class":211},"::endl; \n",[54,274,275,278,282],{"class":56,"line":105},[54,276,277],{"class":204},"    return",[54,279,281],{"class":280},"sj4cs"," 0",[54,283,284],{"class":211},"; \n",[54,286,287],{"class":56,"line":111},[54,288,289],{"class":211},"}\n",[15,291,292],{},"Then compile",[44,294,296],{"className":46,"code":295,"language":48,"meta":49,"style":49},"g++ -o hello hello.cpp\nls\n",[51,297,298,311],{"__ignoreMap":49},[54,299,300,303,306,309],{"class":56,"line":57},[54,301,302],{"class":74},"g++",[54,304,305],{"class":280}," -o",[54,307,308],{"class":78}," hello",[54,310,189],{"class":78},[54,312,313],{"class":56,"line":64},[54,314,315],{"class":74},"ls\n",[15,317,318],{},[132,319],{"alt":49,"src":320},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image7.webp",[15,322,323],{},"Run",[44,325,327],{"className":46,"code":326,"language":48,"meta":49,"style":49},"./hello\n",[51,328,329],{"__ignoreMap":49},[54,330,331],{"class":56,"line":57},[54,332,326],{"class":74},[15,334,335],{},[132,336],{"alt":49,"src":337},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image8.webp",[15,339,340],{},"The environment is already set up.",[39,342,344],{"id":343},"install-cubemx","Install CubeMX",[15,346,347],{},[132,348],{"alt":49,"src":349},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image9.webp",[15,351,352],{},"Download link:",[15,354,355],{},[356,357,358],"a",{"href":358,"rel":359},"https://www.st.com.cn/zh/development-tools/stm32cubemx.html",[360],"nofollow",[15,362,363],{},[364,365,366],"strong",{},"It is recommended to download version 6.14.1 (do not download version 6.15.0, as this version has a bug, and it is unclear when it will be fixed).",[15,368,369],{},[132,370],{"alt":49,"src":371},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image10.webp",[15,373,374],{},[132,375],{"alt":49,"src":376},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image11.webp",[15,378,379],{},"Decompress it.",[15,381,382],{},[132,383],{"alt":49,"src":384},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image12.webp",[15,386,387,388,391],{},"Open this software with root privileges ",[51,389,390],{},"SetupSTM32CubeMX-6.15.0",".",[44,393,395],{"className":195,"code":394,"language":197,"meta":49,"style":49},"sudo ./SetupSTM32CubeMX-6.15.0\n",[51,396,397],{"__ignoreMap":49},[54,398,399,402,405,408,411],{"class":56,"line":57},[54,400,401],{"class":211},"sudo .",[54,403,404],{"class":204},"/",[54,406,407],{"class":211},"SetupSTM32CubeMX",[54,409,410],{"class":204},"-",[54,412,414],{"class":413},"s7hpK","6.15.0\n",[15,416,417],{},[132,418],{"alt":49,"src":419},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image13.webp",[15,421,422],{},"In the newly popped-up window, just keep clicking Next until the installation finishes. When it looks like the image below, the installation is successful.",[15,424,425],{},[132,426],{"alt":49,"src":427},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image14.webp",[15,429,430,433],{},[51,431,432],{},"/usr/local/STMicroelectronics/STM32Cube/STM32CubeMX"," Enter this folder, then open a terminal and type",[44,435,437],{"className":195,"code":436,"language":197,"meta":49,"style":49},"./STM32CubeMX\n",[51,438,439],{"__ignoreMap":49},[54,440,441,443,445],{"class":56,"line":57},[54,442,391],{"class":211},[54,444,404],{"class":204},[54,446,447],{"class":211},"STM32CubeMX\n",[15,449,450],{},[132,451],{"alt":49,"src":452},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image15.webp",[15,454,455],{},"Click Help",[15,457,458],{},[132,459],{"alt":49,"src":460},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image16.webp",[15,462,463,464,467],{},"Select ",[51,465,466],{},"Manage embedded software packages",", and check the first and latest firmware for STM32F1, F4, and H7.",[15,469,470],{},[132,471],{"alt":49,"src":472},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image17.webp",[15,474,475],{},"Click install.",[15,477,478],{},[132,479],{"alt":49,"src":480},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image18.webp",[15,482,483],{},"Logged into the account.",[15,485,486],{},[132,487],{"alt":49,"src":488},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image19.webp",[15,490,491],{},"Then wait for the download and installation to finish.",[15,493,494],{},[132,495],{"alt":49,"src":496},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image20.webp",[15,498,499],{},"Just download it.",[15,501,502,503,508],{},"Next, you can configure a desktop shortcut for CubeMX application for quick access. For detailed instructions, refer to the Appimage section of the ",[356,504,507],{"href":505,"rel":506},"https://sdutvincirobot.feishu.cn/wiki/GIKnwJo39iREkHkFGvqcy5Osntc",[360],"Vinci Robotics Team Linux Beginner Tutorial",". You can use Ctrl+F to quickly locate that section.",[15,510,511],{},"The desktop shortcut is as follows:",[44,513,515],{"className":46,"code":514,"language":48,"meta":49,"style":49},"[Desktop Entry]\nName=STM32CubeMX\nExec=/usr/local/STMicroelectronics/STM32Cube/STM32CubeMX/STM32CubeMX\nIcon=/usr/local/STMicroelectronics/STM32Cube/STM32CubeMX/help/STM32CubeMX.png\nType=Application\nCategories=Development;Electronics;Embedded;\nComment=STM32CubeMX configuration and code generation tool\nTerminal=false\n",[51,516,517,522,532,542,552,562,586,612],{"__ignoreMap":49},[54,518,519],{"class":56,"line":57},[54,520,521],{"class":211},"[Desktop Entry]\n",[54,523,524,527,530],{"class":56,"line":64},[54,525,526],{"class":211},"Name",[54,528,529],{"class":204},"=",[54,531,447],{"class":78},[54,533,534,537,539],{"class":56,"line":71},[54,535,536],{"class":211},"Exec",[54,538,529],{"class":204},[54,540,541],{"class":78},"/usr/local/STMicroelectronics/STM32Cube/STM32CubeMX/STM32CubeMX\n",[54,543,544,547,549],{"class":56,"line":100},[54,545,546],{"class":211},"Icon",[54,548,529],{"class":204},[54,550,551],{"class":78},"/usr/local/STMicroelectronics/STM32Cube/STM32CubeMX/help/STM32CubeMX.png\n",[54,553,554,557,559],{"class":56,"line":105},[54,555,556],{"class":211},"Type",[54,558,529],{"class":204},[54,560,561],{"class":78},"Application\n",[54,563,564,567,569,572,575,578,580,583],{"class":56,"line":111},[54,565,566],{"class":211},"Categories",[54,568,529],{"class":204},[54,570,571],{"class":78},"Development",[54,573,574],{"class":211},";",[54,576,577],{"class":74},"Electronics",[54,579,574],{"class":211},[54,581,582],{"class":74},"Embedded",[54,584,585],{"class":211},";\n",[54,587,589,592,594,597,600,603,606,609],{"class":56,"line":588},7,[54,590,591],{"class":211},"Comment",[54,593,529],{"class":204},[54,595,596],{"class":78},"STM32CubeMX",[54,598,599],{"class":74}," configuration",[54,601,602],{"class":78}," and",[54,604,605],{"class":78}," code",[54,607,608],{"class":78}," generation",[54,610,611],{"class":78}," tool\n",[54,613,615,618,620],{"class":56,"line":614},8,[54,616,617],{"class":211},"Terminal",[54,619,529],{"class":204},[54,621,622],{"class":78},"false\n",[15,624,625],{},"Just follow the tutorial, and you'll be able to achieve this effect.",[15,627,628],{},[132,629],{"alt":49,"src":630},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image21.webp",[15,632,633],{},[132,634],{"alt":49,"src":635},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image22.webp",[39,637,639],{"id":638},"install-vscode","Install VSCode",[15,641,642],{},[356,643,644],{"href":644,"rel":645},"https://code.visualstudio.com/Download",[360],[15,647,648],{},[132,649],{"alt":49,"src":650},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image23.webp",[15,652,653],{},"If it's a Debian-based system, download the .deb; if it's an RHEL-based system, download the .rpm.",[15,655,656],{},"After downloading, open your browser, locate the folder containing this installation package, and open a terminal in that path.",[15,658,659],{},[132,660],{"alt":49,"src":661},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image24.webp",[15,663,664,665,668,669,672],{},"Debian-based: Enter ",[51,666,667],{},"sudo apt install ./code"," then press the ",[51,670,671],{},"tab"," key to autocomplete the filename, then press Enter.",[15,674,675,676,679,680,672],{},"RHEL series: Enter ",[51,677,678],{},"sudo dnf install ./code"," and then press the ",[51,681,671],{},[15,683,684],{},"For example, after completion:",[44,686,688],{"className":46,"code":687,"language":48,"meta":49,"style":49},"sudo dnf install ./code-1.102.1-1752598767.el8.x86_64.rpm\n",[51,689,690],{"__ignoreMap":49},[54,691,692,694,696,698],{"class":56,"line":57},[54,693,75],{"class":74},[54,695,116],{"class":78},[54,697,82],{"class":78},[54,699,700],{"class":78}," ./code-1.102.1-1752598767.el8.x86_64.rpm\n",[15,702,703],{},[132,704],{"alt":49,"src":705},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image25.webp",[15,707,708],{},"Then open VSCode and enter the following command in the terminal:",[44,710,712],{"className":46,"code":711,"language":48,"meta":49,"style":49},"code\n",[51,713,714],{"__ignoreMap":49},[54,715,716],{"class":56,"line":57},[54,717,711],{"class":74},[15,719,720],{},[132,721],{"alt":49,"src":722},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image26.webp",[15,724,725],{},"Then install some plugins.",[15,727,728],{},[132,729],{"alt":49,"src":730},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image27.webp",[15,732,733],{},"All of the following need to be installed.",[15,735,736,739],{},[132,737],{"alt":49,"src":738},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image28.webp",[132,740],{"alt":49,"src":741},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image29.webp",[15,743,744,747],{},[132,745],{"alt":49,"src":746},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image30.webp",[132,748],{"alt":49,"src":749},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image31.webp",[39,751,753],{"id":752},"install-the-arm-gnu-toolchain","Install the ARM GNU toolchain",[15,755,756],{},"Compiler Tool Comparison:",[758,759,760,780],"table",{},[761,762,763],"thead",{},[764,765,766,771,774,777],"tr",{},[767,768,770],"th",{"align":769},"left","Features",[767,772,773],{"align":769},"ARM GCC (GNU Toolchain)",[767,775,776],{"align":769},"Keil AC5 (ARM Compiler 5)",[767,778,779],{"align":769},"Keil AC6 (ARM Compiler 6)",[781,782,783,798,811,825,839,853,867,880,894],"tbody",{},[764,784,785,789,792,795],{},[786,787,788],"td",{"align":769},"Core identity",[786,790,791],{"align":769},"Open-source compiler based on GNU GPL",[786,793,794],{"align":769},"ARM's traditional proprietary compiler",[786,796,797],{"align":769},"A modern compiler based on LLVM/Clang",[764,799,800,803,806,809],{},[786,801,802],{"align":769},"Licensing Model",[786,804,805],{"align":769},"Free, open-source",[786,807,808],{"align":769},"Commercial license (included in MDK)",[786,810,808],{"align":769},[764,812,813,816,819,822],{},[786,814,815],{"align":769},"Code Generation / Optimization",[786,817,818],{"align":769},"Good, continuous improvement.",[786,820,821],{"align":769},"Excellent (especially in small code size)",[786,823,824],{"align":769},"Excellent, striking the best balance between performance and size.",[764,826,827,830,833,836],{},[786,828,829],{"align":769},"Standard Compatibility",[786,831,832],{"align":769},"Stay up to date with the latest C/C++ standards (such as C17, C++17/20).",[786,834,835],{"align":769},"Primarily supports C++98, which is relatively outdated.",[786,837,838],{"align":769},"Supports modern C++ (C++11/14/17) with better compatibility.",[764,840,841,844,847,850],{},[786,842,843],{"align":769},"Error/Warning Messages",[786,845,846],{"align":769},"Relatively clear and easy to understand.",[786,848,849],{"align":769},"relatively obscure",[786,851,852],{"align":769},"Very clear and friendly, similar to GCC/Clang.",[764,854,855,858,861,864],{},[786,856,857],{"align":769},"Integration with Keil MDK",[786,859,860],{"align":769},"Requires manual configuration or through CubeIDE",[786,862,863],{"align":769},"Native, seamless integration",[786,865,866],{"align":769},"Native, seamless integration—the recommended choice by ARM.",[764,868,869,872,875,878],{},[786,870,871],{"align":769},"Linker script",[786,873,874],{"align":769},"Use a custom linker script syntax (.ld file)",[786,876,877],{"align":769},"Using ARM's own scatter loading file syntax (.sct)",[786,879,877],{"align":769},[764,881,882,885,888,891],{},[786,883,884],{"align":769},"Assembly syntax",[786,886,887],{"align":769},"Using GNU assembly syntax (.S file)",[786,889,890],{"align":769},"Using ARM assembly syntax (.s)",[786,892,893],{"align":769},"Using ARM assembly syntax (.s), but AC6 is stricter.",[764,895,896,899,902,905],{},[786,897,898],{"align":769},"Ecosystem and Future",[786,900,901],{"align":769},"Its strong ecosystem makes it the top choice for many open-source projects (such as Zephyr, ESP-IDF) and IDEs (CubeIDE, VS Code).",[786,903,904],{"align":769},"In maintenance mode, ARM will no longer add new features and is not recommended for new projects.",[786,906,907],{"align":769},"It is the future and mainstay of ARM, with continuous updates and optimizations.",[909,910],"hr",{},[912,913,915],"h5",{"id":914},"install","Install",[15,917,918],{},[364,919,920],{},"It is recommended to use the official method for installation.",[922,923,925],"h6",{"id":924},"method-1-official-method","Method 1 (Official Method)",[15,927,928],{},[356,929,930],{"href":930,"rel":931},"https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads",[360],[15,933,934],{},[132,935],{"alt":49,"src":936},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image32.webp",[15,938,939],{},"Enter the download directory and open the terminal.",[15,941,942],{},[132,943],{"alt":49,"src":944},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image33.webp",[15,946,947],{},"In the terminal, enter the following command to copy the compiler's tar archive to the folder where you store your programs (you can choose this folder yourself; it's recommended to place it in the home partition, just make sure you don't delete it later).",[15,949,950,951,954,955,957],{},"The specific command is ",[51,952,953],{},"cp ./arm-gnu",", then press ",[51,956,671],{}," to autocomplete, then a space, followed by the path to the folder you want to copy to.",[15,959,960],{},"For example, the following command:",[44,962,964],{"className":46,"code":963,"language":48,"meta":49,"style":49},"cp ./arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi.tar.xz ~/UserFolder/Applications/\n",[51,965,966],{"__ignoreMap":49},[54,967,968,971,974],{"class":56,"line":57},[54,969,970],{"class":74},"cp",[54,972,973],{"class":78}," ./arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi.tar.xz",[54,975,976],{"class":78}," ~/UserFolder/Applications/\n",[15,978,979],{},"Then enter the copied folder:",[44,981,983],{"className":46,"code":982,"language":48,"meta":49,"style":49},"cd ~/UserFolder/Applications/\n",[51,984,985],{"__ignoreMap":49},[54,986,987,990],{"class":56,"line":57},[54,988,989],{"class":280},"cd",[54,991,976],{"class":78},[15,993,994],{},[132,995],{"alt":49,"src":996},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image34.webp",[15,998,999,1000,1003,1004,1006],{},"In the terminal, type ",[51,1001,1002],{},"tar -xvf ./arm-gnu"," and press ",[51,1005,671],{}," to autocomplete.",[15,1008,1009],{},"For example, after I filled it in:",[44,1011,1013],{"className":46,"code":1012,"language":48,"meta":49,"style":49}," tar -xvf ./arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi.tar.xz\n",[51,1014,1015],{"__ignoreMap":49},[54,1016,1017,1020,1023],{"class":56,"line":57},[54,1018,1019],{"class":74}," tar",[54,1021,1022],{"class":280}," -xvf",[54,1024,1025],{"class":78}," ./arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi.tar.xz\n",[15,1027,1028],{},[132,1029],{"alt":49,"src":1030},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image35.webp",[15,1032,1033],{},"Then enter this unzipped folder.",[15,1035,1036,1039,1040,391],{},[51,1037,1038],{},"cd ./arm-gnu","Fill in according to ",[51,1041,671],{},[44,1043,1045],{"className":46,"code":1044,"language":48,"meta":49,"style":49},"cd ./arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi/\ncd ./bin\n",[51,1046,1047,1054],{"__ignoreMap":49},[54,1048,1049,1051],{"class":56,"line":57},[54,1050,989],{"class":280},[54,1052,1053],{"class":78}," ./arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi/\n",[54,1055,1056,1058],{"class":56,"line":64},[54,1057,989],{"class":280},[54,1059,1060],{"class":78}," ./bin\n",[15,1062,1063],{},"Check the folder path",[44,1065,1067],{"className":46,"code":1066,"language":48,"meta":49,"style":49},"pwd\n",[51,1068,1069],{"__ignoreMap":49},[54,1070,1071],{"class":56,"line":57},[54,1072,1066],{"class":280},[15,1074,1075],{},[132,1076],{"alt":49,"src":1077},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image36.webp",[15,1079,1080,1081],{},"Copy ",[51,1082,1083],{},"/home/tungchiahui/UserFolder/Applications/arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi/bin",[15,1085,1086],{},"Then you need to configure the environment.",[44,1088,1090],{"className":46,"code":1089,"language":48,"meta":49,"style":49},"vim ~/.bashrc\n",[51,1091,1092],{"__ignoreMap":49},[54,1093,1094,1096],{"class":56,"line":57},[54,1095,186],{"class":74},[54,1097,1098],{"class":78}," ~/.bashrc\n",[15,1100,1101,1102,1105,1106,1109,1110,391],{},"At the end, enter the following command, replacing ",[51,1103,1104],{},"~/UserFolder/Applications/arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi/bin"," with the path you just copied. ",[51,1107,1108],{},"/home/用户名"," can be replaced with ",[51,1111,1112],{},"~",[44,1114,1116],{"className":46,"code":1115,"language":48,"meta":49,"style":49},"export PATH=/home/tungchiahui/UserFolder/Applications/arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi/bin:$PATH\n",[51,1117,1118],{"__ignoreMap":49},[54,1119,1120,1123,1126,1128],{"class":56,"line":57},[54,1121,1122],{"class":204},"export",[54,1124,1125],{"class":211}," PATH",[54,1127,529],{"class":204},[54,1129,1130],{"class":211},"/home/tungchiahui/UserFolder/Applications/arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi/bin:$PATH\n",[15,1132,1133],{},[132,1134],{"alt":49,"src":1135},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image37.webp",[15,1137,1138],{},"Loading environment",[44,1140,1142],{"className":46,"code":1141,"language":48,"meta":49,"style":49},"source ~/.bashrc\n",[51,1143,1144],{"__ignoreMap":49},[54,1145,1146,1149],{"class":56,"line":57},[54,1147,1148],{"class":280},"source",[54,1150,1098],{"class":78},[922,1152,1154],{"id":1153},"method-2-system-repository-method","Method 2 (System Repository Method)",[15,1156,1157],{},[364,1158,1159],{},"This method is not recommended",[44,1161,1163],{"className":46,"code":1162,"language":48,"meta":49,"style":49},"\n# Debian系\nsudo apt install arm-none-eabi-gcc\n\n# Rhel系\nsudo dnf install arm-none-eabi-gcc\n",[51,1164,1165,1169,1174,1186,1190,1195],{"__ignoreMap":49},[54,1166,1167],{"class":56,"line":57},[54,1168,61],{"emptyLinePlaceholder":60},[54,1170,1171],{"class":56,"line":64},[54,1172,1173],{"class":67},"# Debian系\n",[54,1175,1176,1178,1181,1183],{"class":56,"line":71},[54,1177,75],{"class":74},[54,1179,1180],{"class":78}," apt",[54,1182,82],{"class":78},[54,1184,1185],{"class":78}," arm-none-eabi-gcc\n",[54,1187,1188],{"class":56,"line":100},[54,1189,61],{"emptyLinePlaceholder":60},[54,1191,1192],{"class":56,"line":105},[54,1193,1194],{"class":67},"# Rhel系\n",[54,1196,1197,1199,1201,1203],{"class":56,"line":111},[54,1198,75],{"class":74},[54,1200,116],{"class":78},[54,1202,82],{"class":78},[54,1204,1185],{"class":78},[15,1206,1207],{},[132,1208],{"alt":49,"src":1209},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image38.webp",[912,1211,1212],{"id":1212},"test",[15,1214,1215],{},"Check the version.",[44,1217,1219],{"className":46,"code":1218,"language":48,"meta":49,"style":49},"arm-none-eabi-gcc -v\n",[51,1220,1221],{"__ignoreMap":49},[54,1222,1223,1226],{"class":56,"line":57},[54,1224,1225],{"class":74},"arm-none-eabi-gcc",[54,1227,1228],{"class":280}," -v\n",[15,1230,1231],{},[132,1232],{"alt":49,"src":1233},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image39.webp",[39,1235,1237],{"id":1236},"install-the-jlink-driver","Install the JLink driver",[912,1239,1241],{"id":1240},"install-the-libreadline-library","Install the libreadline library",[15,1243,1244],{},"We will use the JLinkExe command for flashing, which requires the libreadline library. Therefore, install the libreadline library by executing the following command:",[44,1246,1248],{"className":46,"code":1247,"language":48,"meta":49,"style":49},"\n# debian系\nsudo apt-get install libreadline-dev\n\n# rhel系\nsudo dnf install readline-devel\n",[51,1249,1250,1254,1258,1269,1273,1277],{"__ignoreMap":49},[54,1251,1252],{"class":56,"line":57},[54,1253,61],{"emptyLinePlaceholder":60},[54,1255,1256],{"class":56,"line":64},[54,1257,68],{"class":67},[54,1259,1260,1262,1264,1266],{"class":56,"line":71},[54,1261,75],{"class":74},[54,1263,79],{"class":78},[54,1265,82],{"class":78},[54,1267,1268],{"class":78}," libreadline-dev\n",[54,1270,1271],{"class":56,"line":100},[54,1272,61],{"emptyLinePlaceholder":60},[54,1274,1275],{"class":56,"line":105},[54,1276,108],{"class":67},[54,1278,1279,1281,1283,1285],{"class":56,"line":111},[54,1280,75],{"class":74},[54,1282,116],{"class":78},[54,1284,82],{"class":78},[54,1286,1287],{"class":78}," readline-devel\n",[15,1289,1290],{},[132,1291],{"alt":49,"src":1292},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image40.webp",[912,1294,1237],{"id":1295},"install-the-jlink-driver-1",[15,1297,1298],{},[356,1299,1300],{"href":1300,"rel":1301},"https://www.segger.com/downloads/jlink/",[360],[15,1303,1304],{},[132,1305],{"alt":49,"src":1306},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image41.webp",[15,1308,1309],{},"It is a Debian-based system; download the 64-bit DEB.",[15,1311,1312],{},"Download the 64-bit RPM for RHEL-based systems.",[15,1314,1315],{},"(The 64-bit here refers to amd64 and X86_64. If you are using ARM64, please download the 64-bit version under Linux ARM below.)",[15,1317,1318],{},[132,1319],{"alt":49,"src":1320},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image42.webp",[15,1322,1323],{},"Open the downloaded folder, and open the terminal.",[15,1325,1326],{},[132,1327],{"alt":49,"src":1328},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image43.webp",[15,1330,1331,1332,1335],{},"Then ",[51,1333,1334],{},"sudo apt install ./JLink"," then tab to complete.",[15,1337,1331,1338,1335],{},[51,1339,1340],{},"sudo dnf install ./JLink",[44,1342,1344],{"className":46,"code":1343,"language":48,"meta":49,"style":49},"sudo dnf install ./JLink_Linux_V852_x86_64.rpm\n",[51,1345,1346],{"__ignoreMap":49},[54,1347,1348,1350,1352,1354],{"class":56,"line":57},[54,1349,75],{"class":74},[54,1351,116],{"class":78},[54,1353,82],{"class":78},[54,1355,1356],{"class":78}," ./JLink_Linux_V852_x86_64.rpm\n",[15,1358,1359],{},[132,1360],{"alt":49,"src":1361},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image44.webp",[15,1363,1364],{},"Check if the installation was successful.",[44,1366,1368],{"className":46,"code":1367,"language":48,"meta":49,"style":49},"JLinkExe\n",[51,1369,1370],{"__ignoreMap":49},[54,1371,1372],{"class":56,"line":57},[54,1373,1367],{"class":74},[15,1375,1376],{},[132,1377],{"alt":49,"src":1378},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image45.webp",[15,1380,1381],{},"We click No, and then enter Commander interactive mode. In this mode, we can execute various commands provided by J-Link Commander to connect, configure the debugger, download programs or files to the target device, and more. Interested students can explore this on their own.",[15,1383,1384],{},"Execute the \"q\" command to exit this mode.",[15,1386,1387],{},[132,1388],{"alt":49,"src":1389},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image46.webp",[912,1391,1393],{"id":1392},"download-and-install-ozone","Download and install Ozone",[15,1395,1396],{},[356,1397,1398],{"href":1398,"rel":1399},"https://www.segger.com/products/development-tools/ozone-j-link-debugger/",[360],[15,1401,1402],{},[132,1403],{"alt":49,"src":1404},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image47.webp",[15,1406,1407],{},[132,1408],{"alt":49,"src":1409},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image48.webp",[15,1411,1309],{},[15,1413,1312],{},[15,1415,1315],{},[15,1417,1418],{},[132,1419],{"alt":49,"src":1420},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image49.webp",[15,1422,1331,1423,1335],{},[51,1424,1425],{},"sudo apt install ./Ozone",[15,1427,1331,1428,1335],{},[51,1429,1430],{},"sudo dnf install ./Ozone",[44,1432,1434],{"className":46,"code":1433,"language":48,"meta":49,"style":49},"sudo dnf install ./Ozone_Linux_V338g_x86_64.rpm\n",[51,1435,1436],{"__ignoreMap":49},[54,1437,1438,1440,1442,1444],{"class":56,"line":57},[54,1439,75],{"class":74},[54,1441,116],{"class":78},[54,1443,82],{"class":78},[54,1445,1446],{"class":78}," ./Ozone_Linux_V338g_x86_64.rpm\n",[15,1448,1449],{},[132,1450],{"alt":49,"src":1451},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image50.webp",[912,1453,1212],{"id":1454},"test-1",[15,1456,1457],{},"Open the terminal and enter",[44,1459,1461],{"className":46,"code":1460,"language":48,"meta":49,"style":49},"ozone\n",[51,1462,1463],{"__ignoreMap":49},[54,1464,1465],{"class":56,"line":57},[54,1466,1460],{"class":74},[15,1468,1469],{},[132,1470],{"alt":49,"src":1471},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image51.webp",[39,1473,1475],{"id":1474},"download-svd","Download SVD",[15,1477,1478],{},[356,1479,1482],{"href":1480,"rel":1481},"https://www.st.com.cn/content/st%5C_com/zh.html",[360],"https://www.st.com.cn/content/st\\_com/zh.html",[15,1484,1485],{},"Search for the chip model, such as stm32f103c8t6.",[15,1487,1488],{},[132,1489],{"alt":49,"src":1490},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image52.webp",[15,1492,1493],{},"CAD resources",[15,1495,1496],{},[132,1497],{"alt":49,"src":1498},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image53.webp",[15,1500,1501],{},"Download SVD; click the area inside the red box to download it.",[15,1503,1504],{},[132,1505],{"alt":49,"src":1506},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image54.webp",[15,1508,1509],{},"After decompression, you can obtain the SVD files for the F1 series.",[15,1511,1512],{},[132,1513],{"alt":49,"src":1514},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image55.webp",[15,1516,1517],{},"Just download and extract the F4 and H7 versions as well, one after the other. (You can extract them into the same folder.)",[15,1519,1520],{},[132,1521],{"alt":49,"src":1522},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image56.webp",[15,1524,1525],{},"Then open a terminal in the folder above.",[15,1527,1528,1529,1532],{},"Copy all of these folders into Ozone's ",[51,1530,1531],{},"Config/Peripherals/"," directory. (You need to confirm in advance whether Ozone's configuration uses this path before copying.)",[15,1534,1535],{},[132,1536],{"alt":49,"src":1537},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image57.webp",[44,1539,1541],{"className":46,"code":1540,"language":48,"meta":49,"style":49},"sudo cp ./*.svd /opt/SEGGER/Ozone_V338g/Config/Peripherals/\n",[51,1542,1543],{"__ignoreMap":49},[54,1544,1545,1547,1550,1553,1556,1559],{"class":56,"line":57},[54,1546,75],{"class":74},[54,1548,1549],{"class":78}," cp",[54,1551,1552],{"class":78}," ./",[54,1554,1555],{"class":280},"*",[54,1557,1558],{"class":78},".svd",[54,1560,1561],{"class":78}," /opt/SEGGER/Ozone_V338g/Config/Peripherals/\n",[15,1563,1564],{},[132,1565],{"alt":49,"src":1566},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image58.webp",[15,1568,1569],{},[132,1570],{"alt":49,"src":1571},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image59.webp",[10,1573,1575],{"id":1574},"project-creation-and-testing","Project Creation and Testing",[39,1577,1579],{"id":1578},"create-a-project-using-cubemx","Create a project using CubeMX",[15,1581,1582],{},"Click the button to select a microcontroller.",[15,1584,1585],{},[132,1586],{"alt":49,"src":1587},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image60.webp",[15,1589,1590],{},"Search for the corresponding chip, and double-click the chip option.",[15,1592,1593],{},[132,1594],{"alt":49,"src":1595},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image61.webp",[15,1597,1598],{},"Perform some configuration. The following are all very basic things that you definitely already know before watching this video.",[15,1600,1601],{},[132,1602],{"alt":49,"src":1603},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image62.webp",[15,1605,1606],{},[132,1607],{"alt":49,"src":1608},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image63.webp",[15,1610,1611],{},"Open any IO for testing, such as the LED's GPIO.",[15,1613,1614],{},[132,1615],{"alt":49,"src":1616},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image64.webp",[15,1618,1619],{},[132,1620],{"alt":49,"src":1621},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image65.webp",[15,1623,1624],{},"FreeRTOS also needs to be configured.",[15,1626,1627],{},[132,1628],{"alt":49,"src":1629},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image66.webp",[15,1631,1632],{},[132,1633],{"alt":49,"src":1634},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image67.webp",[15,1636,1637],{},"These folders also need to be configured properly. Finally, select CMake for Toolchain and choose GCC for the compiler (it's normal not to have the compiler selection option in version 6.14.1 and earlier).",[15,1639,1640],{},"(However, CubeMX 6.15.0 has a bug — selecting the GCC compiler here doesn't actually work, and you'll need to manually select the compiler later. This bug may be fixed in a future release.)",[15,1642,1643],{},[132,1644],{"alt":49,"src":1645},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image68.webp",[15,1647,1648],{},[132,1649],{"alt":49,"src":1650},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image69.webp",[39,1652,1654],{"id":1653},"configure-and-compile-the-project","Configure and compile the project.",[15,1656,1657],{},"Open a terminal in the project folder.",[15,1659,1660],{},[132,1661],{"alt":49,"src":1662},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image70.webp",[15,1664,1665],{},"Then open vscode",[44,1667,1669],{"className":46,"code":1668,"language":48,"meta":49,"style":49},"code .\n",[51,1670,1671],{"__ignoreMap":49},[54,1672,1673,1675],{"class":56,"line":57},[54,1674,51],{"class":74},[54,1676,1677],{"class":78}," .\n",[15,1679,1680],{},[132,1681],{"alt":49,"src":1682},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image71.webp",[15,1684,1685],{},"After entering VSCode, click on the CMakeLists.txt file in the directory.",[15,1687,1688],{},[132,1689],{"alt":49,"src":1690},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image72.webp",[15,1692,1693],{},"Check around line 25 for the following line. If it's not there, you need to manually add these two lines. (Version 6.14.1 does not have this bug.)",[15,1695,1696],{},[1697,1698,1699],"em",{},"tips1: This is the bug in CubeMX version 6.15.0 mentioned above. Because this version added support for the Clang compiler and also allows selecting the compiler in CubeMX, but this option was likely not implemented correctly by the engineers. No matter which compiler you select, it won't actually choose the one you picked, so you need to select it manually.",[15,1701,1702],{},[1697,1703,1704],{},"tips2: CubeMX 6.15.0 has a second bug. It states that the workspace root CMakeLists.txt will only be generated once and will not be overwritten in subsequent generations. However, it turns out that after modifying the configuration in CubeMX and regenerating the code, all other commands are preserved except for this one. It's unclear whether this will be fixed in a future version, or if the bug from tips1 will be addressed directly. So, after each reconfiguration of CubeMX, you need to add this line back in.",[15,1706,1707],{},[132,1708],{"alt":49,"src":1709},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image73.webp",[44,1711,1713],{"className":46,"code":1712,"language":48,"meta":49,"style":49},"\n# Include toolchain file\ninclude(\"cmake/gcc-arm-none-eabi.cmake\")\n",[51,1714,1715,1719,1724],{"__ignoreMap":49},[54,1716,1717],{"class":56,"line":57},[54,1718,61],{"emptyLinePlaceholder":60},[54,1720,1721],{"class":56,"line":64},[54,1722,1723],{"class":67},"# Include toolchain file\n",[54,1725,1726,1729,1732],{"class":56,"line":71},[54,1727,1728],{"class":74},"include(",[54,1730,1731],{"class":74},"\"cmake/gcc-arm-none-eabi.cmake\"",[54,1733,1734],{"class":211},")\n",[15,1736,1737],{},"Press Ctrl+` to open the built-in terminal.",[15,1739,1740],{},[132,1741],{"alt":49,"src":1742},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image74.webp",[15,1744,1745],{},"Use the command below to create and enter the build folder.",[44,1747,1749],{"className":46,"code":1748,"language":48,"meta":49,"style":49},"mkdir build\ncd build\n",[51,1750,1751,1759],{"__ignoreMap":49},[54,1752,1753,1756],{"class":56,"line":57},[54,1754,1755],{"class":74},"mkdir",[54,1757,1758],{"class":78}," build\n",[54,1760,1761,1763],{"class":56,"line":64},[54,1762,989],{"class":280},[54,1764,1758],{"class":78},[15,1766,1767],{},[132,1768],{"alt":49,"src":1769},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image75.webp",[15,1771,1772],{},"Next, use the cmake command to generate the makefile.",[44,1774,1776],{"className":46,"code":1775,"language":48,"meta":49,"style":49},"cmake ..\n",[51,1777,1778],{"__ignoreMap":49},[54,1779,1780,1783],{"class":56,"line":57},[54,1781,1782],{"class":74},"cmake",[54,1784,1785],{"class":78}," ..\n",[15,1787,1788],{},"Check whether ARM's C/C++ and assembly compilers have all been found (if not, please check if there are any mistakes in the tutorial above).",[15,1790,1791],{},[132,1792],{"alt":49,"src":1793},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image76.webp",[15,1795,1796,1797,1800,1801,1803,1804,1807,1808,1811,1812,1814,1815,1817,1818,1820,1821,1823],{},"Then use the ",[51,1798,1799],{},"make"," command to compile, with the command being ",[51,1802,1799],{}," or ",[51,1805,1806],{},"make -jxx",". Here, ",[51,1809,1810],{},"xx"," is the number of CPU threads you want to use for compilation. For example, if my computer has 8 cores and 16 threads, I can set ",[51,1813,1810],{}," to a number lower than 16. Meanwhile, ",[51,1816,1799],{}," uses one thread by default. If you don't know how many threads your CPU has, just stick with the ",[51,1819,1799],{}," command and don't use the ",[51,1822,1806],{}," command.",[44,1825,1827],{"className":46,"code":1826,"language":48,"meta":49,"style":49},"make -j16\n",[51,1828,1829],{"__ignoreMap":49},[54,1830,1831,1833],{"class":56,"line":57},[54,1832,1799],{"class":74},[54,1834,1835],{"class":280}," -j16\n",[15,1837,1838],{},"That means the compilation was successful.",[15,1840,1841],{},[132,1842],{"alt":49,"src":1843},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image77.webp",[39,1845,1847],{"id":1846},"configure-code-hints","Configure code hints.",[15,1849,1850],{},"In VSCode, press Ctrl+Shift+P, search for clangd, and select to download the language server.",[15,1852,1853],{},[132,1854],{"alt":49,"src":1855},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image78.webp",[15,1857,1858],{},"Select Install in the bottom right corner, and once the installation is complete, a prompt like the one shown below will appear.",[15,1860,1861],{},[132,1862],{"alt":49,"src":1863},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image79.webp",[15,1865,1866],{},"Next, disable the code suggestion feature of the C/C++ plugin (if you don't see this interface, scroll down).",[15,1868,1869],{},[132,1870],{"alt":49,"src":1871},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image80.webp",[15,1873,1874],{},"If the pop-up shown above does not appear, you can manually close it. Again, press Ctrl+Shift+P, type \"settings\", and then find the option shown in the image below.",[15,1876,1877],{},[132,1878],{"alt":49,"src":1879},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image81.webp",[15,1881,1882],{},"Find the option shown in the image below and change it to disabled.",[15,1884,1885],{},[51,1886,1887],{},"\"C_Cpp.intelliSenseEngine\": \"disabled\"",[15,1889,1890],{},[132,1891],{"alt":49,"src":1892},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image82.webp",[15,1894,1895],{},"In VSCode, press Ctrl+Shift+P again, search for clangd, and select Restart clangd language server (you must have compiled the code at least once before restarting the clangd language server).",[15,1897,1898],{},[132,1899],{"alt":49,"src":1900},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image83.webp",[15,1902,1903],{},"At this point, you can see that the header files in the code are recognized correctly, and the code suggestions are working properly.",[15,1905,1906],{},[132,1907],{"alt":49,"src":1908},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image84.webp",[15,1910,1911],{},[132,1912],{"alt":49,"src":1913},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image85.webp",[15,1915,1916],{},[132,1917],{"alt":49,"src":1918},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image86.webp",[15,1920,1921,1922,1929,1930,1933],{},"⚠️ Note: Clangd by default looks for the ",[364,1923,1924,1925,1928],{},"host system's libc/include path (e.g., x86_64's ",[51,1926,1927],{},"/usr/include",")"," , but our project actually uses the ",[364,1931,1932],{},"ARM toolchain's header file path"," , which can cause errors when including C/C++ standard library headers.",[15,1935,1936],{},"For example:",[15,1938,1939],{},[132,1940],{"alt":49,"src":1941},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image87.webp",[15,1943,1944,1945,1948],{},"The ",[51,1946,1947],{},"#include \u003Cmath.h>"," here shows that the header file cannot be found, but when we compile it, there is no error, which means the clangd configuration is incorrect. The following describes a solution:",[19,1950,1951],{},[22,1952,1953],{},"Run the following command to get the standard include paths used by ARM GCC:",[44,1955,1957],{"className":46,"code":1956,"language":48,"meta":49,"style":49},"arm-none-eabi-gcc -x c -E -v - \u003C/dev/null\n",[51,1958,1959],{"__ignoreMap":49},[54,1960,1961,1963,1966,1969,1972,1975,1978,1981],{"class":56,"line":57},[54,1962,1225],{"class":74},[54,1964,1965],{"class":280}," -x",[54,1967,1968],{"class":78}," c",[54,1970,1971],{"class":280}," -E",[54,1973,1974],{"class":280}," -v",[54,1976,1977],{"class":78}," -",[54,1979,1980],{"class":204}," \u003C",[54,1982,1983],{"class":78},"/dev/null\n",[15,1985,1986],{},[132,1987],{"alt":49,"src":1988},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image88.webp",[19,1990,1991],{"start":64},[22,1992,1993,1994,1997],{},"Create a ",[51,1995,1996],{},".clangd"," file in the project root directory and include your header file path (replace the content inside the quotes with your own ARM GCC header file path).",[44,1999,2002],{"className":2000,"code":2001,"language":143},[141],"CompileFlags:\n  Add: [\n    \"-isystem\", \"/home/xiaofang/Applications/arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi/lib/gcc/arm-none-eabi/14.3.1/include\",\n    \"-isystem\", \"/home/xiaofang/Applications/arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi/lib/gcc/arm-none-eabi/14.3.1/include-fixed\",\n    \"-isystem\", \"/home/xiaofang/Applications/arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi/arm-none-eabi/include\"\n  ]\n",[51,2003,2001],{"__ignoreMap":49},[15,2005,2006],{},"Save, then refresh clangd. The header file prompt now works normally.",[15,2008,2009],{},[132,2010],{"alt":49,"src":2011},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image89.webp",[39,2013,2015],{"id":2014},"porting-the-vinci-robot-teams-standard-cc-project-template","Porting the Vinci Robot Team's standard C/C++ project template",[15,2017,2018,2019,2022,2023],{},"Use the ",[51,2020,2021],{},"git clone"," command to clone the repository: ",[356,2024,2025],{"href":2025,"rel":2026},"https://github.com/tungchiahui/CubeMX_MDK5to6_Template",[360],[44,2028,2030],{"className":46,"code":2029,"language":48,"meta":49,"style":49},"git clone https://github.com/tungchiahui/CubeMX_MDK5to6_Template.git\n",[51,2031,2032],{"__ignoreMap":49},[54,2033,2034,2037,2040],{"class":56,"line":57},[54,2035,2036],{"class":74},"git",[54,2038,2039],{"class":78}," clone",[54,2041,2042],{"class":78}," https://github.com/tungchiahui/CubeMX_MDK5to6_Template.git\n",[15,2044,1080,2045,2048],{},[364,2046,2047],{},"all contents"," from the \"工程文件移植\" folder in the repository into our CMake project directory.",[15,2050,2051],{},[132,2052],{"alt":49,"src":2053},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image90.webp",[15,2055,2056,2057,2060,2061,2064,2065,2068,2069,2064,2072,2075],{},"Then open the ",[51,2058,2059],{},"applications"," folder, and create ",[51,2062,2063],{},"led_task.cpp"," and ",[51,2066,2067],{},"led_task.h"," in the ",[51,2070,2071],{},"Src",[51,2073,2074],{},"Inc"," folders respectively, with the following contents:",[15,2077,2078],{},[132,2079],{"alt":49,"src":2080},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image91.webp",[15,2082,2083],{},"led_task.cpp:",[44,2085,2087],{"className":195,"code":2086,"language":197,"meta":49,"style":49},"#include \"led_task.h\"\n#include \"cmsis_os.h\"\n#include \"stm32f1xx_hal.h\" \n\nGPIO_PinState pinstate = GPIO_PIN_RESET;\n\nextern \"C\"\nvoid StartDefaultTask(void *argument)\n{\n  for(;;)\n  {\n    HAL_GPIO_WritePin(GPIOC,GPIO_PIN_13,pinstate);\n    pinstate = (pinstate == GPIO_PIN_RESET) ? GPIO_PIN_SET : GPIO_PIN_RESET;\n    osDelay(500);\n  }\n}\n",[51,2088,2089,2096,2103,2112,2116,2126,2130,2138,2158,2164,2173,2179,2188,2216,2230,2236],{"__ignoreMap":49},[54,2090,2091,2093],{"class":56,"line":57},[54,2092,205],{"class":204},[54,2094,2095],{"class":78}," \"led_task.h\"\n",[54,2097,2098,2100],{"class":56,"line":64},[54,2099,205],{"class":204},[54,2101,2102],{"class":78}," \"cmsis_os.h\"\n",[54,2104,2105,2107,2110],{"class":56,"line":71},[54,2106,205],{"class":204},[54,2108,2109],{"class":78}," \"stm32f1xx_hal.h\"",[54,2111,212],{"class":211},[54,2113,2114],{"class":56,"line":100},[54,2115,61],{"emptyLinePlaceholder":60},[54,2117,2118,2121,2123],{"class":56,"line":105},[54,2119,2120],{"class":211},"GPIO_PinState pinstate ",[54,2122,529],{"class":204},[54,2124,2125],{"class":211}," GPIO_PIN_RESET;\n",[54,2127,2128],{"class":56,"line":111},[54,2129,61],{"emptyLinePlaceholder":60},[54,2131,2132,2135],{"class":56,"line":588},[54,2133,2134],{"class":204},"extern",[54,2136,2137],{"class":78}," \"C\"\n",[54,2139,2140,2143,2146,2148,2150,2153,2156],{"class":56,"line":614},[54,2141,2142],{"class":204},"void",[54,2144,2145],{"class":74}," StartDefaultTask",[54,2147,223],{"class":211},[54,2149,2142],{"class":204},[54,2151,2152],{"class":204}," *",[54,2154,2155],{"class":228},"argument",[54,2157,1734],{"class":211},[54,2159,2161],{"class":56,"line":2160},9,[54,2162,2163],{"class":211},"{\n",[54,2165,2167,2170],{"class":56,"line":2166},10,[54,2168,2169],{"class":204},"  for",[54,2171,2172],{"class":211},"(;;)\n",[54,2174,2176],{"class":56,"line":2175},11,[54,2177,2178],{"class":211},"  {\n",[54,2180,2182,2185],{"class":56,"line":2181},12,[54,2183,2184],{"class":74},"    HAL_GPIO_WritePin",[54,2186,2187],{"class":211},"(GPIOC,GPIO_PIN_13,pinstate);\n",[54,2189,2191,2194,2196,2199,2202,2205,2208,2211,2214],{"class":56,"line":2190},13,[54,2192,2193],{"class":211},"    pinstate ",[54,2195,529],{"class":204},[54,2197,2198],{"class":211}," (pinstate ",[54,2200,2201],{"class":204},"==",[54,2203,2204],{"class":211}," GPIO_PIN_RESET) ",[54,2206,2207],{"class":204},"?",[54,2209,2210],{"class":211}," GPIO_PIN_SET ",[54,2212,2213],{"class":204},":",[54,2215,2125],{"class":211},[54,2217,2219,2222,2224,2227],{"class":56,"line":2218},14,[54,2220,2221],{"class":74},"    osDelay",[54,2223,223],{"class":211},[54,2225,2226],{"class":280},"500",[54,2228,2229],{"class":211},");\n",[54,2231,2233],{"class":56,"line":2232},15,[54,2234,2235],{"class":211},"  }\n",[54,2237,2239],{"class":56,"line":2238},16,[54,2240,289],{"class":211},[15,2242,2243],{},"led_task.h:",[44,2245,2247],{"className":195,"code":2246,"language":197,"meta":49,"style":49},"#ifndef __LED_TASK_H_\n#define __LED_TASK_H_\n\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif\n\n#include \"cpp_interface.h\"\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n\n",[51,2248,2249,2257,2264,2268,2276,2282,2286,2291,2295,2302,2306,2312,2316,2320,2324],{"__ignoreMap":49},[54,2250,2251,2254],{"class":56,"line":57},[54,2252,2253],{"class":204},"#ifndef",[54,2255,2256],{"class":74}," __LED_TASK_H_\n",[54,2258,2259,2262],{"class":56,"line":64},[54,2260,2261],{"class":204},"#define",[54,2263,2256],{"class":74},[54,2265,2266],{"class":56,"line":71},[54,2267,61],{"emptyLinePlaceholder":60},[54,2269,2270,2273],{"class":56,"line":100},[54,2271,2272],{"class":204},"#ifdef",[54,2274,2275],{"class":74}," __cplusplus\n",[54,2277,2278,2280],{"class":56,"line":105},[54,2279,2134],{"class":204},[54,2281,2137],{"class":78},[54,2283,2284],{"class":56,"line":111},[54,2285,2163],{"class":211},[54,2287,2288],{"class":56,"line":588},[54,2289,2290],{"class":204},"#endif\n",[54,2292,2293],{"class":56,"line":614},[54,2294,61],{"emptyLinePlaceholder":60},[54,2296,2297,2299],{"class":56,"line":2160},[54,2298,205],{"class":204},[54,2300,2301],{"class":78}," \"cpp_interface.h\"\n",[54,2303,2304],{"class":56,"line":2166},[54,2305,61],{"emptyLinePlaceholder":60},[54,2307,2308,2310],{"class":56,"line":2175},[54,2309,2272],{"class":204},[54,2311,2275],{"class":74},[54,2313,2314],{"class":56,"line":2181},[54,2315,289],{"class":211},[54,2317,2318],{"class":56,"line":2190},[54,2319,2290],{"class":204},[54,2321,2322],{"class":56,"line":2218},[54,2323,61],{"emptyLinePlaceholder":60},[54,2325,2326],{"class":56,"line":2232},[54,2327,2290],{"class":204},[15,2329,2330,2331,2068,2334,2337],{},"Then open ",[51,2332,2333],{},"CMakeLists.txt",[51,2335,2336],{},"cmake/user"," folder and add the newly created led_task.cpp file.",[15,2339,2340,2341,2344,2345,2347,2348,2350,2351,2353,2354,2356,2357,2359,2360,2362,2363,2366],{},"Detailed introduction (optional reading): The ",[51,2342,2343],{},"cmake/stm32cubemx"," under ",[51,2346,2333],{}," here is managed by CubeMX. Once you regenerate the code with CubeMX, the contents of this file will be overwritten. However, the ",[51,2349,2333],{}," at the workspace root will not be overwritten, and it provides some areas for us to add source and header files. But this can make the file too cluttered. So we chose to create a new user folder, set up a ",[51,2352,2333],{}," inside it, and then use the top-level ",[51,2355,2333],{}," to load this sub-",[51,2358,2333],{},". This sub-",[51,2361,2333],{}," makes it easier for us to modify, and the file structure is clearer. (We don't need to create these ourselves—I've already created them in the ",[364,2364,2365],{},"Project File Migration"," section, and you've already copied them over when you copied the files above.)",[15,2368,2369],{},[132,2370],{"alt":49,"src":2371},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image92.webp",[15,2373,2374],{},"Then, go to the top-level CMakeLists.txt and add this line to reference our own CMakeLists.txt.",[15,2376,2377],{},[132,2378],{"alt":49,"src":2379},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image93.webp",[44,2381,2384],{"className":2382,"code":2383,"language":1782,"meta":49,"style":49},"language-cmake shiki shiki-themes github-light github-dark","\n# Add USER generated sources\nadd_subdirectory(cmake/user)\n",[51,2385,2386,2390,2395],{"__ignoreMap":49},[54,2387,2388],{"class":56,"line":57},[54,2389,61],{"emptyLinePlaceholder":60},[54,2391,2392],{"class":56,"line":64},[54,2393,2394],{"class":67},"# Add USER generated sources\n",[54,2396,2397,2400],{"class":56,"line":71},[54,2398,2399],{"class":204},"add_subdirectory",[54,2401,2402],{"class":211},"(cmake/user)\n",[15,2404,2405],{},"Great success, let's try compiling once. As shown in the image below, all the newly added files have been compiled.",[44,2407,2409],{"className":46,"code":2408,"language":48,"meta":49,"style":49},"cmake ..\nmake\n",[51,2410,2411,2417],{"__ignoreMap":49},[54,2412,2413,2415],{"class":56,"line":57},[54,2414,1782],{"class":74},[54,2416,1785],{"class":78},[54,2418,2419],{"class":56,"line":64},[54,2420,2421],{"class":74},"make\n",[15,2423,2424],{},[132,2425],{"alt":49,"src":2426},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image94.webp",[15,2428,2429,2430,2433,2434,2437,2438,2441,2442,2445,2446,2449,2450,2452,2453,2456],{},"Then go to ",[51,2431,2432],{},"main.c",", include the ",[51,2435,2436],{},"cpp_interface.h"," header file, and call the ",[51,2439,2440],{},"cpp_main()"," function at this location within the ",[51,2443,2444],{},"main"," function. (I have RTOS enabled here, so the ",[51,2447,2448],{},"cpp_main"," function needs to be called before starting RTOS. If you are using a bare-metal program without RTOS, just call ",[51,2451,2448],{}," above the ",[51,2454,2455],{},"while (1)"," loop.)",[15,2458,2459],{},[132,2460],{"alt":49,"src":2461},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image95.webp",[15,2463,2464],{},[132,2465],{"alt":49,"src":2466},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image96.webp",[15,2468,2469,2470,2473,2474,2476],{},"Then modify the ",[51,2471,2472],{},"isRTOS"," macro in ",[51,2475,2436],{}," to let the program know whether you have enabled RTOS. If enabled, set the macro to 1; if running on bare metal, set it to 0.",[15,2478,2479],{},[132,2480],{"alt":49,"src":2481},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image97.webp",[15,2483,2484],{},[132,2485],{"alt":49,"src":2486},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image98.webp",[15,2488,2489,2490,391],{},"For more detailed information about STM32 C/C++ project engineering, please refer to the ",[356,2491,2494],{"href":2492,"rel":2493},"https://sdutvincirobot.feishu.cn/wiki/PqsGwcPCuidbN6k13jfcGWtWn0b",[360],"Vinci Robotics Team Microcontroller Tutorial",[15,2496,2497],{},"Now compile the program in the build folder and find success!",[44,2499,2500],{"className":46,"code":2408,"language":48,"meta":49,"style":49},[51,2501,2502,2508],{"__ignoreMap":49},[54,2503,2504,2506],{"class":56,"line":57},[54,2505,1782],{"class":74},[54,2507,1785],{"class":78},[54,2509,2510],{"class":56,"line":64},[54,2511,2421],{"class":74},[15,2513,2514],{},[132,2515],{"alt":49,"src":2516},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image99.webp",[39,2518,2520],{"id":2519},"download-the-program-to-the-board","Download the program to the board",[912,2522,2524],{"id":2523},"configure-cmake-to-generate-bin-and-hex-files","Configure CMake to generate .bin and .hex files",[15,2526,2527],{},"Before downloading the program to the board, we need to check what files were actually generated from our previous compilation.",[15,2529,2530],{},"From the image below, it can be seen that it only generated a .elf file, not the common .bin and .hex files we typically see.",[15,2532,2533],{},[132,2534],{"alt":49,"src":2535},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image100.webp",[15,2537,2538],{},"We need to modify the CMakeLists.txt in the workspace again so that .hex and .bin files are generated during compilation (unfortunately, it has to be this tedious — I don't know why CubeMX doesn't handle it all).",[15,2540,2541],{},[132,2542],{"alt":49,"src":2543},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image101.webp",[44,2545,2547],{"className":2382,"code":2546,"language":1782,"meta":49,"style":49},"\n# 生成 .bin 和 .hex 文件\nfind_program(OBJCOPY arm-none-eabi-objcopy REQUIRED)\n\nadd_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD\n    COMMAND ${OBJCOPY} -O binary ${CMAKE_PROJECT_NAME}.elf ${CMAKE_PROJECT_NAME}.bin\n    COMMAND ${OBJCOPY} -O ihex   ${CMAKE_PROJECT_NAME}.elf ${CMAKE_PROJECT_NAME}.hex\n    COMMENT \"Generating ${CMAKE_PROJECT_NAME}.bin and ${CMAKE_PROJECT_NAME}.hex from ${CMAKE_PROJECT_NAME}.elf\"\n)\n",[51,2548,2549,2553,2558,2566,2570,2586,2608,2626,2634],{"__ignoreMap":49},[54,2550,2551],{"class":56,"line":57},[54,2552,61],{"emptyLinePlaceholder":60},[54,2554,2555],{"class":56,"line":64},[54,2556,2557],{"class":67},"# 生成 .bin 和 .hex 文件\n",[54,2559,2560,2563],{"class":56,"line":71},[54,2561,2562],{"class":204},"find_program",[54,2564,2565],{"class":211},"(OBJCOPY arm-none-eabi-objcopy REQUIRED)\n",[54,2567,2568],{"class":56,"line":100},[54,2569,61],{"emptyLinePlaceholder":60},[54,2571,2572,2575,2577,2580,2583],{"class":56,"line":105},[54,2573,2574],{"class":204},"add_custom_command",[54,2576,223],{"class":211},[54,2578,2579],{"class":204},"TARGET",[54,2581,2582],{"class":204}," ${CMAKE_PROJECT_NAME}",[54,2584,2585],{"class":211}," POST_BUILD\n",[54,2587,2588,2591,2594,2597,2600,2603,2605],{"class":56,"line":111},[54,2589,2590],{"class":204},"    COMMAND",[54,2592,2593],{"class":204}," ${OBJCOPY}",[54,2595,2596],{"class":211}," -O binary ",[54,2598,2599],{"class":204},"${CMAKE_PROJECT_NAME}",[54,2601,2602],{"class":211},".elf ",[54,2604,2599],{"class":204},[54,2606,2607],{"class":211},".bin\n",[54,2609,2610,2612,2614,2617,2619,2621,2623],{"class":56,"line":588},[54,2611,2590],{"class":204},[54,2613,2593],{"class":204},[54,2615,2616],{"class":211}," -O ihex   ",[54,2618,2599],{"class":204},[54,2620,2602],{"class":211},[54,2622,2599],{"class":204},[54,2624,2625],{"class":211},".hex\n",[54,2627,2628,2631],{"class":56,"line":614},[54,2629,2630],{"class":204},"    COMMENT",[54,2632,2633],{"class":78}," \"Generating ${CMAKE_PROJECT_NAME}.bin and ${CMAKE_PROJECT_NAME}.hex from ${CMAKE_PROJECT_NAME}.elf\"\n",[54,2635,2636],{"class":56,"line":2160},[54,2637,1734],{"class":211},[15,2639,2640],{},"I've written all the commands that need to be added to the workspace's main CMakeLists.txt in this notepad. Just copy them directly each time you generate a new project.",[15,2642,2643],{},[132,2644],{"alt":49,"src":2645},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image102.webp",[15,2647,2648],{},[132,2649],{"alt":49,"src":2650},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image103.webp",[15,2652,2653],{},"Then compile again.",[44,2655,2656],{"className":46,"code":2408,"language":48,"meta":49,"style":49},[51,2657,2658,2664],{"__ignoreMap":49},[54,2659,2660,2662],{"class":56,"line":57},[54,2661,1782],{"class":74},[54,2663,1785],{"class":78},[54,2665,2666],{"class":56,"line":64},[54,2667,2421],{"class":74},[15,2669,2670],{},[132,2671],{"alt":49,"src":2672},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image104.webp",[15,2674,2675],{},"Now look at the build directory: the .hex or .bin files we need are ready.",[15,2677,2678],{},[132,2679],{"alt":49,"src":2680},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image105.webp",[912,2682,2684],{"id":2683},"connect-the-device-to-the-jlink-and-flash-the-program","Connect the device to the JLink and flash the program.",[922,2686,2688],{"id":2687},"graphical-interface-flashing","Graphical interface flashing",[44,2690,2692],{"className":46,"code":2691,"language":48,"meta":49,"style":49},"#打开终端输入\nJFlashLite\n",[51,2693,2694,2699],{"__ignoreMap":49},[54,2695,2696],{"class":56,"line":57},[54,2697,2698],{"class":67},"#打开终端输入\n",[54,2700,2701],{"class":56,"line":64},[54,2702,2703],{"class":74},"JFlashLite\n",[15,2705,2706],{},"Select the corresponding chip model and speed.",[15,2708,2709],{},[132,2710],{"alt":49,"src":2711},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image106.webp",[15,2713,2714],{},"Add hex file",[15,2716,2717],{},[132,2718],{"alt":49,"src":2719},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image107.webp",[15,2721,2722],{},[132,2723],{"alt":49,"src":2724},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image108.webp",[15,2726,2727],{},"Click to burn and complete:",[15,2729,2730],{},[132,2731],{"alt":49,"src":2732},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image109.webp",[15,2734,2735],{},"Successfully lit the LED.",[15,2737,2738],{},[132,2739],{"alt":49,"src":2740},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image110.webp",[922,2742,2744],{"id":2743},"terminal-flashing","Terminal Flashing",[15,2746,2747],{},"Forget it, forget it, it's too much trouble.",[39,2749,2751],{"id":2750},"configure-vscode-tasks","Configure VSCode tasks",[15,2753,2754],{},"When we compile above, we always need to enter the following command",[44,2756,2758],{"className":2382,"code":2757,"language":1782,"meta":49,"style":49},"cd build\ncmake ..\nmake\n",[51,2759,2760,2765,2769],{"__ignoreMap":49},[54,2761,2762],{"class":56,"line":57},[54,2763,2764],{"class":211},"cd build\n",[54,2766,2767],{"class":56,"line":64},[54,2768,1775],{"class":211},[54,2770,2771],{"class":56,"line":71},[54,2772,2421],{"class":211},[15,2774,2775],{},"This makes compiling too cumbersome each time, so we use the powerful VSCode for one-click compilation.",[15,2777,2778,2779,2782,2783,2786],{},"First, create the ",[51,2780,2781],{},".vscode"," folder and the ",[51,2784,2785],{},"tasks.json"," file.",[15,2788,2789],{},[132,2790],{"alt":49,"src":2791},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image111.webp",[15,2793,2794,2795,2213],{},"Here is the content of ",[51,2796,2785],{},[44,2798,2802],{"className":2799,"code":2800,"language":2801,"meta":49,"style":49},"language-json shiki shiki-themes github-light github-dark","{\n    \"version\": \"2.0.0\",\n    \"options\": {\n        \"cwd\": \"${workspaceFolder}/build\"    //需要进入到我们执行tasks任务的文件夹中\n    },\n    \"tasks\": [    //tasks包含4个任务\n        {\n            \"type\": \"shell\",\n            \"label\": \"stm32-cmake\",    //第一个任务的名字叫cmake\n            \"command\": \"bash\",\n            \"args\": [\n                \"-c\",\n                \"mkdir -p ../log && echo \\\"===== CMake started at: $(date) =====\\\" | tee -a ../log/cmake.log && cmake .. 2>&1 | tee -a ../log/cmake.log\"\n            ],\n            \"problemMatcher\": []    //这里需要添加一个空的问题匹配器，否则会报错\n        },\n        {\n            \"label\": \"stm32-make\",    //第二个任务的名字叫make\n            \"command\": \"bash\",\n            \"args\": [\n                \"-c\",\n                \"mkdir -p ../log && echo \\\"===== Make started at: $(date) =====\\\" | tee -a ../log/make.log && make -j$(grep -c ^processor /proc/cpuinfo) 2>&1 | tee -a ../log/make.log\"\n            ],\n            \"problemMatcher\": []    //这里也需要添加一个空的问题匹配器，否则会报错\n        },\n        {\n            \"label\": \"stm32-Build\",    //第3个任务的名字叫Build\n            \"group\": {               //默认是build任务\n                \"kind\": \"build\",\n                \"isDefault\": true\n            },\n            \"dependsOrder\": \"sequence\",    //顺序执行依赖项\n            \"dependsOn\":[    //依赖的2个项为cmake、make\n                \"stm32-cmake\",    //即第一个任务的label\n                \"stm32-make\"      //即第二个任务的label\n            ]\n        },\n        {\n            \"type\": \"shell\",\n            \"label\": \"stm32-clean\",    //第四个任务：清理 build 文件夹\n            \"command\": \"bash\",\n            \"args\": [\n                \"-c\",\n                \"echo \\\"===== Clean started at: $(date) =====\\\" && rm -rf * && echo \\\"Build folder cleaned.\\\"\"\n            ],\n            \"options\": {\n                \"cwd\": \"${workspaceFolder}/build\"    //只清理build目录下的文件\n            },\n            \"problemMatcher\": []    //不需要问题匹配器\n        }\n\n    ]\n}\n","json",[51,2803,2804,2808,2822,2830,2843,2848,2859,2864,2876,2892,2904,2912,2919,2935,2940,2951,2956,2961,2976,2987,2994,3001,3016,3021,3031,3036,3041,3056,3068,3081,3092,3098,3114,3126,3137,3146,3152,3157,3162,3173,3188,3199,3206,3213,3239,3244,3252,3265,3270,3280,3286,3291,3297],{"__ignoreMap":49},[54,2805,2806],{"class":56,"line":57},[54,2807,2163],{"class":211},[54,2809,2810,2813,2816,2819],{"class":56,"line":64},[54,2811,2812],{"class":280},"    \"version\"",[54,2814,2815],{"class":211},": ",[54,2817,2818],{"class":78},"\"2.0.0\"",[54,2820,2821],{"class":211},",\n",[54,2823,2824,2827],{"class":56,"line":71},[54,2825,2826],{"class":280},"    \"options\"",[54,2828,2829],{"class":211},": {\n",[54,2831,2832,2835,2837,2840],{"class":56,"line":100},[54,2833,2834],{"class":280},"        \"cwd\"",[54,2836,2815],{"class":211},[54,2838,2839],{"class":78},"\"${workspaceFolder}/build\"",[54,2841,2842],{"class":67},"    //需要进入到我们执行tasks任务的文件夹中\n",[54,2844,2845],{"class":56,"line":105},[54,2846,2847],{"class":211},"    },\n",[54,2849,2850,2853,2856],{"class":56,"line":111},[54,2851,2852],{"class":280},"    \"tasks\"",[54,2854,2855],{"class":211},": [    ",[54,2857,2858],{"class":67},"//tasks包含4个任务\n",[54,2860,2861],{"class":56,"line":588},[54,2862,2863],{"class":211},"        {\n",[54,2865,2866,2869,2871,2874],{"class":56,"line":614},[54,2867,2868],{"class":280},"            \"type\"",[54,2870,2815],{"class":211},[54,2872,2873],{"class":78},"\"shell\"",[54,2875,2821],{"class":211},[54,2877,2878,2881,2883,2886,2889],{"class":56,"line":2160},[54,2879,2880],{"class":280},"            \"label\"",[54,2882,2815],{"class":211},[54,2884,2885],{"class":78},"\"stm32-cmake\"",[54,2887,2888],{"class":211},",    ",[54,2890,2891],{"class":67},"//第一个任务的名字叫cmake\n",[54,2893,2894,2897,2899,2902],{"class":56,"line":2166},[54,2895,2896],{"class":280},"            \"command\"",[54,2898,2815],{"class":211},[54,2900,2901],{"class":78},"\"bash\"",[54,2903,2821],{"class":211},[54,2905,2906,2909],{"class":56,"line":2175},[54,2907,2908],{"class":280},"            \"args\"",[54,2910,2911],{"class":211},": [\n",[54,2913,2914,2917],{"class":56,"line":2181},[54,2915,2916],{"class":78},"                \"-c\"",[54,2918,2821],{"class":211},[54,2920,2921,2924,2927,2930,2932],{"class":56,"line":2190},[54,2922,2923],{"class":78},"                \"mkdir -p ../log && echo ",[54,2925,2926],{"class":280},"\\\"",[54,2928,2929],{"class":78},"===== CMake started at: $(date) =====",[54,2931,2926],{"class":280},[54,2933,2934],{"class":78}," | tee -a ../log/cmake.log && cmake .. 2>&1 | tee -a ../log/cmake.log\"\n",[54,2936,2937],{"class":56,"line":2218},[54,2938,2939],{"class":211},"            ],\n",[54,2941,2942,2945,2948],{"class":56,"line":2232},[54,2943,2944],{"class":280},"            \"problemMatcher\"",[54,2946,2947],{"class":211},": []    ",[54,2949,2950],{"class":67},"//这里需要添加一个空的问题匹配器，否则会报错\n",[54,2952,2953],{"class":56,"line":2238},[54,2954,2955],{"class":211},"        },\n",[54,2957,2959],{"class":56,"line":2958},17,[54,2960,2863],{"class":211},[54,2962,2964,2966,2968,2971,2973],{"class":56,"line":2963},18,[54,2965,2880],{"class":280},[54,2967,2815],{"class":211},[54,2969,2970],{"class":78},"\"stm32-make\"",[54,2972,2888],{"class":211},[54,2974,2975],{"class":67},"//第二个任务的名字叫make\n",[54,2977,2979,2981,2983,2985],{"class":56,"line":2978},19,[54,2980,2896],{"class":280},[54,2982,2815],{"class":211},[54,2984,2901],{"class":78},[54,2986,2821],{"class":211},[54,2988,2990,2992],{"class":56,"line":2989},20,[54,2991,2908],{"class":280},[54,2993,2911],{"class":211},[54,2995,2997,2999],{"class":56,"line":2996},21,[54,2998,2916],{"class":78},[54,3000,2821],{"class":211},[54,3002,3004,3006,3008,3011,3013],{"class":56,"line":3003},22,[54,3005,2923],{"class":78},[54,3007,2926],{"class":280},[54,3009,3010],{"class":78},"===== Make started at: $(date) =====",[54,3012,2926],{"class":280},[54,3014,3015],{"class":78}," | tee -a ../log/make.log && make -j$(grep -c ^processor /proc/cpuinfo) 2>&1 | tee -a ../log/make.log\"\n",[54,3017,3019],{"class":56,"line":3018},23,[54,3020,2939],{"class":211},[54,3022,3024,3026,3028],{"class":56,"line":3023},24,[54,3025,2944],{"class":280},[54,3027,2947],{"class":211},[54,3029,3030],{"class":67},"//这里也需要添加一个空的问题匹配器，否则会报错\n",[54,3032,3034],{"class":56,"line":3033},25,[54,3035,2955],{"class":211},[54,3037,3039],{"class":56,"line":3038},26,[54,3040,2863],{"class":211},[54,3042,3044,3046,3048,3051,3053],{"class":56,"line":3043},27,[54,3045,2880],{"class":280},[54,3047,2815],{"class":211},[54,3049,3050],{"class":78},"\"stm32-Build\"",[54,3052,2888],{"class":211},[54,3054,3055],{"class":67},"//第3个任务的名字叫Build\n",[54,3057,3059,3062,3065],{"class":56,"line":3058},28,[54,3060,3061],{"class":280},"            \"group\"",[54,3063,3064],{"class":211},": {               ",[54,3066,3067],{"class":67},"//默认是build任务\n",[54,3069,3071,3074,3076,3079],{"class":56,"line":3070},29,[54,3072,3073],{"class":280},"                \"kind\"",[54,3075,2815],{"class":211},[54,3077,3078],{"class":78},"\"build\"",[54,3080,2821],{"class":211},[54,3082,3084,3087,3089],{"class":56,"line":3083},30,[54,3085,3086],{"class":280},"                \"isDefault\"",[54,3088,2815],{"class":211},[54,3090,3091],{"class":280},"true\n",[54,3093,3095],{"class":56,"line":3094},31,[54,3096,3097],{"class":211},"            },\n",[54,3099,3101,3104,3106,3109,3111],{"class":56,"line":3100},32,[54,3102,3103],{"class":280},"            \"dependsOrder\"",[54,3105,2815],{"class":211},[54,3107,3108],{"class":78},"\"sequence\"",[54,3110,2888],{"class":211},[54,3112,3113],{"class":67},"//顺序执行依赖项\n",[54,3115,3117,3120,3123],{"class":56,"line":3116},33,[54,3118,3119],{"class":280},"            \"dependsOn\"",[54,3121,3122],{"class":211},":[    ",[54,3124,3125],{"class":67},"//依赖的2个项为cmake、make\n",[54,3127,3129,3132,3134],{"class":56,"line":3128},34,[54,3130,3131],{"class":78},"                \"stm32-cmake\"",[54,3133,2888],{"class":211},[54,3135,3136],{"class":67},"//即第一个任务的label\n",[54,3138,3140,3143],{"class":56,"line":3139},35,[54,3141,3142],{"class":78},"                \"stm32-make\"",[54,3144,3145],{"class":67},"      //即第二个任务的label\n",[54,3147,3149],{"class":56,"line":3148},36,[54,3150,3151],{"class":211},"            ]\n",[54,3153,3155],{"class":56,"line":3154},37,[54,3156,2955],{"class":211},[54,3158,3160],{"class":56,"line":3159},38,[54,3161,2863],{"class":211},[54,3163,3165,3167,3169,3171],{"class":56,"line":3164},39,[54,3166,2868],{"class":280},[54,3168,2815],{"class":211},[54,3170,2873],{"class":78},[54,3172,2821],{"class":211},[54,3174,3176,3178,3180,3183,3185],{"class":56,"line":3175},40,[54,3177,2880],{"class":280},[54,3179,2815],{"class":211},[54,3181,3182],{"class":78},"\"stm32-clean\"",[54,3184,2888],{"class":211},[54,3186,3187],{"class":67},"//第四个任务：清理 build 文件夹\n",[54,3189,3191,3193,3195,3197],{"class":56,"line":3190},41,[54,3192,2896],{"class":280},[54,3194,2815],{"class":211},[54,3196,2901],{"class":78},[54,3198,2821],{"class":211},[54,3200,3202,3204],{"class":56,"line":3201},42,[54,3203,2908],{"class":280},[54,3205,2911],{"class":211},[54,3207,3209,3211],{"class":56,"line":3208},43,[54,3210,2916],{"class":78},[54,3212,2821],{"class":211},[54,3214,3216,3219,3221,3224,3226,3229,3231,3234,3236],{"class":56,"line":3215},44,[54,3217,3218],{"class":78},"                \"echo ",[54,3220,2926],{"class":280},[54,3222,3223],{"class":78},"===== Clean started at: $(date) =====",[54,3225,2926],{"class":280},[54,3227,3228],{"class":78}," && rm -rf * && echo ",[54,3230,2926],{"class":280},[54,3232,3233],{"class":78},"Build folder cleaned.",[54,3235,2926],{"class":280},[54,3237,3238],{"class":78},"\"\n",[54,3240,3242],{"class":56,"line":3241},45,[54,3243,2939],{"class":211},[54,3245,3247,3250],{"class":56,"line":3246},46,[54,3248,3249],{"class":280},"            \"options\"",[54,3251,2829],{"class":211},[54,3253,3255,3258,3260,3262],{"class":56,"line":3254},47,[54,3256,3257],{"class":280},"                \"cwd\"",[54,3259,2815],{"class":211},[54,3261,2839],{"class":78},[54,3263,3264],{"class":67},"    //只清理build目录下的文件\n",[54,3266,3268],{"class":56,"line":3267},48,[54,3269,3097],{"class":211},[54,3271,3273,3275,3277],{"class":56,"line":3272},49,[54,3274,2944],{"class":280},[54,3276,2947],{"class":211},[54,3278,3279],{"class":67},"//不需要问题匹配器\n",[54,3281,3283],{"class":56,"line":3282},50,[54,3284,3285],{"class":211},"        }\n",[54,3287,3289],{"class":56,"line":3288},51,[54,3290,61],{"emptyLinePlaceholder":60},[54,3292,3294],{"class":56,"line":3293},52,[54,3295,3296],{"class":211},"    ]\n",[54,3298,3300],{"class":56,"line":3299},53,[54,3301,289],{"class":211},[15,3303,3304],{},[364,3305,3306],{},"Method 1:",[15,3308,3309,3310,3313,3314,3317,3318,391],{},"On the VScode title bar, find ",[51,3311,3312],{},"终端",", then select ",[51,3315,3316],{},"运行构建任务",". The shortcut key is ",[51,3319,3320],{},"Ctrl+Shift+B",[15,3322,3323],{},[132,3324],{"alt":49,"src":3325},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image112.webp",[15,3327,3328],{},"It can be seen that the task has already been executed.",[15,3330,3331],{},[132,3332],{"alt":49,"src":3333},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image113.webp",[15,3335,3336],{},[364,3337,3338],{},"Method 2:",[15,3340,3309,3341,3313,3343,391],{},[51,3342,3312],{},[51,3344,3345],{},"运行任务",[15,3347,3348],{},[132,3349],{"alt":49,"src":3350},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image114.webp",[15,3352,3353,3354,3357,3358,3360,3361,3363],{},"Below are 4 STM32 tasks. The first one is the ",[51,3355,3356],{},"stm32-Build"," task. After running it, the effect is the same as Method 1 just now. The ",[51,3359,3316],{}," button in Method 1 actually runs this ",[51,3362,3356],{}," task.",[15,3365,3366,3367,3369],{},"This ",[51,3368,3356],{}," task includes the stm32-cmake and stm32-make tasks.",[15,3371,3372,3373,3376],{},"Then the ",[51,3374,3375],{},"stm32-clean"," task is to clear all files in the build folder.",[15,3378,3379],{},[132,3380],{"alt":49,"src":3381},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image115.webp",[15,3383,3384,3385,3363],{},"You can try the ",[51,3386,3375],{},[15,3388,3389],{},[132,3390],{"alt":49,"src":3391},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image116.webp",[15,3393,3394],{},"You can see that everything has been deleted.",[15,3396,3397],{},[132,3398],{"alt":49,"src":3399},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image117.webp",[15,3401,3402],{},"You don't need to worry about configuring so many things every time you create a new project.",[15,3404,3405,3406,391],{},"Most of the configuration files above are already included in ",[356,3407,3410],{"href":3408,"rel":3409},"https://github.com/tungchiahui/CubeMX%5C_MDK5to6%5C_Template%E4%BB%93%E5%BA%93%E4%B8%8B%E7%9A%84***%60%E5%B7%A5%E7%A8%8B%E6%96%87%E4%BB%B6%E7%A7%BB%E6%A4%8D(%E5%88%9B%E5%BB%BA%E6%96%B0%E6%A8%A1%E6%9D%BF%E8%AF%B7%E7%9C%8B%E8%BF%99%E9%87%8C)%60***%E6%96%87%E4%BB%B6%E5%A4%B9%E4%BA%86%EF%BC%8C%E5%88%B0%E6%97%B6%E5%80%99%E6%96%B0%E5%BB%BA%E4%B8%80%E4%B8%AA%E5%B7%A5%E7%A8%8B%E5%90%8E%EF%BC%8C%E7%9B%B4%E6%8E%A5%E6%8A%8A%E8%BF%99%E4%B8%AA%E6%96%87%E4%BB%B6%E5%A4%B9%E4%B8%8B%E7%9A%84%E6%89%80%E6%9C%89%E6%96%87%E4%BB%B6%E5%85%A8%E9%83%A8%E5%A4%8D%E5%88%B6%E8%BF%87%E6%9D%A5%E5%8D%B3%E5%8F%AF%E3%80%82",[360],"https://github.com/tungchiahui/CubeMX\\_MDK5to6\\_Template仓库下的***`工程文件移植(创建新模板请看这里)`***文件夹了，到时候新建一个工程后，直接把这个文件夹下的所有文件全部复制过来即可。",[39,3412,3414],{"id":3413},"using-ozone-for-flash-programming-and-debug-debugging","Using ozone for Flash programming and Debug debugging",[912,3416,3418],{"id":3417},"basic-configuration","Basic Configuration",[15,3420,3421,3422,3425],{},"Open the terminal, type ",[51,3423,3424],{},"ozone"," to launch the software, or directly find the application icon to open Ozone.",[15,3427,3428],{},[132,3429],{"alt":49,"src":3430},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image118.webp",[15,3432,3433],{},[132,3434],{"alt":49,"src":3435},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image119.webp",[15,3437,3438],{},"First, select a device, such as the STM32F407VET6 for my case.",[15,3440,3441],{},[132,3442],{"alt":49,"src":3443},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image120.webp",[15,3445,3446],{},[132,3447],{"alt":49,"src":3448},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image121.webp",[15,3450,3451],{},"Select Peripherals:",[15,3453,3454],{},[132,3455],{"alt":49,"src":3456},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image122.webp",[15,3458,3459],{},"Click Next.",[15,3461,3462],{},[132,3463],{"alt":49,"src":3464},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image123.webp",[15,3466,3467],{},"Fill in SWD if you are using SWD, or JTAG if you are using JTAG.",[15,3469,3470],{},[132,3471],{"alt":49,"src":3472},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image124.webp",[15,3474,3475],{},"Choose ELF",[15,3477,3478],{},[132,3479],{"alt":49,"src":3480},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image125.webp",[15,3482,3483],{},"You can choose elf, hex, or bin — generally, just pick elf.",[15,3485,3486],{},[132,3487],{"alt":49,"src":3488},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image126.webp",[15,3490,3491],{},"Just keep the default setting for this step.",[15,3493,3494],{},[132,3495],{"alt":49,"src":3496},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image127.webp",[15,3498,3499],{},"If you have enabled RTOS, you may encounter this issue.",[44,3501,3503],{"className":46,"code":3502,"language":48,"meta":49,"style":49},"warning (138): The target application seems to be using FreeRTOS, but FreeRTOS-awareness is not enabled.\n",[51,3504,3505],{"__ignoreMap":49},[54,3506,3507,3510],{"class":56,"line":57},[54,3508,3509],{"class":74},"warning",[54,3511,3512],{"class":211}," (138): The target application seems to be using FreeRTOS, but FreeRTOS-awareness is not enabled.\n",[15,3514,3515],{},"It means your target application appears to use FreeRTOS, but FreeRTOS debugging support (RTOS-awareness) is currently not enabled.",[15,3517,3518],{},[132,3519],{"alt":49,"src":3520},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image128.webp",[15,3522,3523],{},"Just apply the fix directly as instructed below.",[15,3525,3526],{},[132,3527],{"alt":49,"src":3528},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image129.webp",[15,3530,3531],{},"Just click continue.",[15,3533,3534],{},[132,3535],{"alt":49,"src":3536},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image130.webp",[15,3538,3539],{},[132,3540],{"alt":49,"src":3541},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image131.webp",[912,3543,3545],{"id":3544},"flashing-and-debugging","Flashing and Debugging",[15,3547,3548,3549],{},"You can check out the video below, it's pretty good. ",[364,3550,3551],{},"(Start watching from 30:10)",[15,3553,3554],{},[356,3555,3556],{"href":3556,"rel":3557},"https://www.bilibili.com/video/BV1yrLHzZEoE",[360],[15,3559,3560],{},[132,3561],{"alt":49,"src":3562},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image132.webp",[15,3564,3565],{},"Click File to sort by file name.",[15,3567,3568],{},[132,3569],{"alt":49,"src":3570},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image133.webp",[15,3572,3573,3574,3576],{},"Find ",[51,3575,2063],{}," and click to open this source file.",[15,3578,3579],{},[132,3580],{"alt":49,"src":3581},"https://cdn.tungchiahui.cn/tungwebsite/assets/images/2025/07/18/image134.webp",[3583,3584,3585],"style",{},"html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .s7hpK, html code.shiki .s7hpK{--shiki-default:#B31D28;--shiki-default-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic}",{"title":49,"searchDepth":64,"depth":64,"links":3587},[3588,3589,3590],{"id":12,"depth":71,"text":13},{"id":36,"depth":71,"text":37},{"id":1574,"depth":71,"text":1575},"/en-us/wiki/2025-07-18-linux-stm32-cmake-vscode-huan-jing-da-jian/ch2-linux","2",2000000,"2025-07-18","wiki/2025-07-18-linux-stm32-cmake-vscode-huan-jing-da-jian","en-us:2025-07-18-linux-stm32-cmake-vscode-huan-jing-da-jian","/en-us/wiki/2025-07-18-linux-stm32-cmake-vscode-huan-jing-da-jian","Linux STM32 CMake VScode环境搭建","md","wiki/2025-07-18-Linux-STM32-CMake-VScode环境搭建/ch2-Linux",false,null,"en-US","en-us",{},{"title":5,"description":49},"/wiki/2025-07-18-linux-stm32-cmake-vscode-huan-jing-da-jian/ch2-linux","_i18n/en-us/wiki/2025-07-18-Linux-STM32-CMake-VScode环境搭建/ch2-Linux","4OWbGNkwPUR8ziYqWXZ8Q7GUmC8_dh9Q2h0ljRW1bEI",[3611,3617,3618,3624],{"path":3612,"stem":3613,"title":3614,"date":3594,"chapter":3615,"chapterSort":3616,"docKey":3596,"docRoot":3597,"docTitle":3598,"isWikiDoc":60,"isWikiIndex":3601},"/en-us/wiki/2025-07-18-linux-stm32-cmake-vscode-huan-jing-da-jian/ch1-jian-jie","_i18n/en-us/wiki/2025-07-18-Linux-STM32-CMake-VScode环境搭建/ch1-简介","Introduction","1",1000000,{"path":3591,"stem":3608,"title":5,"date":3594,"chapter":3592,"chapterSort":3593,"docKey":3596,"docRoot":3597,"docTitle":3598,"isWikiDoc":60,"isWikiIndex":3601},{"path":3619,"stem":3620,"title":3621,"date":3594,"chapter":3622,"chapterSort":3623,"docKey":3596,"docRoot":3597,"docTitle":3598,"isWikiDoc":60,"isWikiIndex":3601},"/en-us/wiki/2025-07-18-linux-stm32-cmake-vscode-huan-jing-da-jian/ch3-windows","_i18n/en-us/wiki/2025-07-18-Linux-STM32-CMake-VScode环境搭建/ch3-Windows","Windows","3",3000000,{"path":3597,"stem":3625,"title":3626,"date":3594,"chapter":3602,"chapterSort":3627,"docKey":3596,"docRoot":3597,"docTitle":3598,"isWikiDoc":60,"isWikiIndex":60},"_i18n/en-us/wiki/2025-07-18-Linux-STM32-CMake-VScode环境搭建/index","Linux-STM32-CMake-VScode Environment Setup",0,{"variants":3629},[3630,3631,3634,3637,3640],{"path":3591,"localeSlug":3604,"i18nKey":3600},{"path":3632,"localeSlug":3633,"i18nKey":3600},"/zh-hant/wiki/2025-07-18-linux-stm32-cmake-vscode-huan-jing-da-jian/ch2-linux","zh-hant",{"path":3635,"localeSlug":3636,"i18nKey":3600},"/zh-hk/wiki/2025-07-18-linux-stm32-cmake-vscode-huan-jing-da-jian/ch2-linux","zh-hk",{"path":3638,"localeSlug":3639,"i18nKey":3600},"/zh-tw/wiki/2025-07-18-linux-stm32-cmake-vscode-huan-jing-da-jian/ch2-linux","zh-tw",{"path":3641,"localeSlug":3642,"i18nKey":3600},"/zh-cn/wiki/2025-07-18-linux-stm32-cmake-vscode-huan-jing-da-jian/ch2-linux","zh-cn",[3591,3607,3632,3607,3635,3607,3638,3607,3641,3607],1780671793598]