新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 9G-MINI51 新唐CM0+EWARM入門開發(fā)過程簡介

9G-MINI51 新唐CM0+EWARM入門開發(fā)過程簡介

作者: 時間:2016-11-29 來源:網(wǎng)絡(luò) 收藏
9G-MINI51 新唐CM0+EWARM入門開發(fā)過程簡介

一,準(zhǔn)備EWARM + 新唐CM0軟件包

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

1,在http://www.mcu123.com/news/Soft/ShowSoftDown.asp?UrlID=1&SoftID=535上
下載 IAR Embedded Workbench for ARM v6.20 FULL CD-EWARM-6201-2590 軟件
CD-EWARM-6201-2590_mcu123.zip
ftp://mcu123:mcu123@mcu123.com/已整理目錄/開發(fā)工具軟件/ARM/CD-EWARM-6201-2590_mcu123.zip
相關(guān)文件“IAR_EWARM5.4和諧文件.rar ”可以在GOOGLE上搜索到
http://bbs.mcu123.net/bbs/thread-15164-1-1.html
并下載:
IAR_EWARM5[1].4和諧文件.rar

2,在http://www.nuvoton-m0.com/forum.php?mod=viewthread&tid=2&extra=page%3D1上
下載Nu-Link驅(qū)動“公測版驅(qū)動下載 v1.17.5218,支持最新的IAR 6.21”
Nu-Link_IAR_Driver 1.17.5218.zip
http://www.nuvoton-m0.com/forum.php?mod=attachment&aid=MTg3fDI4NGFkNTk1fDEzMTUyOTkyOTF8MA%3D%3D

下載ICP編程工具“NuMicro ICP Programming Tool 1.17.5218”
NuMicro ICP Programming Tool 1.17.5218.zip
http://www.nuvoton-m0.com/forum.php?mod=attachment&aid=MTg2fDI3YTFmZmJlfDEzMTUyOTkyOTF8MA%3D%3D

下載ISP編程工具“NuMicro ISP Programming Tool v1.41”
NuMicro ISP Programming Tool V1.41.zip
http://www.nuvoton-m0.com/forum.php?mod=attachment&aid=NDh8OTBkZjBjYTJ8MTMxNTI5OTI5MXww

下載?M051軟件庫資源“M051SeriesBSP_CMSIS V1.02.001”和“M051SeriesBSP_RegCtrlPrg V1.00.002”
M051SeriesBSP_v1.02.001.zip
http://www.nuvoton-m0.com/forum.php?mod=attachment&aid=NDV8ZTc3MTg5M2V8MTMxNTM3NjExOHww
M051SeriesBSP_RegCtrlPrg.zip
http://www.nuvoton-m0.com/forum.php?mod=attachment&aid=NDZ8OTVlMjM1OGN8MTMxNTM3NjExOHww

3,在“http://dzstic.com/down.asp”上下載“NuTiny-EVB-Mini51_V002”文檔
NuTiny-EVB-Mini51_V002.rar
http://dzstic.com/upload/20110907/20110907141832652.rar

4,新唐官方資料網(wǎng)址
新唐CM0官方資料主頁
http://www.nuvoton.com/hq/chs/Pages/default.aspx

二,建立CM0的EWARM+Nu-LINK開發(fā)環(huán)境

1,雙擊“IAR_EWARM5[1].4和諧文件.rar”,運行里面的“EWARM_FULL_ARM540.exe”,選擇“Product”中的“Embedded Workbench For ARM v5.40”,然后點擊“Generate”
把產(chǎn)生的“License key”“License number”密碼和序列號記錄下來;

2,雙擊“CD-EWARM-6201-2590_mcu123.zip”運行里面的“autorun.exe”,在“IAR Embedded Workbench For ARM”中選擇“Install IAR Embedded Workbench”,按常規(guī)的軟件安裝方式
把“IAR Embedded Workbench For ARM”安裝到電腦上;

3,雙擊“Nu-Link_IAR_Driver 1.17.5218.zip”運行里面的“Nu-Link_IAR_Driver 1.17.5218.exe”,便會在“C:Program FilesNuvoton ToolsNu-Link_IAR”和“C:Program Files
IAR SystemsEmbedded Workbench 6.0” 目錄中安裝上相關(guān)的“Nu-LINK”的驅(qū)動。

4,雙擊“NuMicro ICP Programming Tool 1.17.5218.zip”運行里面的“NuMicro ICP Programming Tool 1.17.5218.exe”,便會在“C:Program FilesNuvoton ToolsICPTool”
目錄中安裝上相關(guān)的“ ICP Programming Tool”的工具。

三,建立CM0的EWARM基本工程

1,在電腦開始菜單中打開“IAR Embedded Workbench IDE”,在“EWARM”的IDE菜單中選擇“Project”->“Create New Project”創(chuàng)建一個新工程,在“Create New Project”選擇“OK”存儲目錄
到“D:works9G-CM09G-MINI51prj”下面,工程名叫“MINI51.ewp,點擊“OK”完成,點擊“File”下的“Save Workspace”保存工作空間到目錄中的“MINI51.eww”;

2,在“D:works9G-CM09G-MINI51”下建立文件夾“bsp”“drv”“inc”“src”,等子目錄,在“D:works9G-CM09G-MINI51prj”下建立子目錄“config”,并把 “M051SeriesBSP_v1.02.001.zip”
的“M051SeriesBSPNuvotonPlatform_IARSrcDriver”和“M051SeriesBSPNuvotonPlatform_IARIncludeDriver”解壓到“D:works9G-CM09G-MINI51spDriver”目錄,把“M051SeriesBSP
NuvotonPlatform_IARIncludeSystem”解壓到“D:works9G-CM09G-MINI51spSystem”目錄,把“M051SeriesBSPCMSISCM0DeviceSupportNuvotonM051Seriesstartupiarstartup_M051Series.s”解壓到
“D:works9G-CM09G-MINI51spBoot”,把“M051SeriesBSPCMSISCM0DeviceSupportNuvotonM051Series”下的H和C文件及“M051SeriesBSPCMSISCM0CoreSupport”下的H和C文件解壓到
“D:works9G-CM09G-MINI51spCmsis”;

3,在“EWARM”的IDE菜單中選擇“Project”->“Options”中的“General Options”的“Target”中的“Device”中選擇“Nuvoton Mini51 series (Mini51,Mini52,Mini54)”,在“Linker”菜單中選擇“Linker configuration file”里選擇
“override default”并填上“$PROJ_DIR$configM052_Flash.icf”,在“Library Configuration”下的庫選項用“FULL”在“Library Opitions”下的“printf”和“scanf”格式也用“FULL”;

4,在“Options for node MINI51”的“Category:”中選擇上“Debugger”,在“Setup”->“Driver”中選擇“Third-Party Driver”,然后在“Third-Party Driver”選擇驅(qū)動到
“C:Program FilesNuvoton ToolsNu-Link_IARNu-Link_IAR.dll”,在“C/C++ Compiler”下的“Preprocessor”下面的方框內(nèi)填上:
$PROJ_DIR$..inc
$PROJ_DIR$..sp
$PROJ_DIR$..spCmsis
$PROJ_DIR$..spDriver

5,在“Debugger”的“Download”勾選擇“Use flash loader”和“override default .board file”并填入“$TOOLKIT_DIR$configflashloaderNuvotonMini51_APROM.board”,把
“C:Program FilesNuvoton ToolsNu-Link_IARSamplesM052config”下的“M052_Flash.icf”復(fù)制到“D:works9G-CM09G-MINI51prjconfig”,
把“C:Program FilesNuvoton ToolsNu-Link_IARSamplesM052”下的“SH_retarget.c”和“SH_startup_M05x_iar.s”復(fù)制到“D:works9G-CM09G-MINI51spBoot”;

6,在“IAR Embedded Workbench IDE”的“Workspace”下的“Files”中右擊選擇“Add”->“Add Group”并填入“sys”,另外同樣建立“bsp”,“drv”,“src”等目錄,然后在“sys”上右擊
選擇“Add”->“Add Files” 然后選擇“D:works9G-CM09G-MINI51spBoot”下的“SH_retarget.c”,“SH_startup_NUCxxx_iar.s”和“D:works9G-CM09G-MINI51spCmsis”下的
“core_cm0.c”和“system_M051Series.c”;同樣用“Add”->“Add Files”把“D:works9G-CM09G-MINI51spDriver”的文件添加到“bsp”目錄;(retarget.c除外)

7,在“D:works9G-CM09G-MINI51src”中建立“main.c”,然后添加到工程的“src”中,并在“main.c”中填入下面內(nèi)容:
#include
#include
#include

int main(void)
{
uint32_t i=0;

/* Output a message on Hyperterminal using printf function */
printf("");
printf("*** 9G-MINI51 V1.00 Build byyuanxihua@21cn.comon ("__DATE__ " - " __TIME__ ")");
printf("*** 9G-MINI51 V1.00 Rebooting ...");

GPIO_P0_PMD = 0X5555;
GPIO_P1_PMD = 0X5555;
GPIO_P2_PMD = 0X5555;
GPIO_P3_PMD = 0X5555;
GPIO_P4_PMD = 0X5555;
GPIO_P5_PMD = 0X5555;

while(1)
{
for(uint32_t j = 0; j <800000; j++);
GPIO_P0_DOUT = 0x5E;/* switch on LEDs */
GPIO_P1_DOUT = 0xCA;
GPIO_P2_DOUT = 0xAB;
GPIO_P3_DOUT = 0x9A;
GPIO_P4_DOUT = 0x55;//NO USE
GPIO_P5_DOUT = 0XE2;
for(uint32_t j = 0; j <800000; j++);
GPIO_P0_DOUT = 0xAD;/* switch off LEDs */
GPIO_P1_DOUT = 0xF7;
GPIO_P2_DOUT = 0xD7;
GPIO_P3_DOUT = 0xED;
GPIO_P4_DOUT = 0xAA;//NO USE
GPIO_P5_DOUT = 0XDD;

printf("*** 9G-MINI51 V1.00 Running %d Times...",i++);
}
}

(編譯時會有與core_cm0.h與“C:Program FilesIAR SystemsEmbedded Workbench 6.0arminccintrinsics.h”相沖突時,把有問題的uint32_t改回相應(yīng)的 unsigned long即可。)



關(guān)鍵詞: 新唐CM0EWARM入門開

評論


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

關(guān)閉