Mercurial > hg-old > index.cgi
comparison lwlink/script.c @ 187:857cb407229e
Added LWEX0 (LWOS simple binary) target to lwlink
author | lost |
---|---|
date | Sun, 22 Mar 2009 04:24:39 +0000 |
parents | 6ebb93b409ba |
children | bae1e3ecdce1 |
comparison
equal
deleted
inserted
replaced
186:bc2fae9438eb | 187:857cb407229e |
---|---|
46 static char *raw_script = | 46 static char *raw_script = |
47 "section init load 0000\n" | 47 "section init load 0000\n" |
48 "section code\n" | 48 "section code\n" |
49 "section *,!bss\n" | 49 "section *,!bss\n" |
50 "section *,bss\n" | 50 "section *,bss\n" |
51 ; | |
52 | |
53 static char *lwex0_script = | |
54 "section init load 0100\n" | |
55 "section .text\n" | |
56 "section .data\n" | |
57 "section *,!bss\n" | |
58 "section *,bss\n" | |
59 "entry _start\n" | |
60 "stacksize 0100\n" // default 256 byte stack | |
51 ; | 61 ; |
52 | 62 |
53 // the "simple" script | 63 // the "simple" script |
54 static char *simple_script = | 64 static char *simple_script = |
55 "section *,!bss\n" | 65 "section *,!bss\n" |
105 | 115 |
106 case OUTPUT_DECB: | 116 case OUTPUT_DECB: |
107 script = decb_script; | 117 script = decb_script; |
108 break; | 118 break; |
109 | 119 |
120 case OUTPUT_LWEX0: | |
121 script = lwex0_script; | |
122 break; | |
123 | |
110 default: | 124 default: |
111 script = simple_script; | 125 script = simple_script; |
112 break; | 126 break; |
113 } | 127 } |
114 | 128 |
130 strcpy(oscript, script); | 144 strcpy(oscript, script); |
131 script = rscript; | 145 script = rscript; |
132 } | 146 } |
133 } | 147 } |
134 | 148 |
149 if (outformat == OUTPUT_LWEX0) | |
150 linkscript.stacksize = 0x100; | |
151 | |
135 oscript = script; | 152 oscript = script; |
136 // now parse the script file | 153 // now parse the script file |
137 while (*script) | 154 while (*script) |
138 { | 155 { |
139 char *ptr, *ptr2, *line; | 156 char *ptr, *ptr2, *line; |
174 // padding | 191 // padding |
175 // parse the hex number and stow it | 192 // parse the hex number and stow it |
176 linkscript.padsize = strtol(ptr, NULL, 16); | 193 linkscript.padsize = strtol(ptr, NULL, 16); |
177 if (linkscript.padsize < 0) | 194 if (linkscript.padsize < 0) |
178 linkscript.padsize = 0; | 195 linkscript.padsize = 0; |
196 } | |
197 else if (!strcmp(line, "stacksize")) | |
198 { | |
199 // stack size for targets that support it | |
200 // parse the hex number and stow it | |
201 linkscript.padsize = strtol(ptr, NULL, 16); | |
202 if (linkscript.stacksize < 0) | |
203 linkscript.stacksize = 0x100; | |
179 } | 204 } |
180 else if (!strcmp(line, "entry")) | 205 else if (!strcmp(line, "entry")) |
181 { | 206 { |
182 int eaddr; | 207 int eaddr; |
183 | 208 |