9G-MINI51 新唐CM0+EWARM入门开发过程简介
rtupiarstartup_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”选择驱动到
“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$configflashloaderNuvotonMini51_APROM.board”,把
“C:Program FilesNuvoton ToolsNu-Link_IARSamplesM052config”下的“M052_Flash.icf”复制到“D:works9G-CM09G-MINI51prjconfig”,
把“C:Program FilesNuvoton ToolsNu-Link_IARSamplesM052”下的“SH_retarget.c”和“SH_startup_M05x_iar.s”复制到“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”中填入下面内容:
#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”相冲突时,把有问题的ui
新唐CM0EWARM入门开 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)