Kinetis Bootloader Host  2.0.0
Host Tools for Kinetis devices
src/blfwk/GHSSecInfo.h
1 /*
2  * Copyright (c) 2013-14, Freescale Semiconductor, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without modification,
6  * are permitted provided that the following conditions are met:
7  *
8  * o Redistributions of source code must retain the above copyright notice, this list
9  * of conditions and the following disclaimer.
10  *
11  * o Redistributions in binary form must reproduce the above copyright notice, this
12  * list of conditions and the following disclaimer in the documentation and/or
13  * other materials provided with the distribution.
14  *
15  * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
16  * contributors may be used to endorse or promote products derived from this
17  * software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 #if !defined(_GHSSecInfo_h_)
31 #define _GHSSecInfo_h_
32 
33 #include "StELFFile.h"
34 #include "smart_ptr.h"
35 
36 namespace blfwk
37 {
55 {
56 public:
58  GHSSecInfo(StELFFile *elf);
59 
61  bool hasSecinfo() const { return m_hasInfo; }
63  bool isSectionFilled(uint32_t addr, uint32_t length);
64 
66  bool isSectionFilled(const Elf32_Shdr &section);
67 
68 protected:
69 #pragma pack(1)
70 
75  {
76  uint32_t m_clearAddr;
77  uint32_t m_clearValue;
78  uint32_t m_numBytesToClear;
79  };
80 
81 #pragma pack()
82 
83 protected:
85  bool m_hasInfo;
88  unsigned m_entryCount;
89 };
90 
91 }; // namespace blfwk
92 
93 #endif // _GHSSecInfo_h_
ELF section header.
Definition: apps/elftosb/common/ELF.h:135
unsigned m_entryCount
Number of entries in m_info.
Definition: src/blfwk/GHSSecInfo.h:88
Wrapper around the GHS-specific .secinfo ELF section.
Definition: src/blfwk/GHSSecInfo.h:54
bool m_hasInfo
Whether .secinfo is present in the ELF file.
Definition: src/blfwk/GHSSecInfo.h:85
Definition: BlfwkErrors.h:16
bool hasSecinfo() const
Returns true if there is a .secinfo section present in the ELF file.
Definition: src/blfwk/GHSSecInfo.h:61
GHSSecInfo(StELFFile *elf)
Default constructor.
Definition: src/blfwk/src/GHSSecInfo.cpp:22
bool isSectionFilled(uint32_t addr, uint32_t length)
Determines if a section should be filled.
Definition: src/blfwk/src/GHSSecInfo.cpp:65
The structure of one .secinfo entry.
Definition: src/blfwk/GHSSecInfo.h:74
uint32_t m_clearValue
Value to fill with.
Definition: src/blfwk/GHSSecInfo.h:77
Simple, standard smart pointer class that uses the array delete operator.
Definition: apps/elftosb/common/smart_ptr.h:121
uint32_t m_numBytesToClear
Number of bytes to fill.
Definition: src/blfwk/GHSSecInfo.h:78
Parser for Executable and Linking Format (ELF) files.
Definition: apps/elftosb/common/StELFFile.h:42
smart_array_ptr< ghs_secinfo_t > m_info
Pointer to the .secinfo entries. Will be NULL if there is no .secinfo section in the file...
Definition: src/blfwk/GHSSecInfo.h:87
uint32_t m_clearAddr
Address to start filling from.
Definition: src/blfwk/GHSSecInfo.h:76
StELFFile * m_elf
The parser object for our ELF file.
Definition: src/blfwk/GHSSecInfo.h:84