Data Structures | Typedefs | Variables
NVSMSP432E4.h File Reference

Detailed Description

NVS driver implementation for MSP432E4 devices.

============================================================================

This NVS driver implementation is designed to work with FLASH memory on MSP432E4 devices. FLASH memory sectors on these devices are 16 kilobytes in size.

The NVS header file should be included in an application as follows:


#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for NVSMSP432E4.h:

Go to the source code of this file.

Data Structures

struct  NVSMSP432E4_HWAttrs
 NVSMSP432E4 attributes. More...
 
struct  NVSMSP432E4_Object
 

Typedefs

typedef struct NVSMSP432E4_HWAttrs NVSMSP432E4_HWAttrs
 NVSMSP432E4 attributes. More...
 
typedef struct NVSMSP432E4_Object NVSMSP432E4_Object
 

Variables

const NVS_FxnTable NVSMSP432E4_fxnTable
 

Typedef Documentation

§ NVSMSP432E4_HWAttrs

NVSMSP432E4 attributes.

The 'regionBase' field must point to the base address of the region to be managed.

The regionSize must be an integer multiple of the flash sector size. For most MSP432E4 devices, the flash sector size is 16 kilobytes.

Care must be taken to ensure that the linker does not unintentionally place application content (e.g., code/data) in the flash regions.

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

The example below defines a char array 'flashBuf' and uses CCS and IAR compiler pragmas to place 'flashBuf' at a specific address within the flash memory.

For GCC, the 'flashBuf' array is placed into a named linker section. Corresponding linker commands are added to the application's linker command file to place the section at a specific flash memory address. 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.

The 'regionBase' fields of the two HWAttrs region instances are initialized to point to the base address of 'flashBuf' and to some offset from the base of the char array.

The linker command syntax is carefully chosen to only RESERVE space for the char array and not to actually initialize it during application load.

#define SECTORSIZE 0x4000
#define FLASH_REGION_BASE 0xF8000
//
// 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[SECTORSIZE * 2];
#elif defined(__IAR_SYSTEMS_ICC__)
//
// Place uninitialized array at FLASH_REGION_BASE
//
__no_init char flashBuf[SECTORSIZE * 2] @ 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[SECTORSIZE * 2];
#endif
NVSMSP432E4_HWAttrs NVSMSP432E4HWAttrs[2] = {
//
// region 0 is 1 flash sector in length.
//
{
.regionBase = (void *)flashBuf,
.regionSize = SECTORSIZE,
},
//
// region 1 is 1 flash sectors in length.
//
{
.regionBase = (void *)(flashBuf + SECTORSIZE),
.regionSize = SECTORSIZE,
}
};
Example GCC linker command file content reserves flash space
but does not initialize it:
MEMORY
{
FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x00100000
SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00040000
}
.nvs (0xF8000) (NOLOAD) : AT (0xF8000) {
KEEP (*(.nvs))
} > NVS

§ NVSMSP432E4_Object

Variable Documentation

§ NVSMSP432E4_fxnTable

const NVS_FxnTable NVSMSP432E4_fxnTable
© Copyright 1995-2018, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale