Tool/software: Code Composer Studio
When I add "NVS_open(Board_NVS0, &nvsParams)" into main.c , however , there is no BOADR_NVS0 in Board.h, as shown in picture 1. The correct Board.h in nvs project is shown in picture 2 .As a result ,"rebuild simple_peripheral project failed" , as shown in picture 3.
picture 2
picture 3
My steps of adding functions related to NVS into main.c of simple_peripheral project is as followed:
/************************ main.c **********************************/ /****************************************************************** * INCLUDES */ //添加NVS的头文件 #include <ti/drivers/NVS.h> //添加NVS的硬件的头文件,需要用新版的头文件替代旧版的头文件 #include "board.h" ...... /****************************************************************** * GLOBAL VARIABLES */ //定义NVS的句柄,结构体,参数 NVS_Handle nvsHandle; NVS_Attrs regionAttrs; NVS_Params nvsParams; ...... /****************************************************************** * Main */ int main() { ...... //NVS初始化 NVS_init(); //NVS参数初始化 NVS_Params_init(&nvsParams); //NVS打开,得到句柄 nvsHandle = NVS_open(Board_NVS0, &nvsParams); //如果没有得到NVS句柄,也就是NVS打开失败,就停止程序 if (nvsHandle == NULL) { Display_printf(dispHandle, 0, 0, "NVS_open() failed."); return (NULL); } //将NVS句柄与存储区域结构体对应起来,其中包含区域基地址,区域大小,擦除扇区大小三个参数 NVS_getAttrs(nvsHandle, ®ionAttrs); ...... } ......
Attachments:
1、the positon of simple_peripheral project in my computer is as followed:
C:\ti\simplelink_cc2640r2_sdk_1_40_00_45\examples\rtos\CC2640R2_LAUNCHXL\ble5stack\simple_peripheral
2、the positon of nvs project in my computer is as followed:
C:\ti\simplelink_cc2640r2_sdk_1_40_00_45\examples\rtos\CC2640R2_LAUNCHXL\drivers\nvs
3、my complete workspace of simple_peripheral project can be downloaded from here:
4、you can download the simplelink_cc2640r2_sdk_1_40_00_45 from the following website:
dev.ti.com/.../
5、my develop invironment:
CCS:Code Composer Studio 7.2.0
SDK:simplelink_cc2640r2_sdk_1_40_00_45
hardware:CC26640R2 develop kit