1 /*---------------------------------------------------------------------------*
2 Project: TwlSDK - bin2obj
3 File: bin2obj.c
4
5 Copyright 2005-2008 Nintendo. All rights reserved.
6
7 These coded instructions, statements, and computer programs contain
8 proprietary information of Nintendo of America Inc. and/or Nintendo
9 Company Ltd., and are protected by Federal copyright law. They may
10 not be disclosed to third parties or copied or duplicated in any form,
11 in whole or in part, without the prior written consent of Nintendo.
12
13 $Date:: 2008-09-18#$
14 $Rev: 8573 $
15 $Author: okubata_ryoma $
16 *---------------------------------------------------------------------------*/
17 #include "bin2obj.h"
18
19 /*---------------------------------------------------------------------------*
20 Name: Main
21
22 Description: bin2obj main.
23 *---------------------------------------------------------------------------*/
main(int argc,char * argv[])24 int main(int argc, char *argv[])
25 {
26 Bin2ObjArgs args;
27 BOOL result;
28
29 cook_args(&args, argc, argv);
30 result = bin2obj(&args);
31 free_args(&args);
32
33 return result ? 0 : 1;
34 }
35
36 /*---------------------------------------------------------------------------*
37 Name: bin2obj
38
39 Description: Outputs object information.
40
41 Arguments: t: bin2obj argument after processing
42
43 Returns: TRUE for success; FALSE for failure.
44 *---------------------------------------------------------------------------*/
bin2obj(const Bin2ObjArgs * t)45 BOOL bin2obj(const Bin2ObjArgs * t)
46 {
47 Object object;
48
49 //
50 // Create object data
51 //
52 object_init(&object, t->machine, t->endian);
53
54 if (!add_datasec(&object,
55 t->section_rodata, t->section_rwdata,
56 t->symbol_begin, t->symbol_end, t->binary_filename, t->writable, t->align))
57 {
58 return FALSE;
59 }
60
61 map_section(&object);
62
63 //
64 // Output object
65 //
66 if (!output_object(&object, t->object_filename))
67 {
68 return FALSE;
69 }
70
71 return TRUE;
72 }
73