Changed it so each target can have their own command line.
[fw/sdcc] / src / mcs51 / main.c
1 /** @file main.c
2     mcs51 specific general functions.
3
4     Note that mlh prepended _mcs51_ on the static functions.  Makes
5     it easier to set a breakpoint using the debugger.
6 */
7 #include "common.h"
8 #include "main.h"
9 #include "ralloc.h"
10
11 /* list of key words used by msc51 */
12 static char *_mcs51_keywords[] =     {
13     "at",
14     "bit",
15     "code",
16     "critical",
17     "data",
18     "far",
19     "idata",
20     "interrupt",
21     "near",
22     "pdata",
23     "reentrant",
24     "sfr",
25     "sbit",
26     "using",
27     "xdata",
28     "_data",
29     "_code",
30     "_generic",
31     "_near",
32     "_xdata",
33     "_pdata",
34     "_idata",
35     NULL
36 };
37
38
39 void mcs51_assignRegisters (eBBlock **ebbs, int count);
40
41 static bool _mcs51_parseOptions(int *pargc, char **argv)
42 {
43     return FALSE;
44 }
45
46 static void _mcs51_finaliseOptions(void)
47 {
48 }
49
50 static void _mcs51_setDefaultOptions(void)
51 {    
52 }
53
54 static const char *_mcs51_getRegName(struct regs *reg)
55 {
56     if (reg)
57         return reg->name;
58     return "err";
59 }
60
61 /** $1 is always the basename.
62     $2 is always the output file.
63     $3 varies
64     $l is the list of extra options that should be there somewhere...
65     MUST be terminated with a NULL.
66 */
67 static const char *_linkCmd[] = {
68     "aslink", "-nf", "$1", NULL
69 };
70
71 static const char *_asmCmd[] = {
72     "asx8051", "-plosgffc", "$1.asm", NULL
73 };
74
75 /* Globals */
76 PORT mcs51_port = {
77     "mcs51",
78     "MCU 8051",                 /* Target name */
79     {   
80         _asmCmd,
81         "-plosgffc",            /* Options with debug */
82         "-plosgff",             /* Options without debug */
83     },
84     {
85         _linkCmd
86     },
87     {
88         /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
89         1, 1, 2, 4, 1, 2, 3, 1, 4, 4
90     },
91     {
92         "XSEG    (XDATA)",
93         "STACK   (DATA)",
94         "CSEG    (CODE)",
95         "DSEG    (DATA)",
96         "ISEG    (DATA)",
97         "XSEG    (XDATA)",
98         "BSEG    (BIT)",
99         "RSEG    (DATA)",
100         "GSINIT  (CODE)",
101         "OSEG    (OVR,DATA)"
102     },
103     { 
104         +1, 1, 4, 1, 1
105     },
106     /* mcs51 has an 8 bit mul */
107     {
108         1
109     },
110     _mcs51_parseOptions,
111     _mcs51_finaliseOptions,
112     _mcs51_setDefaultOptions,
113     mcs51_assignRegisters,
114     _mcs51_getRegName ,
115     _mcs51_keywords
116
117 };