This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

no definition for "osal_nv_item_init" [referenced from ... SampleSwitch\CC2630\SmartRF06\Obj\switch.o]

Other Parts Discussed in Thread: CC2630

I have the SampleSwitch application for CC2630 using IAR and try to create custom NV objects. I added to switch.c:

#include "OSAL_Nv.h"

//...

#define MY_NV_COMPERIOD 0x0500 typedef uint32_t MyComPeriod_t; MyComPeriod_t comPeriod = (uint32_t)MY_COM_PERIOD_FALLBACK; static void Switch_initializeNV(void) { uint8_t res = 0; res = osal_nv_item_init( MY_NV_COMPERIOD, sizeof(MyComPeriod_t), (void*)&comPeriod ); if (SUCCESS == res) { // item already exists, don't change it } else if (NV_ITEM_UNINIT) { // item did not exist, was created and initialized with default value } else { // TODO: indicate error! } }

When I compile, I receive the following error message in IAR:

Error[Li005]: no definition for "osal_nv_item_init" [referenced from C:\projects\Projects\zstack\HomeAutomation\SampleSwitch\CC2630\SmartRF06\Obj\switch.o] 

I can see that osal_nv_item_init() etc. is used happily in the project "ZStackCore - EndDevice", which is the base image for the "SampleSwich" workspace. How can I use the methods from the application image project "SampleSwitch -SmartRF06"?

  • Found a solution. in zcl_port.c provides an API for some functions in the base image. Use eg.

    zclport_initializeNVItem()

    If you need deeper control, have a look at the

    pfnZclPortNV

    where a few methods are directly mapped from the base image:

    //! Structure of NV API function pointers
    typedef struct nvintf_nvfuncts_t
    {
        //! Initialization function
        NVINTF_initNV initNV;
        //! Compact NV function
        NVINTF_compactNV compactNV;
        //! Create item function
        NVINTF_createItem createItem;
        //! Delete NV item function
        NVINTF_deleteItem deleteItem;
        //! Read item function
        NVINTF_readItem readItem;
        //! Write item function
        NVINTF_writeItem writeItem;
        //! Write existing item function
        NVINTF_writeItemEx writeItemEx;
        //! Get item length function
        NVINTF_getItemLen getItemLen;
    } NVINTF_nvFuncts_t;