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.

LAUNCHXL-CC1312R1: nvs location

Part Number: LAUNCHXL-CC1312R1
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

I have created a NVS region to save module settings. I followed the example that was linked by syscfg, and it compiles OK.

my save command that triggers this first displays the content, so it starts with a

nvs_read() into a buffer.

When I examine the buffer I find some data, but I have not written into that region, so I expected

to see all 0xff. Looking at the map file, I can see the nvs region with adresses *almost* at the end of my code.

Do I need to locate the region OUTSIDE my image, why does the sysconfig not locate the region 

outtside of my code and data? I thougt it reserved "unwritten" space. Please enlighten me...

Gullik

Update: I saw some reference to #define NVS_REGION_BASE 0x48000

I tried to enter this in syscfg

Region type Generated

Region Base 0x48000

Region size 0x2000

I interpret this that I should be able to control the placement in flash.

However, this does not work, and nvs read returns the same data != 0xff........

So, how to do it?

  • Hi Gullik,

    Could you post your NVS SysConfig settings?

    ...

    I especially wonder what kind of region type you used.

    Regards,

    Arthur

  • I click on the .sysconfig file and get a menu

    I click on the NVS driver item

    I get a menu with config_nvs_0

    use hardware            default none

    NVS type            default internal

    NVS implementation (grayed out cann not set ) NVSCC26XX

    Internal flash

    Region type       default Generated

    Region Base     0x48000         // tried default first

    Region size       0x2000

    Sector size 0x2000 (default)

    Code is taken from the examples found by clicking on the ? in NVS menu

  • Hi Gullik,

    What if you used the nvsinternal example instead, do you see any difference in the behavior?

    Regards,

    Arthur

  • But I DO!!

    Config_nvs_0

    use hardware       none

    NVS type             internal

    NVS implementation NVSCC26XX (greyed out)

    Internal flash

    Region type       Generated

    Region Base       0x48000 (since it was 0 initially, changed it when I became unsure)

    Regin size          0x2000 (was default)

    Sector size         0x2000 (default, greyed out cannot change)

    CODE

    #include <ti/drivers/NVS.h>

    // define nvs

    NVS_handle nvsRegion;

    NVS_Params nvsParams;

    main {

    code....

    NVS_Params_init(&nvsParams);

    code....

    if(strcmp(cline,"save")) {

    status = nvsRegion = NVS_open(CONFIG_NVS_0, &nvsParams);

    status = NVS_read(nvsRegion, 0, buf, 64);

    for(i=0;i<64;i++) {

         xprint_char(buf[i]);

         xprint(" ");

    }

    this prints always a series of numbers ....not FF FF FF

  • It seems that when using GNUC the flash are must be manually

    written into the linker script, sysconfig does not do that???

    Puzzled

    Gullik

  • No matter which example I try, the region Base is not what I defined in syscfg.

    When I examine the handle structure I have a member .object and it will not display but says

    "Error cannot load from non-primitive location"

    I can set the regionAttrs.regionBase to 0x48000, but that does not help,

    i still get a string of wierd data, rather than my expected

    this is nortos and gcc

  • Well, it seems the examples description is a little dated, and I cannot

    figure out howto do this correctly.

    It seems the nvs region is defined by

    static const NVSCC26XX_HWattrs[1] 0 {

         {

           .regionBase = (void *) flashBuf0,

           .regionSize = 0x2000,

         },

    };

    this buffer is not defined anywhere else, and does not show up in the link map.

    So, I have to define the flashBuf0 myself, and locate it at the desired address,

    which in my case is what I answered in the .sysconfig

    However, what is the syntax using GCC in the CCS environment?

    the compiler refuses to understand the attributes I give, specificaly the at attribute.

    char flashBuf0[0x2000] __attribute__ ((at(0x48000)));

    Gullik

  • The solution to this problem was

    1. add the section to the LD file. This was not described in examples, but found eventually by searching the web.

    2. Interactions with the debugger that sometimes hung the launchpad

    3. Write does not seem to take effect until after NVS_close()

    Gullik