新聞中心

EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 9G-STM32 MDK-ARM開(kāi)發(fā)過(guò)程簡(jiǎn)介

9G-STM32 MDK-ARM開(kāi)發(fā)過(guò)程簡(jiǎn)介

作者: 時(shí)間:2016-11-29 來(lái)源:網(wǎng)絡(luò) 收藏
9G-STM32 MDK-ARM開(kāi)發(fā)過(guò)程簡(jiǎn)介

一,準(zhǔn)備MDK-ARM+JLINK+STM32軟件包

本文引用地址:http://m.butianyuan.cn/article/201611/323208.htm

1,在http://www.mcu123.com/news/Soft/embsof/arm/200908/505.html
下載RealView MDK-ARM 3.80a(MDK-ARM V3.80a,MDK3.80a)版本
mdk380a_mcu123.rar
http://esoft.mcu123.com/MCU123_temp_0080309@/arm/mdk380a_mcu123.rar
(注冊(cè)機(jī)自行查找,安裝過(guò)程略)
2,在http://www.segger.com/cms/jlink-software.html
下載Software and documentation pack V4.08l軟件
Setup_JLinkARM_V408l.zip
http://www.segger.com/cms/admin/uploads/userfiles/file/J-Link/Setup_JLinkARM_V408l.zip
(JLINK自行購(gòu)買,安裝過(guò)程略)
3,在http://www.st.com/mcu/familiesdocs-110.html
下載ARM-based 32-bit MCU STM32F10xxx standard peripheral library
stm32f10x_stdperiph_lib.zip
http://www.st.com/stonline/products/support/micro/files/stm32f10x_stdperiph_lib.zip

二,建立STM32工程

1,解壓stm32f10x_stdperiph_lib.zip軟件包,把其中的“Libraries”和“Project”文件夾復(fù)制到“D:worksEK-STM3210E-MDK”,
在“D:worksEK-STM3210E-MDK”下建立“Drivers”、“Include”和“Source”空文件夾,在“D:workslccd-1.0.0Project”
下建立“Stm32f103”空文件夾,把“ProjectTemplate”下的C文件復(fù)制到“Source”和H文件復(fù)制到“Include”;
2,在Keil uVision3菜單中“Project”->“New uVision Project”打開(kāi)“Create New Project”窗口,選擇項(xiàng)目工程存儲(chǔ)路徑
“D:worksEK-STM3210E-MDKProjectStm32f103”填寫(xiě)項(xiàng)目文件名“stm32.uv2",選擇“保存”后自動(dòng)打開(kāi)“Select Device for
Target "Target 1"”窗口,在左面“CPU”頁(yè)面下的“Data base”點(diǎn)開(kāi)“STMicroelectronics”前面的“+”選擇上“STM32F103ZD”
點(diǎn)擊“OK”再確定“是”;
3,在Keil uVision3菜單中“Project”->“New Project Workspace”打開(kāi)“Create New Multi Project Workspace”窗口,選擇項(xiàng)目
工作區(qū)存儲(chǔ)路徑“D:worksEK-STM3210E-MDKProjectStm32f103”填寫(xiě)工作區(qū)文件名“stm32.mpw",點(diǎn)擊“保存”打開(kāi)
“Create New Multi-Project Workspace”窗口,點(diǎn)擊插入項(xiàng)目,然后選擇到剛才建立的“stm32.uv2"再點(diǎn)“OK”“確定”
即可建立一個(gè)新的 Workspace;
4,在Keil uVision3菜單中“Project”->“Manage”選擇“Project "stm32" Components”打開(kāi)“Components Environment and Books”窗口,
把“Target 1”改為“EK-STM3210E”把“Source Group 1”以為“BOOT”點(diǎn)擊“OK”;并在“Groups”下建立“SRC”,“DRV”,“SRC”,
“INC”,“SDRV”等 目錄;
5,在Keil uVision3的左面“Workspace”窗口下面的“BOOT”上右擊鼠標(biāo),選擇“Add Files to Group "BOOT"”選擇上文件
“D:worksEK-STM3210E-MDKLibrariesCMSISCoreCM3”文件夾下的“core_cm3.c”和“system_stm32f10x.c”文件,和
D:worksEK-STM3210E-MDKLibrariesCMSISCoreCM3startuparm文件夾下的“startup_stm32f10x_hd.s”后點(diǎn)擊“CLOSE”退出;
6,在Keil uVision3的左面“Workspace”窗口下面的“SDRV”上右擊鼠標(biāo),選擇“Add Files to Group "SDRV"”選擇上文件
“D:worksEK-STM3210E-MDKLibrariesSTM32F10x_StdPeriph_Driversrc”文件夾下的所有C文件后點(diǎn)擊“CLOSE”退出;
7,在Keil uVision3的左面“Workspace”窗口下面的“SRC”上右擊鼠標(biāo),選擇“Add Files to Group "SRC"”選擇上文件
“D:worksEK-STM3210E-MDKSource”文件夾下的“main.c”和“stm32f10x_it.c”文件后點(diǎn)擊“CLOSE”退出;
8,在Keil uVision3的左面“Workspace”窗口下面的“DRV”上右擊鼠標(biāo),選擇“Add Files to Group "DRV"”選擇上文件
“D:worksEK-STM3210E-MDKSource”文件夾下的“serial.c”文件后點(diǎn)擊“CLOSE”退出;

三,配置STM32工程

在Keil uVision3的左面“Workspace”窗口下面的“EK-STM3210E”右擊鼠標(biāo),選擇“Options for Target "EK-STM3210E"”窗口;

1,在頁(yè)面“Device”中選擇上“STMicroelectronics”下面的STM32F103ZD”,
在頁(yè)面“TarGet”中選擇上“USE microLIB”;
2,在頁(yè)面“Output”中選擇上“Select Folder for Objects...”,在文件夾選擇框中指定到路徑:
D:worksEK-STM3210E-MDKProjectStm32f103obj 后點(diǎn)擊“OK”;并勾選上Create HEX File,
產(chǎn)生“Debug information”瀏覽“Browse information”;
3,在頁(yè)面“Listing”中選擇上“Select Folder for Listing...”,在文件夾選擇框中指定到路徑:
D:worksEK-STM3210E-MDKProjectStm32f103lst 后點(diǎn)擊“OK”;并勾選上C Compiler Listing
和 C Preprocessor Listing (看看自己是否需要);

4,在頁(yè)面“C/C++”中的“Include Paths ”,中添加:
....LibrariesSTM32F10x_StdPeriph_Driverinc
....LibrariesCMSISCoreCM3
....Include
在頁(yè)面“C/C++”中的“Preprocessor Symbols”,中添加:
USE_STDPERIPH_DRIVER, USE_FULL_ASSERT, STM32F10X_HD,USE_STM3210C_EVAL
5,在頁(yè)面“ASM”中的“Include Paths ”,中添加:
....LibrariesSTM32F10x_StdPeriph_Driverinc
....LibrariesCMSISCoreCM3
....Include
在頁(yè)面“ASM”中的“Preprocessor Symbols”,中添加:
USE_STDPERIPH_DRIVER, USE_FULL_ASSERT, STM32F10X_HD,USE_STM3210C_EVAL6,在頁(yè)面“Debug”中選擇右邊的硬件仿真功能的“Cortex-M3 J-LINK”,并點(diǎn)開(kāi)右面的“Settings”配置頁(yè)面,選擇SW接口并把速度改成2M;
在“Flash Download”的編程算法選擇上“STM32F10x High-density Flash”;

7,在頁(yè)面“Utlites”中硬件FLASH編程工具“Cortex-M3 J-LINK”,并點(diǎn)開(kāi)右面的“Settings”配置頁(yè)面,選擇SW接口并把速度改成2M;
在“Flash Download”的編程算法選擇上“STM32F10x High-density Flash”;

四,修改STM32工程
(待續(xù))


上一頁(yè) 1 2 下一頁(yè)

關(guān)鍵詞: STM32MDKARM開(kāi)

評(píng)論


技術(shù)專區(qū)

關(guān)閉