[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] AVR223 for GCC
From: |
Joerg Wunsch |
Subject: |
Re: [avr-gcc-list] AVR223 for GCC |
Date: |
Mon, 17 Feb 2003 16:48:02 +0100 (MET) |
address@hidden wrote:
> The application I am trying to use with GCC is the Appnote 223 which
> has the major filters written in the IARCC format.
What's so difficult about it? After looking into one of the files, it
took me only a few minutes to figure out what needs to be changed.
Context diff for one file below. Of course, if i were you, i'd
probably automate the process.
The biggest problem seems to be that the IAR assembler uses \1 etc.
for positional macro arguments, while the GNU assembler expects
explicitly named positional arguments for its macros.
Note that i have also removed all \r characters from the file, it
might be required (but i'm not sure).
Make sure you generate a file ending in .S (a capital letter S) since
this will make avr-gcc also invoke the C preprocessor.
--- 2nd_order_FIR.s90 Fri Jun 7 11:46:50 2002
+++ 2nd_order_FIR.S Mon Feb 17 16:42:29 2003
@@ -50,9 +50,8 @@
;* INIT: Depending on compiler settings (135 cycles)
;* FILTER: 60 instructions; 80 cycles (excl. ret)
;*****************************************************
- NAME assembly(16)
- PUBLIC FIR2
- RSEG CODE
+ .global FIR2
+ .text
;ZERO register (used to add carry flag)
#define ZERO R2
@@ -91,22 +90,22 @@
;**************************************************
;* MACROS
;**************************************************
-LOAD_NODE MACRO
- ldd DATAL,Z+\1 ; Load low byte of node
- ldd DATAH,Z+\1+1 ; Load high byte of node
- ENDM
-
-UPDATE_NODE MACRO
- std Z+\1, DATAL ; Update low byte of node to prepare
next filter run
- std Z+\1+1, DATAH ; Update high byte of node to prepare
next filter run
- ENDM
-
-LOAD_COEF MACRO
- ldd COEFL,Z+\1 ; Load low byte of node
- ldd COEFH,Z+\1+1 ; Load high byte of node
- ENDM
+.macro LOAD_NODE a
+ ldd DATAL,Z+\a ; Load low byte of node
+ ldd DATAH,Z+\a+1 ; Load high byte of node
+ .ENDM
+
+.macro UPDATE_NODE a
+ std Z+\a, DATAL ; Update low byte of node to prepare
next filter run
+ std Z+\a+1, DATAH ; Update high byte of node to prepare
next filter run
+ .ENDM
+
+.macro LOAD_COEF a
+ ldd COEFL,Z+\a ; Load low byte of node
+ ldd COEFH,Z+\a+1 ; Load high byte of node
+ .ENDM
-MUL_MOV_24 MACRO
+.macro MUL_MOV_24
muls COEFH, DATAH ; Signed multiply, coefficient high
byte and data high byte
mov AC2, r0 ; Copy low byte into
accumulator byte 2 (sign bit automatically correct)
@@ -121,9 +120,9 @@
mulsu DATAH, COEFL ; Signed-unsigned multiply, data high
byte and coefficient low byte
add AC1, r0 ; Add low byte of result to
accumulator byte 1
adc AC2, r1 ; Add with carry high byte of
result to accumulator byte 2
- ENDM
+ .ENDM
-SMAC24 MACRO
+.macro SMAC24
muls COEFH, DATAH ; Signed multiply, coefficient high
byte and data high byte
add AC2, r0 ; Copy low byte into
accumulator byte 2
@@ -139,7 +138,7 @@
mulsu DATAH, COEFL ; Signed-unsigned multiply, data high
byte and coefficient low byte
add AC1, r0 ; Add low byte of result to
accumulator byte 1
adc AC2, r1 ; Add with carry high byte of
result to accumulator byte 2
- ENDM
+ .ENDM
;*****************************************************
; FIR filter function
@@ -181,4 +180,3 @@
;Return the value stored in accumulator AC2 and AC1 (which are the return
registers)
ret
- END
--
J"org Wunsch Unix support engineer
address@hidden http://www.interface-systems.de/~j/
- [avr-gcc-list] AVR223 for GCC, ramnath, 2003/02/16
- Re: [avr-gcc-list] AVR223 for GCC, ramnath, 2003/02/16
- Re: [avr-gcc-list] AVR223 for GCC,
Joerg Wunsch <=
- [avr-gcc-list] How about "C": AVR306 for GCC, WAKAME, Nobukazu, 2003/02/27
- Re: [avr-gcc-list] How about "C": AVR306 for GCC, Joerg Wunsch, 2003/02/27
- [avr-gcc-list] Re: How about "C": AVR306 for GCC, WAKAME, Nobukazu, 2003/02/27
- Re: [avr-gcc-list] Re: How about "C": AVR306 for GCC, Joerg Wunsch, 2003/02/27
- [avr-gcc-list] Re: How about "C": AVR306 for GCC, WAKAME, Nobukazu, 2003/02/27
- Re: [avr-gcc-list] Re: How about "C": AVR306 for GCC, Sander Pool, 2003/02/27
- [avr-gcc-list] Re: How about "C": AVR306 for GCC, WAKAME, Nobukazu, 2003/02/27
[avr-gcc-list] Re: AVR223 for GCC, WAKAME, Nobukazu, 2003/02/25
Re: [avr-gcc-list] AVR223 for GCC, ramnath, 2003/02/27