imgtools/romtools/rombuild/symbolgenerator.h
author y4jin
Tue, 09 Nov 2010 17:18:57 +0800
changeset 675 02e65118a746
parent 654 7c11c3d8d025
permissions -rw-r--r--
Fix the illegal word scanned by sfchecksource tools
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 600
diff changeset
     1
/*
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 600
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: 600
diff changeset
     3
* All rights reserved.
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 600
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: 600
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: 600
diff changeset
     6
* which accompanies this distribution, and is available
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 600
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: 600
diff changeset
     8
*
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 600
diff changeset
     9
* Initial Contributors:
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 600
diff changeset
    10
* Nokia Corporation - initial contribution.
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 600
diff changeset
    11
*
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 600
diff changeset
    12
* Contributors:
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 600
diff changeset
    13
*
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 600
diff changeset
    14
* Description: 
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 600
diff changeset
    15
*
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 600
diff changeset
    16
*/
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 600
diff changeset
    17
600
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    18
#ifndef __SYMBOLSCREATER_H__
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    19
#define __SYMBOLSCREATER_H__
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    20
#include <queue>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    21
#include <string>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    22
#include <fstream>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    23
#include <vector>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    24
#include <map>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    25
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    26
using namespace std;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    27
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    28
#include <boost/thread/thread.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    29
#include <boost/thread/condition.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    30
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    31
struct SymGenContext {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    32
	const char* iFileName ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    33
	TUint32	iTotalSize ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    34
	TUint32 iCodeAddress; 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    35
	TUint32 iDataAddress; 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    36
	TUint32 iDataBssLinearBase;	 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    37
	TInt iTextSize; 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    38
	TInt iDataSize; 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    39
	TInt iBssSize;   	
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    40
	TInt iTotalDataSize;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    41
	TBool iExecutable ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    42
};
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    43
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    44
class SymbolGenerator  {  
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    45
public :
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    46
		SymbolGenerator(const char* aSymbolFileName, int aMultiThreadsCount = 1);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    47
		~SymbolGenerator();		
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    48
		void AddEntry(const SymGenContext& aEntry); 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    49
		void WaitThreads();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    50
private :
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    51
		SymbolGenerator();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    52
		SymbolGenerator& operator = (const SymbolGenerator& aRight);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    53
		static void ThreadFunc(SymbolGenerator* aInst); 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    54
		bool ProcessEntry(const SymGenContext& aContext);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    55
		bool ProcessARMV5Map(ifstream& aStream, const SymGenContext& aContext);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    56
		bool ProcessGCCMap(ifstream& aStream, const SymGenContext& aContext);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    57
		bool ProcessX86Map(ifstream& aStream, const SymGenContext& aContext);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    58
		ofstream iOutput ; 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    59
		boost::thread_group iThreads ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    60
		boost::condition_variable iCond;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    61
		boost::mutex iQueueMutex;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    62
		boost::mutex iFileMutex ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    63
		queue<SymGenContext> iEntries ;	
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    64
		vector<char*> iErrMsgs ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    65
	
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    66
};
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    67
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    68
#endif //__ROMSYMBOLGENERATOR_H__