【EWARM】EWARM(IAR)的安裝過程以及GD32的IAR工程模板搭建

一、簡介

IAR官網

EWARM,即 IAR Embedded Workbench for ARM,是由 IAR Systems 開發的一款專門用于 ARM 微處理器軟件開發的集成開發環境。以下是具體介紹:

  • 功能特性
    • 完整工具鏈支持:集成了高級編輯器、全面的編譯器工具鏈以及功能強大的調試器,支持從編碼、編譯、調試到固件下載的完整開發周期。
    • 多核心支持:支持多種 ARM 核心,如 Cortex-M、Cortex-R 等,還為不同的 ARM 內核和硬件平臺提供了一系列預設的項目模板,可針對不同處理器進行優化編譯。
    • 實時操作系統兼容:支持多種 RTOS,包括 FreeRTOS、RT-Thread、uC/OS 等,方便開發者在多任務或高實時性要求的應用場景中進行開發。
  • 調試功能
    • 豐富調試接口:支持 JTAG 調試,也可使用 SWD 接口,方便開發者訪問微控制器的內部資源,如寄存器、內存和外設等,以進行實時調試和分析。
    • 多種調試手段:內置的調試器提供了斷點、步進、單步、變量觀察和寄存器查看等功能,還支持事件追蹤、數據追蹤和地址追蹤等多種追蹤模式,以及代碼覆蓋率分析和性能分析等功能,有助于開發者發現程序瓶頸并優化程序性能。
  • 主要模塊
    • 編譯器:高度優化的 IAR ARM C/C++ Compiler,具有先進的通用編譯器優化和針對特定處理器的速度優化及存儲器優化功能。
    • 鏈接器:一個通用的 IAR XLINK Linker,可將編譯后的目標文件鏈接成可執行文件或庫文件。
    • 建庫程序和運行庫:IAR XAR 和 XLIB 建庫程序用于創建和管理庫文件,IAR DLIB C/C++ 運行庫提供了運行時所需的函數支持。
    • 調試器:IAR C-SPY 調試器是一款先進的高級語言調試器,支持源代碼和反匯編程序調試,具備復雜的代碼和數據斷點、豐富的數據監視功能等。
    • 其他:還包括項目管理器、功能強大的編輯器以及命令行實用程序等。
  • 優勢特點
    • 入門容易:相較于其他一些 ARM 開發環境,EWARM 具有較為友好的操作界面和相對簡單的配置流程,開發者能夠較快上手,適合初學者使用。
    • 代碼緊湊:通過其優化的編譯器和相關工具,生成的代碼具有較高的效率,代碼體積相對較小,能夠更好地適應嵌入式系統對資源有限的特點。
    • 跨平臺支持良好:從軟件模擬器到高性能的硬件調試器,EWARM 提供了廣泛的目標設備支持,可在不同的開發環境和硬件平臺上使用。

二、EWARM(IAR)安裝過程

1.點擊運行安裝程序

2.選擇第1個選項安裝IAR FOR ARM(對于ARM架構的)

3.NEXT

4.accept,NEXT

5.選擇安裝路徑(建議C盤以外,最好新建一個不含有中文的文件夾,因為后續有些版本不支持中文路徑),下一步

6.驅動

7.下一步

8.確定

9.安裝

10.等待安裝完成

11.暫時不打開軟件,暫時取消證書的安裝

12.驅動無腦裝

?

這是?TI Emulators 8.0.803.0(德州儀器仿真器軟件)的安裝許可協議界面,核心內容是:

1. 界面功能

  • 呈現?德州儀器(Texas Instruments)的軟件許可協議,要求你閱讀并決定是否接受條款。
  • 協議里有版權、使用限制、責任等法律約束內容(2004 年 3 月 11 日版本 )。

2. 操作選項

  • 接受協議(I accept the agreement):選這個才能繼續安裝,代表你同意遵守協議條款。
  • 不接受(I do not accept the agreement):選這個會終止安裝,無法使用軟件。

簡單說,就是安裝前讓你確認 “是否同意德州儀器的軟件使用規則”,想裝軟件就得選 “接受”,點 “Next” 繼續流程;不想裝就選 “不接受” 或直接關窗口~

這是?TI Emulators 8.0.803.0(德州儀器仿真器軟件)?的安裝路徑設置界面,核心信息是:

1. 標題含義

“Code Composer Studio Installation Directory”:需指定軟件安裝路徑,若和 Code Composer Studio(CCS,德州儀器的集成開發環境)一起用,要選對應 CCS 版本(ccsv5/6/7)的文件夾。

2. 路徑說明

  • 默認路徑是?C:\ti,你可以修改成其他自定義路徑(點輸入框右側文件夾圖標選位置)。
  • 若已有 CCS,按提示選到 CCS 安裝目錄里的?ccsv5/ccsv6/ccsv7?文件夾,能讓仿真器和 CCS 更好配合。

3. 操作邏輯

選好路徑后點 “Next” 繼續安裝;想改路徑就調整輸入框內容;不想裝了點 “Cancel” 退出。

簡單說,就是讓你選 “把 TI 仿真器軟件裝到電腦哪個位置”,按需求(或默認)設好路徑,繼續下一步安裝流程~

13.打開運行,準備安裝證書

取消

14.到help下的License manager

15.點擊License下的離線激活

16.注冊機

17.將注冊機的License Number,放到離線激活里,然后,離線激活里再點擊下一步

18.NO?

19.選擇存放初始證書的位置,后面再使用這個產生一個回應的驗證證書

20.確認下一步

21.使用注冊機去使用初始證書,產生一個回應的驗證證書(真正的證書)

選擇初始證書

點擊產生?

22.回到注冊頁面,選擇回應文件

?

23.后續

這是?IAR License Manager(IAR 許可證管理器)?的彈窗,對應?IAR Embedded Workbench for Arm 8.32?版本,核心內容是:

1. 功能說明

你的許可證允許提取?IAR Library Source for Arm(ARM 庫源代碼包),這些代碼可輔助開發,但提取需要管理員權限(確保系統級操作權限)。

2. 操作選項

  • Yes:立即提取庫源代碼,點了之后會觸發管理員權限申請(可能彈 UAC 確認框),完成后把代碼放到指定路徑。
  • No:暫不提取,之后想提隨時能在許可證管理器里操作;若勾選?Don't notify me about this again,下次不會再彈這個提示。

3. 建議邏輯

  • 若開發時需要調試 / 查看庫代碼(比如做底層優化、排錯),選?Yes?提取,方便后續開發;
  • 若只是簡單用 IAR 編譯、不碰庫源碼,選?No?也不影響基礎功能。

簡單說,就是 “許可證給你權限提取 ARM 庫源碼,要不要現在用管理員權限提取”,按需選就行~

我選的yes?

24.綠色狀態,完成

三、初步新建IAR下的GD32工程模板

注:硬件平臺:立創梁山派

1.到GD32的官網下載固件庫和IAR環境支持包(環境補丁)

2.安裝IAR補丁,一定一定要以管理員身份運行才能讓其自動檢測到你安裝的IAR路徑!!!

3.新建工程文件夾IAR_GD32_Template

4.\GD32F4xx_Firmware_Library_V3.3.1\GD32F4xx_Firmware_Library_V3.3.1\GD32F4xx_Firmware_Library下的Firmware里就是外設源文件,但是,首先,在我們的工程文件夾里新建文件夾

5.搬移文件

(1)CMSIS

\GD32F4xx_Firmware_Library_V3.3.1\GD32F4xx_Firmware_Library_V3.3.1\GD32F4xx_Firmware_Library\Firmware\CMSIS的core內核文件放到CMSIS

(2)StartUp

IAR環境啟動文件

\GD32F4xx_Firmware_Library_V3.3.1\GD32F4xx_Firmware_Library_V3.3.1\GD32F4xx_Firmware_Library\Firmware\CMSIS\GD\GD32F4xx\Source\IAR下的啟動文件放到StartUp

(3)SYSTEM

\GD32F4xx_Firmware_Library_V3.3.1\GD32F4xx_Firmware_Library_V3.3.1\GD32F4xx_Firmware_Library\Firmware\CMSIS\GD\GD32F4xx下的頭文件放到SYSTEM的INCLUDE

\GD32F4xx_Firmware_Library_V3.3.1\GD32F4xx_Firmware_Library_V3.3.1\GD32F4xx_Firmware_Library\Firmware\CMSIS\GD\GD32F4xx\Source下的system_gd32f4xx.c放到SYSTEM的SOURCE

(4)USER

同時根據官方例程需要一些其他文件支持,在\GD32F4xx_Firmware_Library_V3.3.1\GD32F4xx_Firmware_Library_V3.3.1\GD32F4xx_Firmware_Library\Template尋找

根據自己習慣,分個類

(5)GD32F4xx_standard_peripheral

\GD32F4xx_Firmware_Library_V3.3.1\GD32F4xx_Firmware_Library_V3.3.1\GD32F4xx_Firmware_Library\Firmware\GD32F4xx_standard_peripheral

將外設源文件全放到GD32F4xx_standard_peripheral

6.打開IAR,創建IAR工程

7.跟keil就差不多了,就是新建組別,添加文件

?

8.工程配置

(1)右擊項目,選擇Options

(2)選芯片

(3)配置庫,內核文件已有CMSIS

設置外部文件夾Debug

(4)添加宏,路徑

USE_STDPERIPH_DRIVER,GD32F4XX,LV_CONF_INCLUDE_SIMPLE

下拉選擇相對路徑:

(5)輸出配置

(6)選擇下載模式

差點忘記立創梁山派用的DAP了

(7)選擇鏈接文件

Linker --> Config --> Linker configuration file? 勾選上 Override default 重設默認文件

9.編譯

保存工作空間

10.解決報錯

Building configuration: IAR_GD32 - Debug 
Updating build tree... 0  file(s) deleted. 
Updating build tree... 
startup_gd32f450_470.s 
gd32f4xx_exmc.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_dbg.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_enet.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_dci.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_dma.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_dac.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_crc.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_can.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_ctc.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_adc.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_misc.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_i2c.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_pmu.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_fwdgt.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_exti.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_ipa.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_fmc.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_it.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_gpio.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_iref.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_wwdgt.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_tli.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_rcu.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_rtc.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_sdio.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_spi.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_syscfg.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_usart.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_timer.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
gd32f4xx_trng.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
main.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
systick.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler 
system_gd32f4xx.c  
Fatal Error[Pe035]: #error directive: "Please select the target GD32F4xx device in gd32f4xx.h file" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\SYSTEM\Include\gd32f4xx.h 56 
Error while running C/C++ Compiler Total number of errors: 33 
Total number of warnings: 0 

添加具體的芯片的宏?

Building configuration: IAR_GD32 - Debug 
Updating build tree... 1  file(s) deleted. 
Updating build tree... 
startup_gd32f450_470.s 
gd32f4xx_exmc.c  
gd32f4xx_can.c  
gd32f4xx_ctc.c  
gd32f4xx_dbg.c  
gd32f4xx_dma.c  
gd32f4xx_dci.c  
gd32f4xx_crc.c  
gd32f4xx_enet.c  
gd32f4xx_dac.c  
gd32f4xx_adc.c  
gd32f4xx_exti.c  
gd32f4xx_i2c.c  
gd32f4xx_pmu.c  
gd32f4xx_misc.c  
gd32f4xx_fmc.c  
gd32f4xx_gpio.c  
gd32f4xx_fwdgt.c  
gd32f4xx_rcu.c  
gd32f4xx_it.c  
gd32f4xx_ipa.c  
gd32f4xx_iref.c  
main.c  
Fatal Error[Pe1696]: cannot open source file "gd32f450i_eval.h" E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\USER\Source\main.c 39 searched: "E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\USER\Source\" searched: "E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\Project\..\CMSIS\" searched: "E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\Project\..\GD32F4xx_standard_peripheral\Include\" searched: "E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\Project\..\GD32F4xx_standard_peripheral\Source\" searched: "E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\Project\..\StartUp\" searched: "E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\Project\..\SYSTEM\Include\" searched: "E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\Project\..\SYSTEM\Source\" searched: "E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\Project\..\USER\Include\" searched: "E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\Project\..\USER\Source\" searched: "D:\IAR Systems\Embedded Workbench 8.2\arm\inc\" searched: "D:\IAR Systems\Embedded Workbench 8.2\arm\inc\c\" current directory: "E:\EWARM_Projects\EWARM_Examples_Workspaces\IAR_GD32\IAR_GD32_Template\USER\Source" 
Error while running C/C++ Compiler 
gd32f4xx_wwdgt.c  
gd32f4xx_rtc.c  
gd32f4xx_trng.c  
gd32f4xx_syscfg.c  
gd32f4xx_tli.c  
gd32f4xx_sdio.c  
gd32f4xx_spi.c  
gd32f4xx_usart.c  
gd32f4xx_timer.c  
systick.c  
system_gd32f4xx.c  Total number of errors: 1 
Total number of warnings: 0 

方法1:

添加上去gd32f450i_eval.c/h

方法二:

重寫main.c,不用#include "gd32f450i_eval.h"

11.代碼改正

gd32f4xx_it.c

注釋led_spark();

/*!\file    gd32f4xx_it.c\brief   interrupt service routines\version 2024-12-20, V3.3.1, firmware for GD32F4xx
*//*Copyright (c) 2024, GigaDevice Semiconductor Inc.Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:1. Redistributions of source code must retain the above copyright notice, thislist of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyright notice,this list of conditions and the following disclaimer in the documentationand/or other materials provided with the distribution.3. Neither the name of the copyright holder nor the names of its contributorsmay be used to endorse or promote products derived from this software withoutspecific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/#include "gd32f4xx_it.h"
#include "main.h"
#include "systick.h"/*!\brief      this function handles NMI exception\param[in]  none\param[out] none\retval     none
*/
void NMI_Handler(void)
{/* if NMI exception occurs, go to infinite loop */while(1) {}
}/*!\brief      this function handles HardFault exception\param[in]  none\param[out] none\retval     none
*/
void HardFault_Handler(void)
{/* if Hard Fault exception occurs, go to infinite loop */while(1) {}
}/*!\brief      this function handles MemManage exception\param[in]  none\param[out] none\retval     none
*/
void MemManage_Handler(void)
{/* if Memory Manage exception occurs, go to infinite loop */while(1) {}
}/*!\brief      this function handles BusFault exception\param[in]  none\param[out] none\retval     none
*/
void BusFault_Handler(void)
{/* if Bus Fault exception occurs, go to infinite loop */while(1) {}
}/*!\brief      this function handles UsageFault exception\param[in]  none\param[out] none\retval     none
*/
void UsageFault_Handler(void)
{/* if Usage Fault exception occurs, go to infinite loop */while(1) {}
}/*!\brief      this function handles SVC exception\param[in]  none\param[out] none\retval     none
*/
void SVC_Handler(void)
{/* if SVC exception occurs, go to infinite loop */while(1) {}
}/*!\brief      this function handles DebugMon exception\param[in]  none\param[out] none\retval     none
*/
void DebugMon_Handler(void)
{/* if DebugMon exception occurs, go to infinite loop */while(1) {}
}/*!\brief      this function handles PendSV exception\param[in]  none\param[out] none\retval     none
*/
void PendSV_Handler(void)
{/* if PendSV exception occurs, go to infinite loop */while(1) {}
}/*!\brief    this function handles SysTick exception\param[in]  none\param[out] none\retval     none
*/
void SysTick_Handler(void)
{//led_spark();delay_decrement();
}

?main.h

注釋void led_spark(void);

/*!\file    main.h\brief   the header file of main\version 2024-12-20, V3.3.1, firmware for GD32F4xx
*//*Copyright (c) 2024, GigaDevice Semiconductor Inc.Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:1. Redistributions of source code must retain the above copyright notice, thislist of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyright notice,this list of conditions and the following disclaimer in the documentationand/or other materials provided with the distribution.3. Neither the name of the copyright holder nor the names of its contributorsmay be used to endorse or promote products derived from this software withoutspecific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/#ifndef __MAIN_H
#define __MAIN_H/* led spark function */
//void led_spark(void);#endif /* __MAIN_H */

main.c

/*!\file    main.c\brief   led spark with systick\version 2024-12-20, V3.3.1, firmware for GD32F4xx
*//*Copyright (c) 2024, GigaDevice Semiconductor Inc.Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:1. Redistributions of source code must retain the above copyright notice, thislist of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyright notice,this list of conditions and the following disclaimer in the documentationand/or other materials provided with the distribution.3. Neither the name of the copyright holder nor the names of its contributorsmay be used to endorse or promote products derived from this software withoutspecific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/#include "gd32f4xx.h"
#include "systick.h"
#include <stdio.h>
#include "main.h"//#include "gd32f450i_eval.h"int main(void)
{systick_config();// 開啟時鐘rcu_periph_clock_enable(RCU_GPIOD);   /* 配置為輸出模式 */gpio_mode_set(GPIOD,GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_7);/* 配置為推挽輸出 50MHZ */gpio_output_options_set(GPIOD, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_7);gpio_bit_set(GPIOD,  GPIO_PIN_7);while(1){gpio_bit_write(GPIOD, GPIO_PIN_7, RESET);delay_1ms(100);gpio_bit_write(GPIOD, GPIO_PIN_7, SET);delay_1ms(100);}
}///*!
//    \brief    toggle the led every 500ms
//    \param[in]  none
//    \param[out] none
//    \retval     none
//*/
//void led_spark(void)
//{
//    static __IO uint32_t timingdelaylocal = 0U;
//
//    if(timingdelaylocal) {
//
//        if(timingdelaylocal < 500U) {
//            gd_eval_led_on(LED1);
//        } else {
//            gd_eval_led_off(LED1);
//        }
//
//        timingdelaylocal--;
//    } else {
//        timingdelaylocal = 1000U;
//    }
//}
//
///*!
//    \brief    main function
//    \param[in]  none
//    \param[out] none
//    \retval     none
//*/
//int main(void)
//{
//#ifdef __FIRMWARE_VERSION_DEFINE
//    uint32_t fw_ver = 0;
//#endif
//
//    gd_eval_led_init(LED1);
//    systick_config();
//
//#ifdef __FIRMWARE_VERSION_DEFINE
//    fw_ver = gd32f4xx_firmware_version_get();
//    /* print firmware version */
//    printf("\r\nGD32F4xx series firmware version: V%d.%d.%d", (uint8_t)(fw_ver >> 24), (uint8_t)(fw_ver >> 16), (uint8_t)(fw_ver >> 8));
//#endif /* __FIRMWARE_VERSION_DEFINE */
//
//    while(1) {
//    }
//}
//
//#ifdef GD_ECLIPSE_GCC
///* retarget the C library printf function to the USART, in Eclipse GCC environment */
//int __io_putchar(int ch)
//{
//    usart_data_transmit(EVAL_COM0, (uint8_t)ch);
//    while(RESET == usart_flag_get(EVAL_COM0, USART_FLAG_TBE));
//    return ch;
//}
//#else
///* retarget the C library printf function to the USART */
//int fputc(int ch, FILE *f)
//{
//    usart_data_transmit(EVAL_COM0, (uint8_t)ch);
//    while(RESET == usart_flag_get(EVAL_COM0, USART_FLAG_TBE));
//
//    return ch;
//}
//#endif /* GD_ECLIPSE_GCC */

?編譯沒有問題

12.下載

注意:由于IAR對于DAP支持較差,可能出問題,需要重新設置一下DAP

參考鏈接:H7-TOOL的高速DAPLINKY用于IAR9.30的設置說明(2022-06-18) - H7-TOOL開發工具 - 硬漢嵌入式論壇 - Powered by Discuz!

DAP下載失敗問題的解決方法:

(1)DAP開啟?

(2)這里建議選擇Software和Hardware,我選的Software成功

勾選

(3)接口模式SWD

我成功了?

13.成功,演示過程

點OK?

點GO,不打斷點,全速運行

四、實驗效果

工程鏈接:

https://github.com/Molesidy/GD32.githttps://github.com/Molesidy/GD32.git

參考鏈接(如有侵權,請聯系刪除):

IAR新建工程模塊及工程配置 - GWen9 - 博客園

IAR for ARM下載、安裝、注冊,并搭建stm32工程(胎教版)

IAR的工程路徑和頭文件路徑的配置問題

H7-TOOL的高速DAPLINKY用于IAR9.30的設置說明(2022-06-18) - H7-TOOL開發工具 - 硬漢嵌入式論壇 - Powered by Discuz!

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/916423.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/916423.shtml
英文地址,請注明出處:http://en.pswp.cn/news/916423.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

【工程化】淺談前端構建工具

一、前端構建工具概述? 前端構建工具是輔助開發者將源代碼轉換為瀏覽器可直接運行的靜態資源的工具集合。隨著前端技術的發展&#xff0c;源代碼往往包含瀏覽器無法直接解析的語法&#xff08;如 TypeScript、Sass&#xff09;、模塊化規范&#xff08;如 ES Modules、Common…

數據取證:Elcomsoft Password Digger,解密 macOS (OS X) 鑰匙串信息

Elcomsoft Password Digger&#xff08;EPD&#xff09;是一款在 Windows 平臺上使用的工具&#xff0c;用于解密存儲在 macOS 鑰匙串中的信息。該工具可以將加密的鑰匙串內容導出到一個純文本 XML 文件中&#xff0c;方便查看和分析。一鍵字典構建功能可以將鑰匙串中的所有密碼…

2.JVM跨平臺原理(字節碼機制)

目錄引言一、跨平臺就跟國際語言翻譯似的二、字節碼和 JVM 到底是啥玩意兒三、解決 “語言不通” 這個老難題四、實現 “一次編寫&#xff0c;到處運行” 就這四步五、字節碼技術給世界帶來的大改變總結引言 咱平常是不是老納悶兒&#xff0c;為啥同一個 Java 程序&#xff0c…

06-ES6

微任務&宏任務JS是單線程執行。所有要執行的任務都要排隊。所有的同步任務會在主線程上排隊&#xff0c;等待執行。異步任務&#xff1a;不會進入主線程&#xff0c;而是會進入任務隊列。等到主線程上的任務執行完成之后&#xff0c;通知任務隊列&#xff0c;執行異步任務。…

FreeSWITCH配置文件解析(10) 配置IP封禁(防暴力破解)

以下是針對FreeSWITCH配置IP封禁&#xff08;防暴力破解&#xff09;的完整方案&#xff0c;結合Fail2Ban與系統級防護策略&#xff1a;一、Fail2Ban核心配置&#xff08;推薦方案&#xff09;??啟用FreeSWITCH鑒權日志??修改SIP Profile&#xff08;conf/sip_profiles/int…

【React 入門系列】React 組件通訊與生命周期詳解

&#x1f9e9; 第一章&#xff1a;組件通訊概述在 React 開發中&#xff0c;組件是封裝的、獨立的功能單元。為了實現組件間的數據共享與協作&#xff0c;需要通過組件通訊機制。組件通訊的意義&#xff1a; 讓多個封閉的組件能夠共享數據&#xff0c;實現協作功能。&#x1f4…

前端開發 Vue 狀態優化

Vue 項目中的狀態優化一般都會用Pinia替代Vuex&#xff0c;Pinia 是 Vue 生態系統中的一個輕量級狀態管理庫&#xff0c;作為 Vuex 的替代品&#xff0c;它提供了更簡潔的 API 和更好的性能。模塊化管理&#xff1a;使用 Pinia 時&#xff0c;建議將狀態拆分為多個 store 模塊&…

虛幻基礎:創建角色——FPS

能幫到你的話&#xff0c;就給個贊吧 &#x1f618; 文章目錄創建角色設置模型添加攝像機添加位置&#xff1a;插槽彈簧臂&#xff1a;伸縮防止由碰撞導致攝像機穿模攝像機添加武器添加位置&#xff1a;插槽創建動畫藍圖&#xff1a;主動獲取角色數據并播放相應動畫設置角色控制…

2025年入局蘋果Vision Pro開發:從零到發布的完整路線圖

蘋果Vision Pro的發布標志著空間計算(Spatial Computing)進入主流市場。作為開發者,如何快速掌握visionOS開發?本文將為你提供詳細的路線圖、實踐建議與資源指南,涵蓋從窗口式應用到沉浸式3D應用的完整開發路徑。 一、visionOS開發的核心目標與階段劃分 visionOS的開發可…

百度文心大模型ERNIE全面解析

百度文心大模型ERNIE概述 百度推出的文心大模型(ERNIE,Enhanced Representation through kNowledge IntEgration)系列是結合知識增強技術的預訓練大模型,涵蓋自然語言處理(NLP)、跨模態、行業應用等多個方向。其開源版本為開發者提供了可商用的大模型能力支持。 ERNIE的…

【SpringAI實戰】提示詞工程實現哄哄模擬器

一、前言 二、實現效果 三、代碼實現 3.1 后端實現 3.2 前端實現 一、前言 Spring AI詳解&#xff1a;【Spring AI詳解】開啟Java生態的智能應用開發新時代(附不同功能的Spring AI實戰項目)-CSDN博客 二、實現效果 游戲規則很簡單&#xff0c;就是說你的女友生氣了&#x…

速通python加密之AES加密

AES加密 AES加密&#xff08;Advanced Encryption Standard&#xff0c;高級加密標準&#xff09;是目前全球公認的最安全、應用最廣泛的對稱加密算法之一&#xff0c;于2001年被美國國家標準與技術研究院&#xff08;NIST&#xff09;確定為替代DES的標準加密算法&#xff0c;…

Java 對象秒變 Map:字段自由伸縮的優雅實現

前言 在開發中,我們常常需要把對象轉成 Map 格式,用于序列化、傳輸、展示,甚至硬塞給某些第三方框架吃進去再吐出來。乍一看很簡單,字段多起來后就像打翻調色盤,維護起來一不小心就翻車。想優雅地搞定這事,必須有一套穩妥、可擴展的方案,才能寫出讓同事膜拜、領導點贊、…

激光雷達-相機標定工具:支持普通相機和魚眼相機的交互式標定

激光雷達-相機標定工具&#xff1a;支持普通相機和魚眼相機的交互式標定 前言 在自動駕駛、機器人導航等領域&#xff0c;激光雷達和相機的標定是一個基礎而重要的問題。準確的標定結果直接影響后續的感知算法性能。本文將介紹一個開源的激光雷達-相機標定工具&#xff0c;支持…

linux shell從入門到精通(二)——變量操作

1.什么是變量變量在許多程序設計語言中都有定義&#xff0c;與變量相伴地有使用范圍地定義。Linux Shell也不例外。變量&#xff0c;本質上就是一個鍵值對。例如&#xff1a;str“hello”就是將字符串值“hello”賦予鍵str。在str地使用范圍內&#xff0c;我們都可以用str來引用…

[Linux入門] 初學者入門:Linux DNS 域名解析服務詳解

目錄 一、域名服務基礎&#xff1a;從 “名字” 到 “地址” 的轉換 1??什么是域名&#xff1f; 2??什么是 DNS&#xff1f; 3??DNS 用 TCP 還是 UDP&#xff1f; 二、DNS 服務器&#xff1a;各司其職的 “導航站” 1??根域名服務器 2??頂級域名服務器 3??權…

iview表單驗證一直提示為空的幾個原因?

1.Form上的rules是否配置正確&#xff1b; 2.Form-item的prop是否配置正確&#xff1b; 3.規則的名稱和input的v-model是否對應&#xff1b; 4.驗證的字段是否響應&#xff0c;新增字段使用this. $set. © 著作權歸作者所有,轉載或內容合作請聯系作者 平臺聲明&#xff1…

SpringBoot3(若依框架)集成Mybatis-Plus和單元測試功能,以及問題解決

一、Mybatis-Plus集成 新增依賴到父級pom.xml&#xff0c;原先的mybatis依賴可以不動需要注意 mybatis-plus與mybatis版本之間的沖突&#xff0c;不要輕易改動依賴&#xff0c;不然分頁也容易出現問題分類頂級pom.xml下面&#xff0c;如果沒有引入還是出現報錯&#xff0c;在co…

刪除遠程分支上非本分支的提交記錄

要刪除遠程分支上非本分支的提交記錄&#xff08;即主分支的提交歷史&#xff09;&#xff0c;需要使用 Git 的重寫歷史功能。以下是完整解決方案&#xff1a; 解決方案步驟&#xff1a; 創建干凈的新分支&#xff08;基于主分支最新提交&#xff09; # 切換到主分支并更新 git…

Flask input 和datalist結合

<input list"categories" name"category" id"category" class"form-control" placeholder"任務分類" required> 這段代碼是一個 HTML 輸入控件&#xff0c;結合了 <input> 和 <datalist>&#xff0c;用來…