EmbDev.net

Forum: ARM programming with GCC/GNU tools impossible constraint in 'asm'


von Joe D. (jdupre)


Rate this post
useful
not useful
In the latest "gamma" sample project (20060804c) I am getting an error
when I set optimization to "0".  There is no error when optimization is
set to "s".  It does not make any sense to me:

Compiling C: main.c
arm-elf-gcc -c -mthumb -mcpu=arm7tdmi -mthumb-interwork -I. -gdwarf-2
-DROM_RUN -DVECTORS_IN_RAM -D__WinARM__ -D__WINARMSUBMDL_AT91SAM7S64__
-O0 -ffunction-sections -fdata-sections -Wall -Wcast-align -Wimplicit
-Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow
-Wunused -Wa,-adhlns=main.lst  -I./common -MD -MP -MF .dep/main.o.d
-Wnested-externs  -std=gnu99 main.c -o main.o
./common/swi.h: In function 'do_SWI':
./common/swi.h:19: warning: asm operand 1 probably doesn't match
constraints
./common/swi.h:19: error: impossible constraint in 'asm'
make: *** [main.o] Error 1



- Joe

von Martin Thomas (Guest)


Rate this post
useful
not useful
Joe Dupre wrote:
> In the latest "gamma" sample project (20060804c) I am getting an error
> when I set optimization to "0".  There is no error when optimization is
> set to "s".  It does not make any sense to me:
>
> Compiling C: main.c
> arm-elf-gcc -c -mthumb -mcpu=arm7tdmi -mthumb-interwork -I. -gdwarf-2
> -DROM_RUN -DVECTORS_IN_RAM -D__WinARM__ -D__WINARMSUBMDL_AT91SAM7S64__
> -O0 -ffunction-sections -fdata-sections -Wall -Wcast-align -Wimplicit
> -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow
> -Wunused -Wa,-adhlns=main.lst  -I./common -MD -MP -MF .dep/main.o.d
> -Wnested-externs  -std=gnu99 main.c -o main.o
> ./common/swi.h: In function 'do_SWI':
> ./common/swi.h:19: warning: asm operand 1 probably doesn't match
> constraints
> ./common/swi.h:19: error: impossible constraint in 'asm'
> make: *** [main.o] Error 1

Thanks for the report. I will try to reproduce the error here. So far I
have only tested with -Os.

Martin Thomas

von Martin Thomas (Guest)


Rate this post
useful
not useful
I can reproduce the problem with -O0 here, it works as expected with
-O1. It seems to be a problem with the SWI-Number as parameter ("I"
swi_num) which gets handled differently with optimization enabled. If
you do not nead the SWI-Number as function parameter you might use an
extra function/macro per SWI-Number and hardcode the number in the
inline-assembler-code. The source-code of the macros in the example
show a possible method. I do not know enough about the gcc-internals
maybe you can get a "real" solution by asking in the GNUARM yahoo-group,
the codesourcery support-forum or the gcc-mailing-list.

Martin Thomas

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.