Debuggers and Profilers (219 products)
-
9/10
ccmalloc
"ccmalloc is a C/C++ memory profiler and memory leak tracer."... -
9/10
abcmusiex-debuginfo
"This package provides debug information for package abcmusiex. Debug... -
9/10
Komodo IDE
Komodo IDE 5 is a powerful, multi-platform, multi-language IDE for... -
9/10
WinAVR
WinAVR is a suite of executable, open source software development tools... -
9/10
cgdb
"cgdb is a lightweight, but fully functional cursesfrontend to gdb. The...
Forum
WINAVR BUG
Hello Folks
I am trying to use codevision function in WinAVR-20080610. I am using the following function for the same. But it seems to give the following error. Am i using some wrong version of Winavr or because i cant think of any coding error here. Is it known bug?
Quote:
**Compiling sja1000.c -> sja1000.o
avr-gcc.exe -I../../../include -I../../../include/AVR -mmcu=atmega64 -Wall -gdwarf-2 -Os -fsigned-char -fpack-struct -MD -MP -MT sja1000.o -MF dep/sja1000.o.d -c sja1000.c
sja1000.c: In function 'Write':
sja1000.c:55: error: impossible register constraint in 'asm'
make.exe: *** [sja1000.o] Error 1
Code:
extern inline unsigned peekb (farptr adr)
{
unsigned returned;
unsigned short scratch;
asm (
" pushl %2 \n"
" popw %w0 \n"
" popw %%fs \n"
" movzbl %%fs:(%w0),%1 \n"
: "=bSDB" (scratch), "=r" (returned)
: "g" (adr), "m" (*memory)
);
return returned;
}
Regards
vikram Varshney
[...]
I am trying to use codevision function in WinAVR-20080610. I am using the following function for the same. But it seems to give the following error. Am i using some wrong version of Winavr or because i cant think of any coding error here. Is it known bug?
Quote:
**Compiling sja1000.c -> sja1000.o
avr-gcc.exe -I../../../include -I../../../include/AVR -mmcu=atmega64 -Wall -gdwarf-2 -Os -fsigned-char -fpack-struct -MD -MP -MT sja1000.o -MF dep/sja1000.o.d -c sja1000.c
sja1000.c: In function 'Write':
sja1000.c:55: error: impossible register constraint in 'asm'
make.exe: *** [sja1000.o] Error 1
Code:
extern inline unsigned peekb (farptr adr)
{
unsigned returned;
unsigned short scratch;
asm (
" pushl %2 \n"
" popw %w0 \n"
" popw %%fs \n"
" movzbl %%fs:(%w0),%1 \n"
: "=bSDB" (scratch), "=r" (returned)
: "g" (adr), "m" (*memory)
);
return returned;
}
Regards
vikram Varshney
Date: November 13, 2008 at 06:25
Author:
vikram4
Last post: November 13, 2008 at 06:51
Replies: 1
embedding ASM in C
i took a digital filter code from cornell university website but when i try running it in winavr i get the error
" prog.c:161: error: expected string literal before '.' token"
the code is as follows
int filter1(int xx)
{
asm volatile
(
.macro mult_acc //error accurs here
muls r23, r21
add r31, r0
mul r22, r20
add r24, r0
adc r30, r1
adc r31, r27
mulsu r23, r20
add r30, r0
adc r31, r1
mulsu r21, r22
add r30, r0
adc r31, r1
.endm
push r20
push r21
clr r27
clr r24 //clear 24 bit result reg // msb to lsb => r31:r30:r24
clr r30
clr r31
lds R22, _B111
lds R23, _B111+1
ld R20, Y
ldd R21, Y+1
mult_acc
lds R22, _B112
lds R23, _B112+1
lds R20, _x11_1
lds R21, _x11_1+1
mult_acc
lds R22, _B113
lds R23, _B113+1
lds R20, _x11_2
lds R21, _x11_2+1
mult_acc
lds R22, _A112
lds R23, _A112+1
lds R20, _y11_1
lds R21, _y11_1+1
mult_acc
lds R22, _A113
lds R23, _A113+1
lds R20, _y11_2
lds R21, _y11_2+1
mult_acc
lds R20, _x11_1
lds R21, _x11_1+1
sts _x11_2, r20
sts _x11_2+1, R21
ld R20, Y
ldd R21, Y+1
sts _x11_1, r20
sts _x11_1+1, R21
lds R20, _y11_1
lds R21, _y11_1+1
sts _y11_2, R20
sts _y11_2+1, R21
sts _y11_1, r30
sts _y11_1+1, r31
lds R22, _B121
lds R23, _B121+1
lds R20, _y11_1
lds R21, _y11_1+1
clr r30
clr r31
mult_acc
lds R22, _B122
lds R23, _B122+1
lds R20, _x12_1
lds R21, _x12_1+1
mult_acc
lds R22, _B123
lds R23, _B123+1
lds R20, _x12_2
lds R21, _x12_2+1
mult_acc
lds R22, _A122
lds R23, _A122+1
lds R20, _y12_1
lds R21, _y12_1+1
mult_acc
lds R22, _A123
lds R23, _A123+1
lds R20, _y12_2
lds R21, _y12_2+1
mult_acc
lds R20, _x12_1
lds R21, _x12_1+1
sts _x12_2, r20
sts _x12_2+1, R21
lds R20, _y11_1
lds R21, _y11_1+1
sts _x12_1, r20
sts _x12_1+1, R21
lds R20, _y12_1
lds R21, _y12_1+1
sts _y12_2, R20
sts _y12_2+1, R21
sts _y12_1, r30
sts _y12_1+1, r31
pop r21
pop r20
)
}
[...]
" prog.c:161: error: expected string literal before '.' token"
the code is as follows
int filter1(int xx)
{
asm volatile
(
.macro mult_acc //error accurs here
muls r23, r21
add r31, r0
mul r22, r20
add r24, r0
adc r30, r1
adc r31, r27
mulsu r23, r20
add r30, r0
adc r31, r1
mulsu r21, r22
add r30, r0
adc r31, r1
.endm
push r20
push r21
clr r27
clr r24 //clear 24 bit result reg // msb to lsb => r31:r30:r24
clr r30
clr r31
lds R22, _B111
lds R23, _B111+1
ld R20, Y
ldd R21, Y+1
mult_acc
lds R22, _B112
lds R23, _B112+1
lds R20, _x11_1
lds R21, _x11_1+1
mult_acc
lds R22, _B113
lds R23, _B113+1
lds R20, _x11_2
lds R21, _x11_2+1
mult_acc
lds R22, _A112
lds R23, _A112+1
lds R20, _y11_1
lds R21, _y11_1+1
mult_acc
lds R22, _A113
lds R23, _A113+1
lds R20, _y11_2
lds R21, _y11_2+1
mult_acc
lds R20, _x11_1
lds R21, _x11_1+1
sts _x11_2, r20
sts _x11_2+1, R21
ld R20, Y
ldd R21, Y+1
sts _x11_1, r20
sts _x11_1+1, R21
lds R20, _y11_1
lds R21, _y11_1+1
sts _y11_2, R20
sts _y11_2+1, R21
sts _y11_1, r30
sts _y11_1+1, r31
lds R22, _B121
lds R23, _B121+1
lds R20, _y11_1
lds R21, _y11_1+1
clr r30
clr r31
mult_acc
lds R22, _B122
lds R23, _B122+1
lds R20, _x12_1
lds R21, _x12_1+1
mult_acc
lds R22, _B123
lds R23, _B123+1
lds R20, _x12_2
lds R21, _x12_2+1
mult_acc
lds R22, _A122
lds R23, _A122+1
lds R20, _y12_1
lds R21, _y12_1+1
mult_acc
lds R22, _A123
lds R23, _A123+1
lds R20, _y12_2
lds R21, _y12_2+1
mult_acc
lds R20, _x12_1
lds R21, _x12_1+1
sts _x12_2, r20
sts _x12_2+1, R21
lds R20, _y11_1
lds R21, _y11_1+1
sts _x12_1, r20
sts _x12_1+1, R21
lds R20, _y12_1
lds R21, _y12_1+1
sts _y12_2, R20
sts _y12_2+1, R21
sts _y12_1, r30
sts _y12_1+1, r31
pop r21
pop r20
)
}
Date: October 9, 2008 at 06:18
Author:
leoniuds
Last post: October 9, 2008 at 06:18
Replies: 0
Start a new discussion