Kinetis Bootloader Host  2.0.0
Host Tools for Kinetis devices
blfwk::MemoryStore Class Reference

Represents target device memory as a disk file. More...

#include <SimulatorMemory.h>

+ Inheritance diagram for blfwk::MemoryStore:

Public Types

enum  {
  kMapIndexFlash = 0,
  kMapIndexSRAM = 1
}
 Map indicies. More...
 

Public Member Functions

 MemoryStore (int mapIndex, uint32_t fillByte=0)
 Constructor that takes a map index. More...
 
bool open (const std::string &pathToDir, bool forceCreate)
 Open the store. More...
 
void close ()
 Close the store.
 
size_t read (long int offset, size_t size, unsigned char *buffer)
 Read from memory. More...
 
size_t write (long int offset, size_t size, const unsigned char *buffer)
 Write to memory. More...
 
void erase (long int offset, size_t size)
 Erase memory. More...
 
void erase ()
 Erase all memory.
 

Protected Attributes

int m_mapIndex
 Index of memory map entry.
 
uint8_t m_fillByte
 Erase value.
 
size_t m_size
 Size of memory file.
 
uint32_t m_startAddress
 Address address from map.
 
FILE * m_memoryFile
 Handle to memory file.
 

Detailed Description

Represents target device memory as a disk file.

Member Enumeration Documentation

anonymous enum

Map indicies.

Enumerator
kMapIndexFlash 

Flash memory.

kMapIndexSRAM 

SRAM.

Constructor & Destructor Documentation

blfwk::MemoryStore::MemoryStore ( int  mapIndex,
uint32_t  fillByte = 0 
)
inline

Constructor that takes a map index.

Parameters
mapIndexIndex into memory map array
fillByteOptional byte erase value, default 0

Member Function Documentation

void MemoryStore::erase ( long int  offset,
size_t  size 
)

Erase memory.

The requested offset is adjusted by the store's start address to create a zero-based file offset.

Parameters
offsetOffset into memory region
sizeNumber of bytes to erase
bool MemoryStore::open ( const std::string &  pathToDir,
bool  forceCreate 
)

Open the store.

Parameters
pathToDirDirectory for memory backing file.
forceCreateTrue to re-create backing file even if it exists.
size_t MemoryStore::read ( long int  offset,
size_t  size,
unsigned char *  buffer 
)

Read from memory.

The requested offset is adjusted by the store's start address to create a zero-based file offset.

Parameters
offsetOffset into memory region
sizeNumber of bytes to read
bufferDestination buffer
Returns
Number of bytes read
size_t MemoryStore::write ( long int  offset,
size_t  size,
const unsigned char *  buffer 
)

Write to memory.

The requested offset is adjusted by the store's start address to create a zero-based file offset.

Parameters
offsetOffset into memory region
sizeNumber of bytes to write
bufferSource buffer
Returns
Number of bytes written

The documentation for this class was generated from the following files: