基于UltraIot开发板创建工程模块,在以后的开发过程中多可以基于工程模板
Step.1 创建UtraIot硬件相关的HAL目录
进入Z-Stack 3.0.1_UtraIot\Components\hal\target目录复制CC2530EB目录,粘贴到当前目录,并且重命名为UltraIot。
以后UltraIot开发板上相关的硬件驱动都放到该目录下。
Step.2 创建UtraIot应用模板
1、进入Z-Stack 3.0.1_UtraIot2\Projects\zstack\HomeAutomation目录,拷贝GenericApp,粘贴到当前目录并命名UltraIotApp。
2、将UltraIotApp\Source目录下的文件名字改为
OSAL_GenericApp.c -> OSAL_UltraIotApp.c
zcl_genericapp.c -> zcl_ultraiotapp.c
zcl_genericapp.h -> zcl_ultraiotapp.h
zcl_ultraiotapp_data.c ->zcl_ultraiotapp_data.c
3、修改UltraIotApp\CC2530DB目录下的文件名字
GenericApp.ewd -> UltraIotApp.ewd
GenericApp.ewp -> UltraIotApp.ewp
GenericApp.eww -> UltraIotApp.ew
4、使用文本编辑器打开UltraIotApp.ewd、UltraIotApp.ewp,UltraIotApp.ew文件,将文件中所有的GenericApp 全部替换为UltraIotApp,genericapp全部替换为ultraiotapp。
5、修改UltraIotApp\Source目录下的文件内容,将文件中的
#include "zcl_genericapp.h"
改为
#include "zcl_ultraiotapp.h"
6、使用IAR打开工程并添加UtraIot硬件相关目录
将IAR中HAL->Target->CC2530EB改为HAL->Target->UltraIot.
将Config、Drivers、Includes目录下的文件都替换成Hal/Target/UltraIot目录下的文件。
Note:选择文件,然后右击->File Propertions可以查看文件的路径
7、将HAL->Target->UltraIot目录添加到编译环境目录
options->C/C++ Compiler-> Preprocessor -> Additional include directories
删除
$PROJ_DIR$\..\..\..\..\..\Components\hal\target\CC2530EB
添加
$PROJ_DIR$\..\..\..\..\..\Components\hal\target\UltraIot
修改完成后,进行编译,如果没有出现错误,则一个最简单的基于UltraIot开发板工程模板已经完成,后面修改、添加驱动全都基于该工程模板。