]> git.pld-linux.org Git - packages/crossavr-gcc.git/blame - crossavr-gcc-mega256.patch
- rel 2
[packages/crossavr-gcc.git] / crossavr-gcc-mega256.patch
CommitLineData
2bc38036 1Index: gcc/config/avr/libgcc.S
2===================================================================
3--- gcc/config/avr/libgcc.S (revision 132252)
4+++ gcc/config/avr/libgcc.S (working copy)
5@@ -594,7 +594,12 @@
6 out __SP_H__,r29
7 out __SREG__,__tmp_reg__
8 out __SP_L__,r28
9+#if defined (__AVR_HAVE_EIJMP_EICALL__)
10+ eijmp
11+#else
12 ijmp
13+#endif
14+
15 .endfunc
16 #endif /* defined (L_prologue) */
17
18@@ -674,13 +679,22 @@
19 lpm __tmp_reg__, Z+
20 lpm r31, Z
21 mov r30, __tmp_reg__
22+
23+#if defined (__AVR_HAVE_EIJMP_EICALL__)
24+ eijmp
25+#else
26 ijmp
27+#endif
28+
29 #else
30 lpm
31 adiw r30, 1
32 push r0
33 lpm
34 push r0
35+#if defined (__AVR_HAVE_EIJMP_EICALL__)
36+ push __zero_reg__
37+#endif
38 ret
39 #endif
40 .endfunc
41Index: gcc/config/avr/avr.md
42===================================================================
43--- gcc/config/avr/avr.md (revision 132252)
44+++ gcc/config/avr/avr.md (working copy)
45@@ -32,6 +32,7 @@
46 ;; p POST_INC or PRE_DEC address as a pointer (X, Y, Z)
47 ;; r POST_INC or PRE_DEC address as a register (r26, r28, r30)
48 ;; ~ Output 'r' if not AVR_MEGA.
49+;; ! Output 'e' if AVR_HAVE_EIJMP_EICALL.
50
51 ;; UNSPEC usage:
52 ;; 0 Length of a string, see "strlenhi".
53@@ -2301,22 +2302,22 @@
54 "(register_operand (operands[0], HImode) || CONSTANT_P (operands[0]))"
55 "*{
56 if (which_alternative==0)
57- return \"icall\";
58+ return \"%!icall\";
59 else if (which_alternative==1)
60 {
61 if (AVR_HAVE_MOVW)
62 return (AS2 (movw, r30, %0) CR_TAB
63- \"icall\");
64+ \"%!icall\");
65 else
66 return (AS2 (mov, r30, %A0) CR_TAB
67 AS2 (mov, r31, %B0) CR_TAB
68- \"icall\");
69+ \"%!icall\");
70 }
71 else if (which_alternative==2)
72 return AS1(%~call,%c0);
73 return (AS2 (ldi,r30,lo8(%0)) CR_TAB
74 AS2 (ldi,r31,hi8(%0)) CR_TAB
75- \"icall\");
76+ \"%!icall\");
77 }"
78 [(set_attr "cc" "clobber,clobber,clobber,clobber")
79 (set_attr_alternative "length"
80@@ -2338,22 +2339,22 @@
81 "(register_operand (operands[0], VOIDmode) || CONSTANT_P (operands[0]))"
82 "*{
83 if (which_alternative==0)
84- return \"icall\";
85+ return \"%!icall\";
86 else if (which_alternative==1)
87 {
88 if (AVR_HAVE_MOVW)
89 return (AS2 (movw, r30, %1) CR_TAB
90- \"icall\");
91+ \"%!icall\");
92 else
93 return (AS2 (mov, r30, %A1) CR_TAB
94 AS2 (mov, r31, %B1) CR_TAB
95- \"icall\");
96+ \"%!icall\");
97 }
98 else if (which_alternative==2)
99 return AS1(%~call,%c1);
100 return (AS2 (ldi, r30, lo8(%1)) CR_TAB
101 AS2 (ldi, r31, hi8(%1)) CR_TAB
102- \"icall\");
103+ \"%!icall\");
104 }"
105 [(set_attr "cc" "clobber,clobber,clobber,clobber")
106 (set_attr_alternative "length"
107@@ -2376,13 +2377,20 @@
108 ; indirect jump
109 (define_insn "indirect_jump"
110 [(set (pc) (match_operand:HI 0 "register_operand" "!z,*r"))]
111- ""
112+ "!AVR_HAVE_EIJMP_EICALL"
113 "@
114 ijmp
115 push %A0\;push %B0\;ret"
116 [(set_attr "length" "1,3")
117 (set_attr "cc" "none,none")])
118
119+(define_insn "*indirect_jump_avr6"
120+ [(set (pc) (match_operand:HI 0 "register_operand" "z"))]
121+ "AVR_HAVE_EIJMP_EICALL"
122+ "eijmp"
123+ [(set_attr "length" "1")
124+ (set_attr "cc" "none")])
125+
126 ;; table jump
127
128 ;; Table made from "rjmp" instructions for <=8K devices.
129@@ -2391,7 +2399,7 @@
130 UNSPEC_INDEX_JMP))
131 (use (label_ref (match_operand 1 "" "")))
132 (clobber (match_dup 0))]
133- "!AVR_MEGA"
134+ "(!AVR_MEGA) && (!AVR_HAVE_EIJMP_EICALL)"
135 "@
136 ijmp
137 push %A0\;push %B0\;ret"
138@@ -2420,7 +2428,7 @@
139 lpm __tmp_reg__,Z+
140 lpm r31,Z
141 mov r30,__tmp_reg__
142- ijmp"
143+ %!ijmp"
144 [(set_attr "length" "6")
145 (set_attr "cc" "clobber")])
146
147@@ -2429,7 +2437,7 @@
148 UNSPEC_INDEX_JMP))
149 (use (label_ref (match_operand 1 "" "")))
150 (clobber (match_dup 0))]
151- "AVR_MEGA"
152+ "AVR_MEGA && !AVR_HAVE_EIJMP_EICALL"
153 "lsl r30
154 rol r31
155 lpm
156Index: gcc/config/avr/avr.c
157===================================================================
158--- gcc/config/avr/avr.c (revision 132252)
159+++ gcc/config/avr/avr.c (working copy)
160@@ -127,7 +127,8 @@
161 { 0, 0, 1, 1, 0, 0, 0, 0, "__AVR_ARCH__=35" },
162 { 0, 1, 0, 1, 0, 0, 0, 0, "__AVR_ARCH__=4" },
163 { 0, 1, 1, 1, 0, 0, 0, 0, "__AVR_ARCH__=5" },
164- { 0, 1, 1, 1, 1, 1, 0, 0, "__AVR_ARCH__=51" }
165+ { 0, 1, 1, 1, 1, 1, 0, 0, "__AVR_ARCH__=51" },
166+ { 0, 1, 1, 1, 1, 1, 1, 0, "__AVR_ARCH__=6" }
167 };
168
169 /* These names are used as the index into the avr_arch_types[] table
170@@ -144,7 +145,8 @@
171 ARCH_AVR35,
172 ARCH_AVR4,
173 ARCH_AVR5,
174- ARCH_AVR51
175+ ARCH_AVR51,
176+ ARCH_AVR6
177 };
178
179 struct mcu_type_s {
180@@ -273,6 +275,10 @@
181 { "at90can128", ARCH_AVR51, "__AVR_AT90CAN128__" },
182 { "at90usb1286", ARCH_AVR51, "__AVR_AT90USB1286__" },
183 { "at90usb1287", ARCH_AVR51, "__AVR_AT90USB1287__" },
184+ /* 3-Byte PC. */
185+ { "avr6", ARCH_AVR6, NULL },
186+ { "atmega2560", ARCH_AVR6, "__AVR_ATmega2560__" },
187+ { "atmega2561", ARCH_AVR6, "__AVR_ATmega2561__" },
188 /* Assembler only. */
189 { "avr1", ARCH_AVR1, NULL },
190 { "at90s1200", ARCH_AVR1, "__AVR_AT90S1200__" },
191@@ -511,9 +517,10 @@
192 else
193 {
194 int offset = frame_pointer_needed ? 2 : 0;
195+ int avr_pc_size = AVR_HAVE_EIJMP_EICALL ? 3 : 2;
196
197 offset += avr_regs_to_save (NULL);
198- return get_frame_size () + 2 + 1 + offset;
199+ return get_frame_size () + (avr_pc_size) + 1 + offset;
200 }
201 }
202
203@@ -1119,7 +1126,7 @@
204 && ((GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_FUNCTION_P (addr))
205 || GET_CODE (addr) == LABEL_REF))
206 {
207- fprintf (file, "pm(");
208+ fprintf (file, "gs(");
209 output_addr_const (file,addr);
210 fprintf (file ,")");
211 }
212@@ -1144,6 +1151,11 @@
213 if (!AVR_MEGA)
214 fputc ('r', file);
215 }
216+ else if (code == '!')
217+ {
218+ if (AVR_HAVE_EIJMP_EICALL)
219+ fputc ('e', file);
220+ }
221 else if (REG_P (x))
222 {
223 if (x == zero_reg_rtx)
224@@ -4468,7 +4480,7 @@
225 && ((GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_FUNCTION_P (x))
226 || GET_CODE (x) == LABEL_REF))
227 {
228- fputs ("\t.word\tpm(", asm_out_file);
229+ fputs ("\t.word\tgs(", asm_out_file);
230 output_addr_const (asm_out_file, x);
231 fputs (")\n", asm_out_file);
232 return true;
233@@ -5815,7 +5827,7 @@
234 {
235 switch_to_section (progmem_section);
236 if (AVR_MEGA)
237- fprintf (stream, "\t.word pm(.L%d)\n", value);
238+ fprintf (stream, "\t.word gs(.L%d)\n", value);
239 else
240 fprintf (stream, "\trjmp .L%d\n", value);
241 }
242Index: gcc/config/avr/t-avr
243===================================================================
244--- gcc/config/avr/t-avr (revision 132252)
245+++ gcc/config/avr/t-avr (working copy)
246@@ -37,8 +37,8 @@
247
248 FPBIT = fp-bit.c
249
250-MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr31/mmcu=avr35/mmcu=avr4/mmcu=avr5/mmcu=avr51
251-MULTILIB_DIRNAMES = avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51
252+MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr31/mmcu=avr35/mmcu=avr4/mmcu=avr5/mmcu=avr51/mmcu=avr6
253+MULTILIB_DIRNAMES = avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6
254
255 # The many avr2 matches are not listed here - this is the default.
256 MULTILIB_MATCHES = \
257@@ -123,7 +123,9 @@
258 mmcu?avr51=mmcu?atmega1284p \
259 mmcu?avr51=mmcu?at90can128 \
260 mmcu?avr51=mmcu?at90usb1286 \
261- mmcu?avr51=mmcu?at90usb1287
262+ mmcu?avr51=mmcu?at90usb1287 \
263+ mmcu?avr6=mmcu?atmega2560 \
264+ mmcu?avr6=mmcu?atmega2561
265
266 MULTILIB_EXCEPTIONS =
267
268Index: gcc/config/avr/avr.h
269===================================================================
270--- gcc/config/avr/avr.h (revision 132252)
271+++ gcc/config/avr/avr.h (working copy)
272@@ -80,6 +80,12 @@
273 builtin_define ("__AVR_MEGA__"); \
274 if (avr_current_arch->have_jmp_call) \
275 builtin_define ("__AVR_HAVE_JMP_CALL__"); \
276+ if (!avr_current_arch->have_eijmp_eicall) \
277+ builtin_define ("__AVR_2_BYTE_PC__"); \
278+ if (avr_current_arch->have_eijmp_eicall) \
279+ builtin_define ("__AVR_3_BYTE_PC__"); \
280+ if (avr_current_arch->have_eijmp_eicall) \
281+ builtin_define ("__AVR_HAVE_EIJMP_EICALL__"); \
282 if (TARGET_NO_INTERRUPTS) \
283 builtin_define ("__NO_INTERRUPTS__"); \
284 } \
285@@ -100,9 +106,10 @@
286 #define AVR_HAVE_MOVW (avr_have_movw_lpmx_p)
287 #define AVR_HAVE_LPMX (avr_have_movw_lpmx_p)
288 #define AVR_HAVE_RAMPZ (avr_current_arch->have_elpm)
289+#define AVR_HAVE_EIJMP_EICALL (avr_current_arch->have_eijmp_eicall)
290
291-#define AVR_2_BYTE_PC 1
292-#define AVR_3_BYTE_PC 0
293+#define AVR_2_BYTE_PC (!AVR_HAVE_EIJMP_EICALL)
294+#define AVR_3_BYTE_PC (AVR_HAVE_EIJMP_EICALL)
295
296 #define TARGET_VERSION fprintf (stderr, " (GNU assembler syntax)");
297
298@@ -671,7 +678,7 @@
299
300 #define PRINT_OPERAND(STREAM, X, CODE) print_operand (STREAM, X, CODE)
301
302-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '~')
303+#define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '~' || (CODE) == '!')
304
305 #define PRINT_OPERAND_ADDRESS(STREAM, X) print_operand_address(STREAM, X)
306
307@@ -828,6 +835,7 @@
308 mmcu=at90usb64*|\
309 mmcu=at90usb128*|\
310 mmcu=at94k: -m avr5}\
311+%{mmcu=atmega256*:-m avr6}\
312 %{mmcu=atmega324*|\
313 mmcu=atmega325*|\
314 mmcu=atmega328p|\
315@@ -856,7 +864,8 @@
316 mmcu=at90usb*: -Tdata 0x800100}\
317 %{mmcu=atmega640|\
318 mmcu=atmega1280|\
319- mmcu=atmega1281: -Tdata 0x800200} "
320+ mmcu=atmega1281|\
321+ mmcu=atmega256*: -Tdata 0x800200} "
322
323 #define LIB_SPEC \
324 "%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lc }}}}}"
325@@ -968,6 +977,8 @@
326 %{mmcu=atmega1280:crtm1280.o%s} \
327 %{mmcu=atmega1281:crtm1281.o%s} \
328 %{mmcu=atmega1284p:crtm1284p.o%s} \
329+%{mmcu=atmega2560:crtm2560.o%s} \
330+%{mmcu=atmega2561:crtm2561.o%s} \
331 %{mmcu=at90can128:crtcan128.o%s} \
332 %{mmcu=at90usb1286:crtusb1286.o%s} \
333 %{mmcu=at90usb1287:crtusb1287.o%s}"
This page took 0.365391 seconds and 4 git commands to generate.