Commit f2c308fa by Georg-Johann Lay Committed by Georg-Johann Lay

avr.h (mcu_type_s): Add errata_skip field.

	
	* config/avr/avr.h (mcu_type_s): Add errata_skip field.
	* config/avr/avr-devices.c (avr_mcu_types): Use it.
	* config/avr/avr-mcus.def (AVR_MCU): Use it.
	* config/avr/avr-c.c (avr_cpu_cpp_builtins): Use it to builtin
	define __AVR_ERRATA_SKIP__ and __AVR_ERRATA_SKIP_JMP_CALL__.
	* config/avr/libgcc.S (__mulshisi3, __ffshi2, __fmulsu_exit):
	Use __AVR_ERRATA_SKIP_JMP_CALL__ instead of __AVR_HAVE_JMP_CALL__
	to detect if XJMP must not be skipped.

From-SVN: r177049
parent daec8eeb
2011-08-01 Georg-Johann Lay <avr@gjlay.de>
* config/avr/avr.h (mcu_type_s): Add errata_skip field.
* config/avr/avr-devices.c (avr_mcu_types): Use it.
* config/avr/avr-mcus.def (AVR_MCU): Use it.
* config/avr/avr-c.c (avr_cpu_cpp_builtins): Use it to builtin
define __AVR_ERRATA_SKIP__ and __AVR_ERRATA_SKIP_JMP_CALL__.
* config/avr/libgcc.S (__mulshisi3, __ffshi2, __fmulsu_exit):
Use __AVR_ERRATA_SKIP_JMP_CALL__ instead of __AVR_HAVE_JMP_CALL__
to detect if XJMP must not be skipped.
2011-08-02 Alan Modra <amodra@gmail.com> 2011-08-02 Alan Modra <amodra@gmail.com>
* config/rs6000/rs6000-protos.h (rs6000_save_toc_in_prologue_p): Delete. * config/rs6000/rs6000-protos.h (rs6000_save_toc_in_prologue_p): Delete.
......
...@@ -82,6 +82,14 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile) ...@@ -82,6 +82,14 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
if (TARGET_NO_INTERRUPTS) if (TARGET_NO_INTERRUPTS)
cpp_define (pfile, "__NO_INTERRUPTS__"); cpp_define (pfile, "__NO_INTERRUPTS__");
if (avr_current_device->errata_skip)
{
cpp_define (pfile, "__AVR_ERRATA_SKIP__");
if (avr_current_arch->have_jmp_call)
cpp_define (pfile, "__AVR_ERRATA_SKIP_JMP_CALL__");
}
/* Define builtin macros so that the user can /* Define builtin macros so that the user can
easily query if or if not a specific builtin easily query if or if not a specific builtin
is available. */ is available. */
......
...@@ -40,11 +40,11 @@ const struct base_arch_s avr_arch_types[] = { ...@@ -40,11 +40,11 @@ const struct base_arch_s avr_arch_types[] = {
}; };
const struct mcu_type_s avr_mcu_types[] = { const struct mcu_type_s avr_mcu_types[] = {
#define AVR_MCU(NAME, ARCH, MACRO, SHORT_SP, DATA_SEC, LIBRARY_NAME) \ #define AVR_MCU(NAME, ARCH, MACRO, SHORT_SP, ERRATA_SKIP, DATA_SEC, LIBRARY_NAME) \
{ NAME, ARCH, MACRO, SHORT_SP, DATA_SEC, LIBRARY_NAME }, { NAME, ARCH, MACRO, SHORT_SP, ERRATA_SKIP, DATA_SEC, LIBRARY_NAME },
#include "avr-mcus.def" #include "avr-mcus.def"
#undef AVR_MCU #undef AVR_MCU
/* End of list. */ /* End of list. */
{ NULL, ARCH_UNKNOWN, NULL, 0, 0, NULL } { NULL, ARCH_UNKNOWN, NULL, 0, 0, 0, NULL }
}; };
...@@ -91,6 +91,26 @@ struct mcu_type_s { ...@@ -91,6 +91,26 @@ struct mcu_type_s {
/* Stack pointer have 8 bits width. */ /* Stack pointer have 8 bits width. */
int short_sp; int short_sp;
/* Some AVR devices have a core erratum when skipping a 2-word instruction.
Skip instructions are: SBRC, SBRS, SBIC, SBIS, CPSE.
Problems will occur with return address is IRQ executes during the
skip sequence.
A support ticket from Atmel returned the following information:
Subject: (ATTicket:644469) On AVR skip-bug core Erratum
From: avr@atmel.com Date: 2011-07-27
(Please keep the subject when replying to this mail)
This errata exists only in AT90S8515 and ATmega103 devices.
For information please refer the following respective errata links
http://www.atmel.com/dyn/resources/prod_documents/doc2494.pdf
http://www.atmel.com/dyn/resources/prod_documents/doc1436.pdf */
/* Core Erratum: Must not skip 2-word instruction. */
int errata_skip;
/* Start of data section. */ /* Start of data section. */
int data_section_start; int data_section_start;
......
...@@ -361,7 +361,7 @@ ENDF __umulhisi3 ...@@ -361,7 +361,7 @@ ENDF __umulhisi3
;;; (C3:C0) = (signed long) A1:A0 * B3:B0 ;;; (C3:C0) = (signed long) A1:A0 * B3:B0
;;; Clobbers: __tmp_reg__ ;;; Clobbers: __tmp_reg__
DEFUN __mulshisi3 DEFUN __mulshisi3
#ifdef __AVR_HAVE_JMP_CALL__ #ifdef __AVR_ERRATA_SKIP_JMP_CALL__
;; Some cores have problem skipping 2-word instruction ;; Some cores have problem skipping 2-word instruction
tst A1 tst A1
brmi __mulohisi3 brmi __mulohisi3
...@@ -1074,7 +1074,7 @@ ENDF __ffssi2 ...@@ -1074,7 +1074,7 @@ ENDF __ffssi2
;; clobbers: r26 ;; clobbers: r26
DEFUN __ffshi2 DEFUN __ffshi2
clr r26 clr r26
#ifdef __AVR_HAVE_JMP_CALL__ #ifdef __AVR_ERRATA_SKIP_JMP_CALL__
;; Some cores have problem skipping 2-word instruction ;; Some cores have problem skipping 2-word instruction
tst r24 tst r24
breq 2f breq 2f
...@@ -1480,7 +1480,7 @@ DEFUN __fmulsu_exit ...@@ -1480,7 +1480,7 @@ DEFUN __fmulsu_exit
;; A1 = |A1| ;; A1 = |A1|
sbrc A1, 7 sbrc A1, 7
neg A1 neg A1
#ifdef __AVR_HAVE_JMP_CALL__ #ifdef __AVR_ERRATA_SKIP_JMP_CALL__
;; Some cores have problem skipping 2-word instruction ;; Some cores have problem skipping 2-word instruction
tst A0 tst A0
brmi 1f brmi 1f
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment