Kinetis Bootloader Host  2.0.0
Host Tools for Kinetis devices
elftosb::GHSSecInfo Class Reference

Wrapper around the GHS-specific .secinfo ELF section. More...

#include <GHSSecInfo.h>

+ Collaboration diagram for elftosb::GHSSecInfo:

Classes

struct  ghs_secinfo_t
 The structure of one .secinfo entry. More...
 

Public Member Functions

 GHSSecInfo (StELFFile *elf)
 Default constructor. More...
 
bool hasSecinfo () const
 Returns true if there is a .secinfo section present in the ELF file.
 
bool isSectionFilled (uint32_t addr, uint32_t length)
 Determines if a section should be filled. More...
 
bool isSectionFilled (const Elf32_Shdr &section)
 Determines if section should be filled. More...
 

Protected Attributes

StELFFilem_elf
 The parser object for our ELF file.
 
bool m_hasInfo
 Whether .secinfo is present in the ELF file.
 
smart_array_ptr< ghs_secinfo_tm_info
 Pointer to the .secinfo entries. Will be NULL if there is no .secinfo section in the file.
 
unsigned m_entryCount
 Number of entries in m_info.
 

Detailed Description

Wrapper around the GHS-specific .secinfo ELF section.

ELF files produced by the Green Hills MULTI toolset will have a special .secinfo section. For the most part, this section contains a list of address ranges that should be filled by the C runtime startup code. The address ranges correspond to those of ELF sections whose type is #SHT_NOBITS. The GHS runtime uses this table instead of just filling all #SHT_NOBITS sections because the linker command file can be used to optionally not fill individual sections.

The isSectionFilled() methods let calling code determine if an ELF section is found in the .secinfo table. If the section is found, then it should be filled.


Class Documentation

struct elftosb::GHSSecInfo::ghs_secinfo_t

The structure of one .secinfo entry.

Class Members
uint32_t m_clearAddr Address to start filling from.
uint32_t m_clearValue Value to fill with.
uint32_t m_numBytesToClear Number of bytes to fill.

Constructor & Destructor Documentation

GHSSecInfo::GHSSecInfo ( StELFFile elf)

Default constructor.

The ELF file passed into this constructor as the elf argument must remain valid for the life of this object.

Parameters
elfThe ELF file parser. An assertion is raised if this is NULL.

Member Function Documentation

bool GHSSecInfo::isSectionFilled ( uint32_t  addr,
uint32_t  length 
)

Determines if a section should be filled.

Looks up addr for length in the .secinfo array. Only if that address is in the .secinfo array does this section need to be filled. If the section is found but the length does not match the length argument, a message is logged at the Logger::WARNING level.

If the .secinfo section is not present in the ELF file, this method always returns true.

Parameters
addrThe start address of the section to query.
lengthThe length of the section. If a section with a start address matching addr is found, its length must match length to be considered.
Return values
trueThe section matching addr and length was found and should be filled. True is also returned when the ELF file does not have a .secinfo section.
falseThe section was not found and should not be filled.
bool GHSSecInfo::isSectionFilled ( const Elf32_Shdr section)

Determines if section should be filled.

Simply calls through to isSectionFilled(uint32_t, uint32_t) to determine if section should be filled.

If the .secinfo section is not present in the ELF file, this method always returns true.


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