Kinetis Bootloader Host  2.0.0
Host Tools for Kinetis devices
elftosb::DataSource::PatternSegment Class Reference

This is a special type of segment containing a repeating pattern. More...

#include <DataSource.h>

+ Inheritance diagram for elftosb::DataSource::PatternSegment:
+ Collaboration diagram for elftosb::DataSource::PatternSegment:

Public Member Functions

 PatternSegment (DataSource &source)
 Default constructor.
 
 PatternSegment (DataSource &source, const SizedIntegerValue &pattern)
 Constructor taking a fill pattern.
 
 PatternSegment (DataSource &source, uint8_t pattern)
 Constructor taking a byte fill pattern.
 
 PatternSegment (DataSource &source, uint16_t pattern)
 Constructor taking a half-word fill pattern.
 
 PatternSegment (DataSource &source, uint32_t pattern)
 Constructor taking a word fill pattern.
 
Segment methods
virtual bool hasNaturalLocation ()
 Pattern segments have no natural address.
 
virtual unsigned getData (unsigned offset, unsigned maxBytes, uint8_t *buffer)
 Performs a pattern fill into the buffer.
 
virtual unsigned getLength ()
 Returns a length based on the data target's address range. More...
 
Pattern accessors
void setPattern (const SizedIntegerValue &newPattern)
 Assigns a new fill pattern.
 
SizedIntegerValuegetPattern ()
 Return the fill pattern for the segment.
 
PatternSegmentoperator= (const SizedIntegerValue &value)
 Assignment operator, sets the pattern value and length.
 
- Public Member Functions inherited from elftosb::DataSource::Segment
 Segment (DataSource &source)
 Default constructor.
 
virtual ~Segment ()
 Destructor.
 
virtual uint32_t getBaseAddress ()
 Returns the address associated with the segment.
 

Protected Attributes

SizedIntegerValue m_pattern
 The fill pattern.
 
- Protected Attributes inherited from elftosb::DataSource::Segment
DataSourcem_source
 The data source to which this segment belongs.
 

Detailed Description

This is a special type of segment containing a repeating pattern.

By default the segment doesn't have a specific length or data. The length depends on the target's address range. And the data is just the pattern, repeated many times. In addition, pattern segments do not have a natural location.

Calling code should look for instances of PatternSegment and handle them as special cases that can be optimized.

Member Function Documentation

unsigned DataSource::PatternSegment::getLength ( )
virtual

Returns a length based on the data target's address range.

The pattern segment's length is a function of the data target. If the target is bounded, then the segment's length is simply the target's length. Otherwise, if no target has been set or the target is unbounded, then the length returned is 0.

Implements elftosb::DataSource::Segment.

Reimplemented in elftosb::MemoryImageDataSource::FillSegment, and elftosb::ELFSourceFile::ELFDataSource::NoBitsSegment.


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