新聞中心

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

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

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

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

本文引用地址:http://m.butianyuan.cn/article/201611/323198.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=1&extra=page%3D1上
下載Nu-Link驅(qū)動(dòng)“公測(cè)版驅(qū)動(dòng)下載 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

下載NUC100系列基礎(chǔ)程序庫“NUC100Series BSP_CMSIS V1.05.001.7z”
NUC100SeriesBSP_v1.05.001.7z
http://www.nuvoton-m0.com/forum.php?mod=attachment&aid=NTR8YWY2YWI1Njd8MTMxNTMwMDA0OHww

3,在“http://dzstic.com/down.asp”上下載“NuTiny-SDK-NUC140.rar”文檔
NuTiny-SDK-NUC140.rar
http://dzstic.com/upload/20110906/20110906162939454.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”,運(yùn)行里面的“EWARM_FULL_ARM540.exe”,選擇“Product”中的“Embedded Workbench For ARM v5.40”,然后點(diǎn)擊“Generate”
把產(chǎn)生的“License key”“License number”密碼和序列號(hào)記錄下來;

2,雙擊“CD-EWARM-6201-2590_mcu123.zip”運(yùn)行里面的“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”運(yùn)行里面的“Nu-Link_IAR_Driver 1.17.5218.exe”,便會(huì)在“C:Program FilesNuvoton ToolsNu-Link_IAR”和“C:Program Files
IAR SystemsEmbedded Workbench 6.0” 目錄中安裝上相關(guān)的“Nu-LINK”的驅(qū)動(dòng)。

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

三,建立CM0的EWARM基本工程

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

2,在“D:works9G-CM0uc140”下建立文件夾“bsp”“drv”“inc”“src”,等子目錄,在“D:works9G-CM09G-NUC140prj”下建立子目錄“config”,并把 “NUC100SeriesBSP_v1.05.001.7z”
的“NUC100SeriesBSPNuvotonPlatform_IARSrcDriver”和“NUC100SeriesBSPNuvotonPlatform_IARIncludeDriver”解壓到“D:works9G-CM09G-NUC140spDriver”目錄,把“NUC100SeriesBSP
NuvotonPlatform_IARIncludeSystem”解壓到“D:works9G-CM09G-NUC140spSystem”目錄,把“NUC100SeriesBSPCMSISCM0DeviceSupportNuvotonNUC1xxstartupiarstartup_NUC1xx.s”解壓到
“D:works9G-CM09G-NUC140spBoot”,把“NUC100SeriesBSPCMSISCM0DeviceSupportNuvotonNUC1xx”下的H和C文件及“NUC100SeriesBSPCMSISCM0CoreSupport”下的H和C文件解壓到
“D:works9G-CM09G-NUC140spCmsis”;

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

4,在“Options for node nuc140”的“Category:”中選擇上“Debugger”,在“Setup”->“Driver”中選擇“Third-Party Driver”,然后在“Third-Party Driver”選擇驅(qū)動(dòng)到
“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$configflashloaderNuvotonNUC100_APROM.board”,把
“C:Program FilesNuvoton ToolsNu-Link_IARSamplesNUC140_PWMconfig”下的“NUC140_Flash.icf”和“NUC140_Ram.icf”復(fù)制到“D:works9G-CM09G-NUC140prjconfig”,
把“C:Program FilesNuvoton ToolsNu-Link_IARSamplesNUC140_PWM”下的“SH_retarget.c”和“SH_startup_NUCxxx_iar.s”復(fù)制到“D:works9G-CM09G-NUC140spBoot”;

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

7,在“D:works9G-CM09G-NUC140src”中建立“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-NUC120 V1.00 Build byyuanxihua@21cn.comon ("__DATE__ " - " __TIME__ ")");
printf("*** 9G-NUC120 V1.00 Rebooting ...");

while(1)
{
GPA_DOUT =0xffff;
for(uint32_t j = 0; j <1000000; j++);
GPA_DOUT =0x0000;
for(uint32_t j = 0; j <1000000; j++);

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

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

8,在“Debugger”的“Download”勾選擇“Use flash loader”和“override default .board file”并填入“$TOOLKIT_DIR$configflashloaderNuvotonNUC100_LDROM.board”,可以把
相應(yīng)的程序燒進(jìn)LDROM區(qū);

9,在“EWARM”的IDE菜單中選擇“Nu-Link”->“ICP Programming Tool”中,可以不擦除整片F(xiàn)LASH直接改變配置位從APPROM區(qū)切換到LDROM區(qū)啟動(dòng),F(xiàn)LASH的1能修改成0;



關(guān)鍵詞: 9G-NUC140新唐CM0EWARM入

評(píng)論


相關(guān)推薦

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

關(guān)閉