一,准备EWARM + 新唐CM0软件包
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/已整理目录/开发工具软件/ARM/CD-EWARM-6201-2590_mcu123.zip
相关文件“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驱动“公测版驱动下载 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系列基础程序库“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,新唐官方资料网址
新唐CM0官方资料主页
http://www.nuvoton.com/hq/chs/Pages/default.aspx
二,建立CM0的EWARM+Nu-LINK开发环境
1,双击“IAR_EWARM5[1].4和谐文件.rar”,运行里面的“EWARM_FULL_ARM540.exe”,选择“Product”中的“Embedded Workbench For ARM v5.40”,然后点击“Generate”
把产生的“License key”“License number”密码和序列号记录下来;
2,双击“CD-EWARM-6201-2590_mcu123.zip”运行里面的“autorun.exe”,在“IAR Embedded Workbench For ARM”中选择“Install IAR Embedded Workbench”,按常规的软件安装方式
把“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” 目录中安装上相关的“Nu-LINK”的驱动。
4,双击“NuMicro ICP Programming Tool 1.17.5218.zip”运行里面的“NuMicro ICP Programming Tool 1.17.5218.exe”,便会在“C:Program FilesNuvoton ToolsICPTool”
目录中安装上相关的“ ICP Programming Tool”的工具。
三,建立CM0的EWARM基本工程
1,在电脑开始菜单中打开“IAR Embedded Workbench IDE”,在“EWARM”的IDE菜单中选择“Project”->“Create New Project”创建一个新工程,在“Create New Project”选择“OK”存储目录
到“D:works9G-CM09G-NUC140prj”下面,工程名叫“nuc140.ewp”,点击“OK”完成,点击“File”下的“Save Workspace”保存工作空间到目录中的“nuc140.eww”;
2,在“D:works9G-CM0
uc140”下建立文件夹“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”下的库选项用“FULL”在“Library Opitions”下的“printf”和“scanf”格式也用“FULL”;
4,在“Options for node 'nuc140'”的“Category:”中选择上“Debugger”,在“Setup”->“Driver”中选择“Third-Party Driver”,然后在“Third-Party Driver”选择驱动到
“C:Program FilesNuvoton ToolsNu-Link_IARNu-Link_IAR.dll”,在“C/C++ Compiler”下的“Preprocessor”下面的方框内填上:
$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”复制到“D:works9G-CM09G-NUC140prjconfig”,
把“C:Program FilesNuvoton ToolsNu-Link_IARSamplesNUC140_PWM”下的“SH_retarget.c”和“SH_startup_NUCxxx_iar.s”复制到“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”中填入下面内容:
#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 by yuanxihua@21cn.com on ("__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++);
}
}
(编译时会有与core_cm0.h与“C:Program FilesIAR SystemsEmbedded Workbench 6.0arminccintrinsics.h”相冲突时,
把有问题的uint32_t改回相应的 unsigned long即可;)
8,在“Debugger”的“Download”勾选择“Use flash loader”和“override default .board file”并填入“$TOOLKIT_DIR$configflashloaderNuvotonNUC100_LDROM.board”,可以把
相应的程序烧进LDROM区;
9,在“EWARM”的IDE菜单中选择“Nu-Link”->“ICP Programming Tool”中,可以不擦除整片FLASH直接改变配置位从APPROM区切换到LDROM区启动,FLASH的1能修改成0;
上一篇:基于IAR EWARM开发新唐M0的CONFIG修改及NU-LINK驱动
下一篇:9G-MINI51 新唐CM0+EWARM入门开发过程简介