--- # ICM_演算法_實驗1 Building in 2024/3/19 --- # 環境建置 * 我的環境 * 作業系統: windows 11 * 處理器: 11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz * 目標裝置: stm32f429I-DISC1 ## STM32CubeMX ### 目的 * 由 ST 提供的初始化代碼生成器 ### 安裝步驟 1. 從[官網](https://www.st.com/en/development-tools/stm32cubemx.html)下載最新版本 * 需要登入會員才能下載  2. 解壓縮後就照步驟安裝即可 ## Windows make ### 目的 * make 是一個工具程式,經由讀取一個叫做 makefile 的檔案,自動化建構軟體 * 因為 windows 沒有自帶 make 工具,因此需要另外安裝 ### 安裝步驟 1. 到 [GNU 的網站](https://gnuwin32.sourceforge.net/packages/make.htm)下載安裝檔  2. 照步驟安裝 * 這時候需要紀錄安裝位置,因為稍後需要設定相關的環境變數 3. 設定環境變數 1 * ```檔案總管 >> 本機(右鍵) >> 內容 >> 進階系統設定 >> 環境變數```    4. 設定環境變數 2 * ```使用者變數 >> path >> 新增 make 的執行檔位置``` 5. 環境變數設定測試。有出現以下文字表示設定成功 ```shell= C:\Users\again>make -v GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program built for i386-pc-mingw32 ``` ## Arm GNU Toolchain ### 目的 * 一系列用於製作軟體程式的工具。例如:編譯器(arm-none-eabi-gcc)、連結器(arm-none-eabi-ld)等 * 不同的軟體開發需要不同的工具鍊,本篇文章是面向 STM32f4xx 的開發,因此需要的工具鍊為 "Arm GNU Toolchain" * 過去常用的 GNU Arm Embedded Toolchain 已被 Arm GNU Toolchain 取代,並且已經被 Arm 標記為 discontinued ### 安裝步驟 1. 到 [Arm GNU Toolchain 官網](https://gnuwin32.sourceforge.net/packages/make.htm)下載安裝檔並安裝 * 可以選擇使用安裝檔或是使用壓縮檔再移動到 "Program Files (x86)" *  2. 設定環境變數 * 就是找到執行檔位置並加入環境變數 3. 環境變數設定測試。有出現以下文字表示設定成功 ```shell= C:\Users\again>arm-none-eabi-gcc -v Using built-in specs. COLLECT_GCC=arm-none-eabi-gcc COLLECT_LTO_WRAPPER=C:/Program\ Files\ (x86)/Arm\ GNU\ Toolchain\ arm-none-eabi/13.2\ Rel1/bin/../libexec/gcc/arm-none-eabi/13.2.1/lto-wrapper.exe Target: arm-none-eabi Configured with: /data/jenkins/workspace/GNU-toolchain/arm-13/src/gcc/configure --target=arm-none-eabi --prefix=/data/jenkins/workspace/GNU-toolchain/arm-13/build-mingw-arm-none-eabi/install --with-gmp=/data/jenkins/workspace/GNU-toolchain/arm-13/build-mingw-arm-none-eabi/host-tools --with-mpfr=/data/jenkins/workspace/GNU-toolchain/arm-13/build-mingw-arm-none-eabi/host-tools --with-mpc=/data/jenkins/workspace/GNU-toolchain/arm-13/build-mingw-arm-none-eabi/host-tools --with-isl=/data/jenkins/workspace/GNU-toolchain/arm-13/build-mingw-arm-none-eabi/host-tools --disable-shared --disable-nls --disable-threads --disable-tls --enable-checking=release --enable-languages=c,c++,fortran --with-newlib --with-gnu-as --with-headers=yes --with-gnu-ld --with-native-system-header-dir=/include --with-sysroot=/data/jenkins/workspace/GNU-toolchain/arm-13/build-mingw-arm-none-eabi/install/arm-none-eabi --with-multilib-list=aprofile,rmprofile --with-libiconv-prefix=/data/jenkins/workspace/GNU-toolchain/arm-13/build-mingw-arm-none-eabi/host-tools --host=i686-w64-mingw32 --with-pkgversion='Arm GNU Toolchain 13.2.rel1 (Build arm-13.7)' --with-bugurl=https://bugs.linaro.org/ Thread model: single Supported LTO compression algorithms: zlib gcc version 13.2.1 20231009 (Arm GNU Toolchain 13.2.rel1 (Build arm-13.7)) ``` 4. 編譯測試 * 使用從 [jserv 的 stm32f429-lcd-demo 專案](https://github.com/jserv/stm32f429-lcd-demo/tree/master)修改的測試範例 * 編譯成功則顯示 *  * 備註: 主要的修改是根據最新版本的 openocd 修改 makefile ```shell= git clone https://github.com/AgainTW/stm32f429-lcd-demo cd stm32f429-lcd-demo make all ``` ## Openocd ### 目的 * OpenOCD(Open On-Chip Debugger)開源片上調試器,是一款開源軟體,最初是由 Dominic Rath 同學還在大學期間發起的(2005年)專案。 OpenOCD 旨在提供嵌入式設備的調試、系統編程和邊界掃描功能。 ### 安裝步驟 1. 到 [Openocd 官網](https://openocd.org/pages/getting-openocd.html),選擇非官方的二進制檔 *  2. 選擇 win32 的壓縮檔 *  3. 將執行檔的位置加入環境變數 * ```..我不知道你放哪裡\xpack-openocd-0.12.0-2-win32-x64\xpack-openocd-0.12.0-2\bin``` 4. 環境變數設定測試。有出現以下文字表示設定成功 ```shell= C:\Users\again>openocd -v xPack Open On-Chip Debugger 0.12.0+dev-01312-g18281b0c4-dirty (2023-09-04-22:32) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html ``` 5. 燒錄測試 ```shell= git clone https://github.com/AgainTW/stm32f429-lcd-demo cd stm32f429-lcd-demo make all make flash ``` ## 小節 * 完成編譯和燒錄測試後,到這邊就差不多完成必要的環境的建置了 * windows 上的 git 是我在很早之前安裝的,網路上應該查的到教學課程,本篇就不另外贅述 --- # 參考 * [HT32 MCU GNU Arm Compiler 使用說明](https://www.holtek.com.tw/webapi/105580/an0611tc.pdf) * [Windows 下构建 STM32 开发环境](https://wangyuyang.me/posts/windows%E4%B8%8B%E6%9E%84%E5%BB%BAstm32%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83/#fn:1) * [GNU win32 make](https://gnuwin32.sourceforge.net/packages/make.htm) * [Arm GNU Toolchain Downloads](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads) * [jserv: stm32f429-lcd-demo](https://github.com/jserv/stm32f429-lcd-demo/tree/master) * [修改後的測試範例](https://github.com/AgainTW/stm32f429-lcd-demo) * [跟我一起学OpenOCD(一)](https://zhuanlan.zhihu.com/p/41517198)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up