Kinetis Bootloader Host  2.0.0
Host Tools for Kinetis devices
blfwk::ELFSourceFile::ELFDataSource Class Reference

A data source with ELF file sections as the contents. More...

#include <ELFSourceFile.h>

+ Inheritance diagram for blfwk::ELFSourceFile::ELFDataSource:
+ Collaboration diagram for blfwk::ELFSourceFile::ELFDataSource:

Classes

class  NoBitsSegment
 Represents one named #SHT_NOBITS section within the ELF file. More...
 
class  ProgBitsSegment
 Represents one named #SHT_PROGBITS section within the ELF file. More...
 

Public Member Functions

 ELFDataSource (StELFFile *elf)
 Default constructor.
 
virtual ~ELFDataSource ()
 Destructor.
 
void setSecinfoOption (secinfo_clear_t option)
 Set the option to control .secinfo usage.
 
void addSection (unsigned sectionIndex)
 Adds the ELF section at position sectionIndex to the data source. More...
 
virtual unsigned getSegmentCount ()
 Returns the number of segments in the source.
 
virtual DataSource::SegmentgetSegmentAt (unsigned index)
 Returns the segment at position index.
 
- Public Member Functions inherited from blfwk::DataSource
 DataSource ()
 Default constructor.
 
virtual ~DataSource ()
 Destructor.
 
void setTarget (DataTarget *target)
 Sets the associated data target.
 
DataTargetgetTarget () const
 Gets the associated data target.
 

Protected Types

typedef std::vector< DataSource::Segment * > segment_vector_t
 A list of segment instances.
 

Protected Attributes

StELFFilem_elf
 The ELF file parser.
 
secinfo_clear_t m_secinfoOption
 How to deal with the .secinfo section. Ignored if the toolset is not GHS.
 
segment_vector_t m_segments
 The segments of this data source.
 
- Protected Attributes inherited from blfwk::DataSource
DataTargetm_target
 Corresponding target for this source.
 

Detailed Description

A data source with ELF file sections as the contents.

Each segment of this data source corresponds directly with a named section of the ELF file it represents. When the data source is created, it contains no segments. Segments are created with the addSection() method, which takes the index of an ELF section and creates a corresponding segment.

Two segment subclasses are used with this data source. The first, ProgBitsSegment, is used to represent sections whose type is #SHT_PROGBITS. These sections have binary data stored in the ELF file. The second segment type is NoBitsSegment. It is used to represent sections whose type is #SHT_NOBITS. These sections have no data, but simply allocate a region of memory to be filled with zeroes. As such, the NoBitsSegment class is a subclass of DataSource::PatternSegment.

Member Function Documentation

void ELFSourceFile::ELFDataSource::addSection ( unsigned  sectionIndex)

Adds the ELF section at position sectionIndex to the data source.

Not all sections will actually result in a new segment being created. Only those sections whose type is #SHT_PROGBITS or #SHT_NOBITS will create a new segment. Also, only sections whose size is non-zero will actually create a segment.

In addition to this, ELF files that have been marked as being created by the Green Hills Software toolset have an extra step. #SHT_NOBITS sections are looked up in the .secinfo section to determine if they really should be filled. If not in the .secinfo table, no segment will be created for the section.


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