Kinetis Bootloader Host  2.0.0
Host Tools for Kinetis devices
apps/elftosb/common/SRecordSourceFile.h
1 /*
2  * File: SRecordSourceFile.h
3  *
4  * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
5  * See included license file for license details.
6  */
7 #if !defined(_SRecordSourceFile_h_)
8 #define _SRecordSourceFile_h_
9 
10 #include "SourceFile.h"
11 #include "StSRecordFile.h"
12 #include "StExecutableImage.h"
13 
14 namespace elftosb
15 {
28 {
29 public:
31  SRecordSourceFile(const std::string &path);
32 
34  virtual ~SRecordSourceFile() {}
36  static bool isSRecordFile(std::istream &stream);
37 
39 
40  virtual void open();
42 
44  virtual void close();
46 
48 
49  virtual bool supportsNamedSections() const { return false; }
50  virtual bool supportsNamedSymbols() const { return false; }
52 
54 
55  virtual DataSource *createDataSource();
58 
60 
61  virtual bool hasEntryPoint();
63 
65  virtual uint32_t getEntryPointAddress();
67 
68 protected:
73 
74 protected:
76  void buildMemoryImage();
77 };
78 
79 }; // namespace elftosb
80 
81 #endif // _SRecordSourceFile_h_
virtual void close()
Closes the file.
Definition: apps/elftosb/common/SRecordSourceFile.cpp:52
Abstract base class for data sources.
Definition: apps/elftosb/common/DataSource.h:33
Definition: apps/elftosb/common/StSRecordFile.h:44
virtual bool hasEntryPoint()
Returns true if an entry point was set in the file.
Definition: apps/elftosb/common/SRecordSourceFile.cpp:73
bool m_hasEntryRecord
Whether an S7,8,9 record was found.
Definition: apps/elftosb/common/SRecordSourceFile.h:71
S-record parser.
Definition: apps/elftosb/common/StSRecordFile.h:38
Used to build a representation of memory regions.
Definition: apps/elftosb/common/StExecutableImage.h:27
virtual void open()
Opens the file.
Definition: apps/elftosb/common/SRecordSourceFile.cpp:35
static bool isSRecordFile(std::istream &stream)
Test whether the stream contains a valid S-record file.
Definition: apps/elftosb/common/SRecordSourceFile.cpp:29
Definition: BootImage.h:13
virtual uint32_t getEntryPointAddress()
Returns the entry point address.
Definition: apps/elftosb/common/SRecordSourceFile.cpp:84
Abstract base class for a source file containing executable code.
Definition: apps/elftosb/common/SourceFile.h:33
virtual DataSource * createDataSource()
Returns data source for the entire file.
Definition: apps/elftosb/common/SRecordSourceFile.cpp:65
Executable file in the Motorola S-record format.
Definition: apps/elftosb/common/SRecordSourceFile.h:27
StSRecordFile * m_file
S-record parser instance.
Definition: apps/elftosb/common/SRecordSourceFile.h:69
StExecutableImage * m_image
Memory image of the S-record file.
Definition: apps/elftosb/common/SRecordSourceFile.h:70
SRecordSourceFile(const std::string &path)
Default constructor.
Definition: apps/elftosb/common/SRecordSourceFile.cpp:22
void buildMemoryImage()
Build memory image of the S-record file.
Definition: apps/elftosb/common/SRecordSourceFile.cpp:106
virtual ~SRecordSourceFile()
Destructor.
Definition: apps/elftosb/common/SRecordSourceFile.h:34
StSRecordFile::SRecord m_entryRecord
Record for the entry point.
Definition: apps/elftosb/common/SRecordSourceFile.h:72