imgtools/romtools/rofsbuild/symbolprocessunit.h
author Ross Qin <ross.qin@nokia.com>
Tue, 02 Nov 2010 16:47:21 +0800
changeset 672 bc9ef8cca9ec
parent 654 7c11c3d8d025
permissions -rw-r--r--
revert the change to rofsbuild image format, but add checking codes to prevent address overflow
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
     1
/*
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
     8
*
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    11
*
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    12
* Contributors:
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    13
*
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    14
* Description: 
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    15
*
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    16
*/
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    17
#ifndef __SYMBOLPROCESSUNIT_H__
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    18
#define __SYMBOLPROCESSUNIT_H__
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    19
#include <vector>
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    20
#include <string>
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    21
#include <iostream>
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    22
#include <fstream>
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    23
using namespace std;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    24
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    25
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    26
typedef vector<string> stringlist;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    27
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    28
class SymbolProcessUnit
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    29
{
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    30
public:
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    31
	virtual void ProcessExecutableFile(const string& aFile) = 0;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    32
	virtual void ProcessDataFile(const string& afile) = 0;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    33
	virtual void FlushStdOut(ostream& aOut) = 0;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    34
	virtual void FlushSymbolContent(ostream &aOut) = 0;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    35
	virtual void ResetContentLog() = 0;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    36
	virtual ~SymbolProcessUnit() {}
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    37
};
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    38
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    39
class CommenSymbolProcessUnit : public SymbolProcessUnit
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    40
{
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    41
public:
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    42
	virtual void ProcessExecutableFile(const string& aFile);
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    43
	virtual void ProcessDataFile(const string& afile);
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    44
	virtual void FlushStdOut(ostream& aOut);
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    45
	virtual void FlushSymbolContent(ostream &aOut);
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    46
	virtual void ResetContentLog();
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    47
private:
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    48
	void ProcessArmv5File( const string& fileName, ifstream& aMap );
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    49
	void ProcessGcceOrArm4File( const string& fileName, ifstream& aMap );
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    50
	int GetSizeFromBinFile( const string& fileName );
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    51
private:
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    52
	stringlist iStdoutLog;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    53
	stringlist iSymbolContentLog;
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    54
};
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents:
diff changeset
    55
#endif