Data Fields
NVSCC26XX_HWAttrs Struct Reference

NVSCC26XX hardware attributes. More...

#include <NVSCC26XX.h>

Data Fields

void * regionBase
 
size_t regionSize
 

Detailed Description

NVSCC26XX hardware attributes.

The NVSCC26XX hardware attributes define hardware specific settings for a NVS driver instance.

Note
Care must be taken to ensure that the linker does not place application content (such as .text or .const) in the flash regions defined by the this hardware attributes structure.

For CCS and IAR tools, defining and reserving flash memory regions can be done entirely within the ti_drivers_config.c file. For GCC, additional content is required in the application's linker script to achieve the same result.

The example below defines a char array flashBuf. Preprocessor logic is used so that this example will work with either the TI, IAR or GCC tools. For the TI and IAR tools, pragmas are used to place flashBuf at the flash location specified by NVSCC26XX_HWAttrs.regionBase.

For the GCC tool, the flashBuf array is placed into a named linker output section, .nvs. This section is defined in the application's linker script. The section placement command is carefully chosen to only RESERVE space for the flashBuf array, and not to actually initialize it during the application load process, thus preserving the content of flash.

Regardless of tool chain, the flashBuf array in the example below is placed at the NVS_REGIONS_BASE address and has an overall size of REGIONSIZE bytes. Theoretically, the memory reserved by flashBuf can be divided into four separate regions, each having a size of SECTORSIZE bytes. Each region must always be aligned to the flash sector size, SECTORSIZE. This example below shows two regions defined.

An array of two NVSCC26XX_HWAttrs structures is defined. Each index of this structure defines a region of on-chip flash memory. Both regions utilize memory reserved by the flashBuf array. The two regions do not overlap or share the same physical memory locations. The two regions do however exist adjacent to each other in physical memory. The first region is defined as starting at the NVS_REGIONS_BASE address and has a size equal to the flash sector size, as defined by SECTORSIZE. The second region is defined as starting at (NVS_REGIONS_BASE + SECTORSIZE), that is, the NVS_REGIONS_BASE address offset by SECTORSIZE bytes. The second region has a size equal to (3 * SECTORSIZE) bytes. These regions together fully occupy REGIONSIZE bytes of physical on-chip flash memory as reserved by the flashBuf array.

#define NVS_REGIONS_BASE 0x1B000
#define SECTORSIZE 0x1000
#define REGIONSIZE (SECTORSIZE * 4)
//
// Reserve flash sectors for NVS driver use
// by placing an uninitialized byte array
// at the desired flash address.
//
#if defined(__TI_COMPILER_VERSION__)
//
// Place uninitialized array at FLASH_REGION_BASE
//
#pragma LOCATION(flashBuf, FLASH_REGION_BASE);
#pragma NOINIT(flashBuf);
char flashBuf[REGIONSIZE];
#elif defined(__IAR_SYSTEMS_ICC__)
//
// Place uninitialized array at FLASH_REGION_BASE
//
__no_init char flashBuf[REGIONSIZE] @ FLASH_REGION_BASE;
#elif defined(__GNUC__)
//
// Place the flash buffers in the .nvs section created in the gcc linker file.
// The .nvs section enforces alignment on a sector boundary but may
// be placed anywhere in flash memory. If desired the .nvs section can be set
// to a fixed address by changing the following in the gcc linker file:
//
// .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) {
// *(.nvs)
// } > REGION_TEXT
//
__attribute__ ((section (".nvs")))
char flashBuf[REGIONSIZE];
#endif
NVSCC26XX_HWAttrs nvsCC26XXHWAttrs[2] = {
//
// region 0 is 1 flash sector in length.
//
{
.regionBase = (void *)flashBuf,
.regionSize = SECTORSIZE,
},
//
// region 1 is 3 flash sectors in length.
//
{
.regionBase = (void *)(flashBuf + SECTORSIZE),
.regionSize = SECTORSIZE * 3,
}
};

Example GCC linker script file content. This example places an output section, .nvs, at the memory address 0x1B000. The NOLOAD directive is used so that this memory is not initialized during program load to the target.

MEMORY
{
FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x0001ffa8
FLASH_CCFG (RX) : ORIGIN = 0x0001ffa8, LENGTH = 0x00000058
SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00005000
}
.nvs (0x1b000) (NOLOAD) : AT (0x1b000) {
*(.nvs)
} > REGION_TEXT

If the write "scoreboard" is enabled, three new fields are added to the NVSCC26XX_HWAttrs structure:

Field Documentation

§ regionBase

void* NVSCC26XX_HWAttrs::regionBase

The regionBase field specifies the base address of the on-chip flash memory to be managed. The regionBase must be aligned to the flash sector size. This memory cannot be shared and must be for exclusive use by one NVS driver instance.

§ regionSize

size_t NVSCC26XX_HWAttrs::regionSize

The regionSize field specifies the overall size of the on-chip flash memory to be managed. The regionSize must be at least 1 flash sector size AND an integer multiple of the flash sector size. For most CC26XX/CC13XX devices, the flash sector size is 4096 bytes. The NVSCC26XX driver will determine the device's actual sector size by reading internal system configuration registers.


The documentation for this struct was generated from the following file:
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale