EmbDev.net

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


Author: Joe Dupre (jdupre)
Posted on:

Rate this post
0 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

Author: Martin Thomas (Guest)
Posted on:

Rate this post
0 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

Author: Martin Thomas (Guest)
Posted on:

Rate this post
0 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

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.