1/*
2 * File:	EncoreBootImageGenerator.h
3 *
4 * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
5 * See included license file for license details.
6 */
7#if !defined(_EncoreBootImageGenerator_h_)
8#define _EncoreBootImageGenerator_h_
9
10#include "BootImageGenerator.h"
11#include "EncoreBootImage.h"
12
13namespace elftosb
14{
15
16/*!
17 * \brief Generator for Encore boot images.
18 *
19 * Takes the abstract model of the output file and processes it into a
20 * concrete boot image for the STMP37xx.
21 *
22 * In order to enable full i.mx28 support, you must call the setSupportHAB() method and
23 * pass true.
24 */
25class EncoreBootImageGenerator : public BootImageGenerator
26{
27public:
28	//! \brief Default constructor.
29	EncoreBootImageGenerator() : BootImageGenerator() {}
30
31	//! \brief Builds the resulting boot image from previously added output sections.
32	virtual BootImage * generate();
33
34    //! \brief Enable or disable HAB support.
35    void setSupportHAB(bool supportHAB) { m_supportHAB = supportHAB; }
36
37protected:
38
39    bool m_supportHAB;  //!< True if HAB features are enabled.
40
41	void processOptions(EncoreBootImage * image);
42	void processSectionOptions(EncoreBootImage::Section * imageSection, OutputSection * modelSection);
43
44	void processOperationSection(OperationSequenceSection * section, EncoreBootImage * image);
45	void processDataSection(BinaryDataSection * section, EncoreBootImage * image);
46
47	void processLoadOperation(LoadOperation * op, EncoreBootImage::BootSection * section);
48	void processExecuteOperation(ExecuteOperation * op, EncoreBootImage::BootSection * section);
49	void processBootModeOperation(BootModeOperation * op, EncoreBootImage::BootSection * section);
50
51	void setFillPatternFromValue(EncoreBootImage::FillCommand & command, SizedIntegerValue & pattern);
52};
53
54}; // namespace elftosb
55
56#endif // _EncoreBootImageGenerator_h_
57
58