linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Re: Compiling assembler file with ppc_405-gcc
  2004-06-11 16:28 Compiling assembler file with ppc_405-gcc Garcia Jérémie
@ 2004-06-11 16:25 ` Wolfgang Denk
  2004-06-12 23:19 ` T Michael Turney
  1 sibling, 0 replies; 10+ messages in thread
From: Wolfgang Denk @ 2004-06-11 16:25 UTC (permalink / raw)
  To: Garcia Jérémie; +Cc: linuxppc-embedded


In message <85E6ED5B5EC32F439702305CC417E12D9E2A78@email.3il.fr> you wrote:
>
> To compile this, I use the following lines in a makefile:
...
> ppcsiafn.o:
>       $(AS) $(CFLAGS_AS) -c $(SRC_PATH)/startup/init/ppcsiafn.s -o ppcsiafn.o
...
> After a lot of tests, here are my conclusions: the different "#include" are not considered by the compiler. Indeed, I tried to introduce compilation errors in the different ".h" files --> no difference in the result

You don't call a compiler. You just run the assembler.  The  assember
does  nothing else but assemble your code. It does NOT include things
like running a preprocessore or so.

> So I guess that but I don't know why : the character "#" is understood as a comment (equivalent to /* ...*/).

Maybe you want to check assembler syntax?

> To conclude : is there a specific compil option to give to gcc for it to understand the #include command?

"gcc" does know how to run a preprocessor. But you're not running  "gcc",
you're running "as" only.

> I checked the different linux assembler file and the #include is used. So why am I not able to use it?

Because your build rule is inappropriate for what you want to do?

Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Generally speaking, there are other ways to accomplish whatever it is
that you think you need ...                               - Doug Gwyn

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Compiling assembler file with ppc_405-gcc
@ 2004-06-11 16:28 Garcia Jérémie
  2004-06-11 16:25 ` Wolfgang Denk
  2004-06-12 23:19 ` T Michael Turney
  0 siblings, 2 replies; 10+ messages in thread
From: Garcia Jérémie @ 2004-06-11 16:28 UTC (permalink / raw)
  To: linuxppc-embedded


Hi everybody,
although I'm a newbie in Linux developement and even more in LinuxPPC development, I have to work on a Linux PPC assembler based application.
In order to achieve this, I need to compile an assembler file (ppcsiafn.s) which now gives nightmares ...
Below this line you can dicover this file:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
/*DESCRIPTION
This module contains chip-dependent routines written in assembly language.
*/

#include <linux/config.h>
#include <asm/processor.h>
#include <asm/cache.h>
#include <asm-ppc/ppc_asm.h>

#define _ASMLANGUAGE

.globl sidma_AsDmaRegSet_F
.globl sidma_AsDmaRegGet_F
.globl AsfnDmapolGet
[etc...  ]

.text

/*******************************************************************************
* sidmai_AsDmaRegSet_F(reg, val) --> Set specified "reg" with value "val"
*
* Return : N/A
*
* void sidma_AsDmaRegSet_F(uLong reg, uLong val)
*/
sidma_AsDmaRegSet_F:
       mflr r5
       bl next_inst
       next_inst:
       mflr r6
      add r6,r6,r3
      addi r6,r6,20

[etc...  ]

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

To compile this, I use the following lines in a makefile:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
AS = ppc_405-gcc
CFLAGS_AS = -gdwarf -mcpu=405 -mstrict-align -nostdinc -fvolatile -fno-builtin -fno-for-scope -P -x assembler - D__KERNEL__ -DCPU=PPC405 -DPRJ_BUILD $(ALLINCLUDE) -I$(SRC_PATH)/basic/services/include -I$(SRC_PATH)/basic/ascii/include -I$(SRC_PATH)/basic/hdwctl/include -I$(SRC_PATH)/basic/core/include -I$(SRC_PATH)/basic/hscx/include -I$(SRC_PATH)/basic/enet/include -I$(SRC_PATH)/eq/include -I$(SRC_PATH)/pzm/include -I$(SRC_PATH)/startup/init -I$(SRC_PATH)/startup/maint -O0 -DEQ_CODE
ppcsiafn.o:
      $(AS) $(CFLAGS_AS) -c $(SRC_PATH)/startup/init/ppcsiafn.s -o ppcsiafn.o
 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

nb: don't worry the CFLAGS_AS is on a single line in my makefile

All that things to get the following compilation result:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
$> make all
/home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s: Assembler messages:
/home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:83: Error: unsupported relocation against r5
/home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:86: Error: unsupported relocation against r6
/home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:87: Error: unsupported relocation against r6
/home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:87: Error: unsupported relocation against r6
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

After a lot of tests, here are my conclusions: the different "#include" are not considered by the compiler. Indeed, I tried to introduce compilation errors in the different ".h" files --> no difference in the result
If I suppress the # in the #include --> the compiler tells me that is not a valid op code
So I guess that but I don't know why : the character "#" is understood as a comment (equivalent to /* ...*/).

To conclude : is there a specific compil option to give to gcc for it to understand the #include command?
I checked the different linux assembler file and the #include is used. So why am I not able to use it?

Thanks for your help !

                                                                Jérémie


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: Compiling assembler file with ppc_405-gcc
@ 2004-06-11 16:44 Kerl, John
  0 siblings, 0 replies; 10+ messages in thread
From: Kerl, John @ 2004-06-11 16:44 UTC (permalink / raw)
  To: Garcia Jérémie, linuxppc-embedded


Unsupported relocation against r6 means, the assembler expects
a bare "6" & needs the #define r6 6.  This is in ppc_asm.tmpl,
included by ppc_asm.h, which you have.

The file extension should be .S, not .s.

Here is what I use:

*	.S file has #include "ppc_asm.h"
*	Assemble command is
	ppc_8xx-gcc -c -D__ASSEMBLY__ -I/path/to/arch/ppc/kernel whatever.S


> -----Original Message-----
> From: owner-linuxppc-embedded@lists.linuxppc.org
> [mailto:owner-linuxppc-embedded@lists.linuxppc.org]On Behalf Of Garcia
> Jérémie
> Sent: Friday, June 11, 2004 9:28 AM
> To: linuxppc-embedded@lists.linuxppc.org
> Subject: Compiling assembler file with ppc_405-gcc
>
>
>
> Hi everybody,
> although I'm a newbie in Linux developement and even more in
> LinuxPPC development, I have to work on a Linux PPC assembler
> based application.
> In order to achieve this, I need to compile an assembler file
> (ppcsiafn.s) which now gives nightmares ...
> Below this line you can dicover this file:
>
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>
> /*DESCRIPTION
> This module contains chip-dependent routines written in
> assembly language.
> */
>
> #include <linux/config.h>
> #include <asm/processor.h>
> #include <asm/cache.h>
> #include <asm-ppc/ppc_asm.h>
>
> #define _ASMLANGUAGE
>
> .globl sidma_AsDmaRegSet_F
> .globl sidma_AsDmaRegGet_F
> .globl AsfnDmapolGet
> [etc...  ]
>
> .text
>
> /*************************************************************
> ******************
> * sidmai_AsDmaRegSet_F(reg, val) --> Set specified "reg" with
> value "val"
> *
> * Return : N/A
> *
> * void sidma_AsDmaRegSet_F(uLong reg, uLong val)
> */
> sidma_AsDmaRegSet_F:
>        mflr r5
>        bl next_inst
>        next_inst:
>        mflr r6
>       add r6,r6,r3
>       addi r6,r6,20
>
> [etc...  ]
>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> <<<<<<<<<<<<<<<<<<
>
> To compile this, I use the following lines in a makefile:
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>
> AS = ppc_405-gcc
> CFLAGS_AS = -gdwarf -mcpu=405 -mstrict-align -nostdinc
> -fvolatile -fno-builtin -fno-for-scope -P -x assembler -
> D__KERNEL__ -DCPU=PPC405 -DPRJ_BUILD $(ALLINCLUDE)
> -I$(SRC_PATH)/basic/services/include
> -I$(SRC_PATH)/basic/ascii/include
> -I$(SRC_PATH)/basic/hdwctl/include
> -I$(SRC_PATH)/basic/core/include
> -I$(SRC_PATH)/basic/hscx/include
> -I$(SRC_PATH)/basic/enet/include -I$(SRC_PATH)/eq/include
> -I$(SRC_PATH)/pzm/include -I$(SRC_PATH)/startup/init
> -I$(SRC_PATH)/startup/maint -O0 -DEQ_CODE
> ppcsiafn.o:
>       $(AS) $(CFLAGS_AS) -c
> $(SRC_PATH)/startup/init/ppcsiafn.s -o ppcsiafn.o
>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> <<<<<<<<<
>
> nb: don't worry the CFLAGS_AS is on a single line in my makefile
>
> All that things to get the following compilation result:
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> >>>>>>>>>
> $> make all
> /home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:
> Assembler messages:
> /home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:83:
> Error: unsupported relocation against r5
> /home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:86:
> Error: unsupported relocation against r6
> /home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:87:
> Error: unsupported relocation against r6
> /home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:87:
> Error: unsupported relocation against r6
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> <<<<<<<<<<
>
> After a lot of tests, here are my conclusions: the different
> "#include" are not considered by the compiler. Indeed, I
> tried to introduce compilation errors in the different ".h"
> files --> no difference in the result
> If I suppress the # in the #include --> the compiler tells me
> that is not a valid op code
> So I guess that but I don't know why : the character "#" is
> understood as a comment (equivalent to /* ...*/).
>
> To conclude : is there a specific compil option to give to
> gcc for it to understand the #include command?
> I checked the different linux assembler file and the #include
> is used. So why am I not able to use it?
>
> Thanks for your help !
>
>
>   Jérémie
>
>


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: Compiling assembler file with ppc_405-gcc
@ 2004-06-11 16:55 Kerl, John
  2004-06-11 17:47 ` Wolfgang Denk
  0 siblings, 1 reply; 10+ messages in thread
From: Kerl, John @ 2004-06-11 16:55 UTC (permalink / raw)
  To: Wolfgang Denk, Garcia Jérémie; +Cc: linuxppc-embedded


No Wolfgang, read it again: he is running ppc_4xx-gcc.  It's in a
variable named $(AS), but he is running the C compiler.  It is
reasonable to expect #include and #define statements to work --
after all, the Linux build does this all the time!  As does the
u-boot build:

$ cd /opt/gx/u-boot
$ make
...
ppc_4xx-gcc -Wa,-gstabs -D__ASSEMBLY__ -g  -Os   -fPIC -ffixed-r14 -meabi
-D__KERNEL__ -DTEXT_BASE=0xFFF80000 -I/opt/gx/u-boot/include -fno-builtin
-ffreestanding -nostdinc -isystem /opt/eldk/usr/lib/gcc-lib/ppc-linux/2.95.4/include
-pipe  -DCONFIG_PPC -D__powerpc__ -DCONFIG_4xx -ffixed-r2 -ffixed-r29 -mstring
-Wa,-m405 -mcpu=405 -msoft-float -DCONFIG_440=1 -c -o init.o
/opt/gx/u-boot/board/avnet_440gx_eval/init.S

The gentleman has a legitimate request.




> -----Original Message-----
> From: owner-linuxppc-embedded@lists.linuxppc.org
> [mailto:owner-linuxppc-embedded@lists.linuxppc.org]On Behalf
> Of Wolfgang
> Denk
> Sent: Friday, June 11, 2004 9:26 AM
> To: Garcia Jérémie
> Cc: linuxppc-embedded@lists.linuxppc.org
> Subject: Re: Compiling assembler file with ppc_405-gcc
>
>
>
> In message
> <85E6ED5B5EC32F439702305CC417E12D9E2A78@email.3il.fr> you wrote:
> >
> > To compile this, I use the following lines in a makefile:
> ...
> > ppcsiafn.o:
> >       $(AS) $(CFLAGS_AS) -c
> $(SRC_PATH)/startup/init/ppcsiafn.s -o ppcsiafn.o
> ...
> > After a lot of tests, here are my conclusions: the
> different "#include" are not considered by the compiler.
> Indeed, I tried to introduce compilation errors in the
> different ".h" files --> no difference in the result
>
> You don't call a compiler. You just run the assembler.  The  assember
> does  nothing else but assemble your code. It does NOT include things
> like running a preprocessore or so.
>
> > So I guess that but I don't know why : the character "#" is
> understood as a comment (equivalent to /* ...*/).
>
> Maybe you want to check assembler syntax?
>
> > To conclude : is there a specific compil option to give to
> gcc for it to understand the #include command?
>
> "gcc" does know how to run a preprocessor. But you're not
> running  "gcc",
> you're running "as" only.
>
> > I checked the different linux assembler file and the
> #include is used. So why am I not able to use it?
>
> Because your build rule is inappropriate for what you want to do?
>
> Best regards,
>
> Wolfgang Denk
>
> --
> Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
> Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
> Generally speaking, there are other ways to accomplish whatever it is
> that you think you need ...                               - Doug Gwyn
>


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: Compiling assembler file with ppc_405-gcc
@ 2004-06-11 17:47 Kerl, John
  0 siblings, 0 replies; 10+ messages in thread
From: Kerl, John @ 2004-06-11 17:47 UTC (permalink / raw)
  To: Kerl, John, Wolfgang Denk, Garcia Jérémie; +Cc: linuxppc-embedded


Resending as plain text:

> No Wolfgang, read it again: he is running ppc_4xx-gcc.  It's in a
> variable named $(AS), but he is running the C compiler.  It is
> reasonable to expect #include and #define statements to work --
> after all, the Linux build does this all the time!  As does the
> u-boot build:
>
> $ cd /opt/gx/u-boot
> $ make
> ...
> ppc_4xx-gcc -Wa,-gstabs -D__ASSEMBLY__ -g  -Os   -fPIC
> -ffixed-r14 -meabi
> -D__KERNEL__ -DTEXT_BASE=0xFFF80000 -I/opt/gx/u-boot/include
> -fno-builtin
> -ffreestanding -nostdinc -isystem
> /opt/eldk/usr/lib/gcc-lib/ppc-linux/2.95.4/include
> -pipe  -DCONFIG_PPC -D__powerpc__ -DCONFIG_4xx -ffixed-r2
> -ffixed-r29 -mstring
> -Wa,-m405 -mcpu=405 -msoft-float -DCONFIG_440=1 -c -o init.o
> /opt/gx/u-boot/board/avnet_440gx_eval/init.S
>
> The gentleman has a legitimate request.
>
>
>
>
> > -----Original Message-----
> > From: owner-linuxppc-embedded@lists.linuxppc.org
> > [mailto:owner-linuxppc-embedded@lists.linuxppc.org]On Behalf
> > Of Wolfgang
> > Denk
> > Sent: Friday, June 11, 2004 9:26 AM
> > To: Garcia Jérémie
> > Cc: linuxppc-embedded@lists.linuxppc.org
> > Subject: Re: Compiling assembler file with ppc_405-gcc
> >
> >
> >
> > In message
> > <85E6ED5B5EC32F439702305CC417E12D9E2A78@email.3il.fr> you wrote:
> > >
> > > To compile this, I use the following lines in a makefile:
> > ...
> > > ppcsiafn.o:
> > >       $(AS) $(CFLAGS_AS) -c
> > $(SRC_PATH)/startup/init/ppcsiafn.s -o ppcsiafn.o
> > ...
> > > After a lot of tests, here are my conclusions: the
> > different "#include" are not considered by the compiler.
> > Indeed, I tried to introduce compilation errors in the
> > different ".h" files --> no difference in the result
> >
> > You don't call a compiler. You just run the assembler.  The
>  assember
> > does  nothing else but assemble your code. It does NOT
> include things
> > like running a preprocessore or so.
> >
> > > So I guess that but I don't know why : the character "#" is
> > understood as a comment (equivalent to /* ...*/).
> >
> > Maybe you want to check assembler syntax?
> >
> > > To conclude : is there a specific compil option to give to
> > gcc for it to understand the #include command?
> >
> > "gcc" does know how to run a preprocessor. But you're not
> > running  "gcc",
> > you're running "as" only.
> >
> > > I checked the different linux assembler file and the
> > #include is used. So why am I not able to use it?
> >
> > Because your build rule is inappropriate for what you want to do?
> >
> > Best regards,
> >
> > Wolfgang Denk
> >
> > --
> > Software Engineering:  Embedded and Realtime Systems,
> Embedded Linux
> > Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email:
> wd@denx.de
> > Generally speaking, there are other ways to accomplish
> whatever it is
> > that you think you need ...                               -
> Doug Gwyn
> >
>
>


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Compiling assembler file with ppc_405-gcc
  2004-06-11 16:55 Kerl, John
@ 2004-06-11 17:47 ` Wolfgang Denk
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Denk @ 2004-06-11 17:47 UTC (permalink / raw)
  To: Kerl, John; +Cc: Garcia Jérémie, linuxppc-embedded


In message <E8E581FE5C58614B85A22AF2A495C64909E410@uschd00mx11usr.AVNET.COM> you wrote:
>
> No Wolfgang, read it again: he is running ppc_4xx-gcc.  It's in a
> variable named $(AS), but he is running the C compiler.  It is

You're right. Sorry.

> reasonable to expect #include and #define statements to work --
> after all, the Linux build does this all the time!  As does the
> u-boot build:
>
> $ cd /opt/gx/u-boot
> $ make
> ...
> ppc_4xx-gcc -Wa,-gstabs -D__ASSEMBLY__ -g  -Os   -fPIC -ffixed-r14 -meabi
> -D__KERNEL__ -DTEXT_BASE=0xFFF80000 -I/opt/gx/u-boot/include -fno-builtin
> -ffreestanding -nostdinc -isystem /opt/eldk/usr/lib/gcc-lib/ppc-linux/2.95.4/include
> -pipe  -DCONFIG_PPC -D__powerpc__ -DCONFIG_4xx -ffixed-r2 -ffixed-r29 -mstring
> -Wa,-m405 -mcpu=405 -msoft-float -DCONFIG_440=1 -c -o init.o
> /opt/gx/u-boot/board/avnet_440gx_eval/init.S

Mind the file name - <name>.S --> upper case letter 'S'

> > > ppcsiafn.o:
> > >       $(AS) $(CFLAGS_AS) -c
> > $(SRC_PATH)/startup/init/ppcsiafn.s -o ppcsiafn.o

And here: <name>.s --> lower case letter 's'.


>From the GNU manual:

	`FILE.s'
	     Assembler code.

	`FILE.S'
	     Assembler code which must be preprocessed.



Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Nobody trips over mountains. It is the small pebble that  causes  you
to  stumble.  Pass all the pebbles in your path and you will find you
have crossed the mountain.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: Compiling assembler file with ppc_405-gcc
  2004-06-11 16:28 Compiling assembler file with ppc_405-gcc Garcia Jérémie
  2004-06-11 16:25 ` Wolfgang Denk
@ 2004-06-12 23:19 ` T Michael Turney
  1 sibling, 0 replies; 10+ messages in thread
From: T Michael Turney @ 2004-06-12 23:19 UTC (permalink / raw)
  To: Garcia Jérémie, linuxppc-embedded


When I'm having trouble with assembly language code
I like to let the C compiler show me syntax-clean
assembly code.

Write the function in C and see what the generated
code looks like.
Cheers,
T.mike

-----Original Message-----
From: owner-linuxppc-embedded@lists.linuxppc.org
[mailto:owner-linuxppc-embedded@lists.linuxppc.org]On Behalf Of Garcia
Jérémie
Sent: Friday, June 11, 2004 9:28 AM
To: linuxppc-embedded@lists.linuxppc.org
Subject: Compiling assembler file with ppc_405-gcc



Hi everybody,
although I'm a newbie in Linux developement and even more in LinuxPPC development, I have to work on a Linux PPC assembler based application.
In order to achieve this, I need to compile an assembler file (ppcsiafn.s) which now gives nightmares ...
Below this line you can dicover this file:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
/*DESCRIPTION
This module contains chip-dependent routines written in assembly language.
*/

#include <linux/config.h>
#include <asm/processor.h>
#include <asm/cache.h>
#include <asm-ppc/ppc_asm.h>

#define _ASMLANGUAGE

.globl sidma_AsDmaRegSet_F
.globl sidma_AsDmaRegGet_F
.globl AsfnDmapolGet
[etc...  ]

.text

/*******************************************************************************
* sidmai_AsDmaRegSet_F(reg, val) --> Set specified "reg" with value "val"
*
* Return : N/A
*
* void sidma_AsDmaRegSet_F(uLong reg, uLong val)
*/
sidma_AsDmaRegSet_F:
       mflr r5
       bl next_inst
       next_inst:
       mflr r6
      add r6,r6,r3
      addi r6,r6,20

[etc...  ]

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

To compile this, I use the following lines in a makefile:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
AS = ppc_405-gcc
CFLAGS_AS = -gdwarf -mcpu=405 -mstrict-align -nostdinc -fvolatile -fno-builtin -fno-for-scope -P -x assembler - D__KERNEL__ -DCPU=PPC405 -DPRJ_BUILD $(ALLINCLUDE) -I$(SRC_PATH)/basic/services/include -I$(SRC_PATH)/basic/ascii/include -I$(SRC_PATH)/basic/hdwctl/include -I$(SRC_PATH)/basic/core/include -I$(SRC_PATH)/basic/hscx/include -I$(SRC_PATH)/basic/enet/include -I$(SRC_PATH)/eq/include -I$(SRC_PATH)/pzm/include -I$(SRC_PATH)/startup/init -I$(SRC_PATH)/startup/maint -O0 -DEQ_CODE
ppcsiafn.o:
      $(AS) $(CFLAGS_AS) -c $(SRC_PATH)/startup/init/ppcsiafn.s -o ppcsiafn.o
 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

nb: don't worry the CFLAGS_AS is on a single line in my makefile

All that things to get the following compilation result:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
$> make all
/home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s: Assembler messages:
/home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:83: Error: unsupported relocation against r5
/home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:86: Error: unsupported relocation against r6
/home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:87: Error: unsupported relocation against r6
/home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:87: Error: unsupported relocation against r6
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

After a lot of tests, here are my conclusions: the different "#include" are not considered by the compiler. Indeed, I tried to introduce compilation errors in the different ".h" files --> no difference in the result
If I suppress the # in the #include --> the compiler tells me that is not a valid op code
So I guess that but I don't know why : the character "#" is understood as a comment (equivalent to /* ...*/).

To conclude : is there a specific compil option to give to gcc for it to understand the #include command?
I checked the different linux assembler file and the #include is used. So why am I not able to use it?

Thanks for your help !

                                                                Jr mie


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: Compiling assembler file with ppc_405-gcc
@ 2004-06-14  9:31 Garcia Jérémie
  0 siblings, 0 replies; 10+ messages in thread
From: Garcia Jérémie @ 2004-06-14  9:31 UTC (permalink / raw)
  To: linuxppc-embedded


Thanks for your help everybody!
I'm still working on my problem with your informations.
I'll tell you whatever happens.
Thanks again!

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Compiling assembler file with ppc_405-gcc
  2004-06-14 11:15 Garcia Jérémie
@ 2004-06-14 10:24 ` Wolfgang Denk
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Denk @ 2004-06-14 10:24 UTC (permalink / raw)
  To: Garcia Jérémie; +Cc: linuxppc-embedded


In message <85E6ED5B5EC32F439702305CC417E12D9E2A7D@email.3il.fr> you wrote:
>
>   --> I've included in this file:
>          #include <linux/config.h>
>          #include <asm/processor.h>
>          #include <asm/cache.h>
>          #include <asm-ppc/ppc_asm.h>
>          #include "ppcbslit.h"
>
>          [ppcbslit.h is a file which is supposed to contain a lot of
> #define
>           that I need in many files of my project. At the beggining of
> this
>           file, I have included:
>               #include <stdio.h>
>               #include <string.h>
>               #include <sys/types.h>
>               #include <sys/stat.h>
>               #include <fcntl.h>
>               #include <sys/ioctl.h>
>               #include <unistd.h>
>               #include <linux/ctype.h>                      ]

You should NOT include standard C header files in a assembler program!

assembler != C

> Results:
> ========
>    --> I don't know why but the #include of my assembler file are now
>        considered (a compilation option maybe... -x assembler??)

This is because your file now has a ".S" suffix instead  of  ".s"  as
before. Read the GCC manual about details!

>    --> But now there is the following problem ; I got hundreds of
> errors.
>        I report below a little part of them:
> /opt/hardhat/devkit/ppc/405/target/usr/include/stdio.h: Assembler
> messages:
> /opt/hardhat/devkit/ppc/405/target/usr/include/stdio.h:30: Error:
> Unrecognized opcode: `__begin_decls'
> /home/jgarcia/Desktop/kernel/ssc/StdLib/local/stddef.h:201: Error:
> Unrecognized opcode: `typedef'
> /opt/hardhat/devkit/ppc/405/target/usr/include/bits/stat.h:38: Error:
> Unrecognized opcode: `__dev_t'
> /home/jgarcia/Desktop/kernel/ssc/basic/services/include/ppcbslit.h:164:
> Error: Unrecognized opcode: `int'
> /opt/hardhat/devkit/ppc/405/target/usr/include/unistd.h:688: Error:
> Unrecognized opcode: `extern'

This is because you include C header files in assember code. You must
not do that.

>   --> I found a way to prevent those errors... I put all my #define that
> I need in my assembler file. But you'll understand that it's a very
> restrictive way of programming and I'd like to find a better solution
> cause I'm talkin' about a hundred of #define...so...

If you have the C includes in one of your private header  files,  you
can put a "#ifndef __ASSEMBLY__" / "#endif" around them.

Otherwise just clean up your code and don't use  C  headers  in  your
assembler file.

Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Landing: a controlled mid-air collision with a planet.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: Compiling assembler file with ppc_405-gcc
@ 2004-06-14 11:15 Garcia Jérémie
  2004-06-14 10:24 ` Wolfgang Denk
  0 siblings, 1 reply; 10+ messages in thread
From: Garcia Jérémie @ 2004-06-14 11:15 UTC (permalink / raw)
  To: linuxppc-embedded; +Cc: John.Kerl, wd


I tried a lot of things this morning but my problem remains in a different way.
With your help I decided to do this:

Changes:
========
  --> I renamed my assembler file ppcsiafn.s with ppcsiafn.S and I reported it in my Makefile
  --> I have susppressed a lot ok compilation option and now I only have:
      CFLAGS_AS = -gdwarf -mcpu=405 -nostdinc -Wall -D__KERNEL__
                  -D__ASSEMBLY__ $(ALLINCLUDE) -O0
      [ALLINCLUDE contains the paths that I need]
  --> I've included in this file:
         #include <linux/config.h>
         #include <asm/processor.h>
         #include <asm/cache.h>
         #include <asm-ppc/ppc_asm.h>
         #include "ppcbslit.h"

         [ppcbslit.h is a file which is supposed to contain a lot of #define
          that I need in many files of my project. At the beggining of this
          file, I have included:
              #include <stdio.h>
              #include <string.h>
              #include <sys/types.h>
              #include <sys/stat.h>
              #include <fcntl.h>
              #include <sys/ioctl.h>
              #include <unistd.h>
              #include <linux/ctype.h>                      ]

Results:
========
   --> I don't know why but the #include of my assembler file are now
       considered (a compilation option maybe... -x assembler??)
   --> But now there is the following problem ; I got hundreds of errors.
       I report below a little part of them:
/opt/hardhat/devkit/ppc/405/target/usr/include/stdio.h: Assembler messages:
/opt/hardhat/devkit/ppc/405/target/usr/include/stdio.h:30: Error: Unrecognized opcode: `__begin_decls'
/home/jgarcia/Desktop/kernel/ssc/StdLib/local/stddef.h:201: Error: Unrecognized opcode: `typedef'
/opt/hardhat/devkit/ppc/405/target/usr/include/bits/stat.h:38: Error: Unrecognized opcode: `__dev_t'
/home/jgarcia/Desktop/kernel/ssc/basic/services/include/ppcbslit.h:164: Error: Unrecognized opcode: `int'
/opt/hardhat/devkit/ppc/405/target/usr/include/unistd.h:688: Error: Unrecognized opcode: `extern'

  --> I found a way to prevent those errors... I put all my #define that I need in my assembler file. But you'll understand that it's a very restrictive way of programming and I'd like to find a better solution cause I'm talkin' about a hundred of #define...so...


One more time tks a lot for helping the newbie that I am !



> -----Original Message-----
> From: owner-linuxppc-embedded@lists.linuxppc.org
> [mailto:owner-linuxppc-embedded@lists.linuxppc.org]On Behalf Of Kerl,
> John
> Sent: Friday, June 11, 2004 9:44 AM
> To: Garcia Jérémie; linuxppc-embedded@lists.linuxppc.org
> Subject: RE: Compiling assembler file with ppc_405-gcc
>
>
>
> Unsupported relocation against r6 means, the assembler expects
> a bare "6" & needs the #define r6 6.  This is in ppc_asm.tmpl,
> included by ppc_asm.h, which you have.
>
> The file extension should be .S, not .s.
>
> Here is what I use:
>
> *     .S file has #include "ppc_asm.h"
> *     Assemble command is
>       ppc_8xx-gcc -c -D__ASSEMBLY__
> -I/path/to/arch/ppc/kernel whatever.S
>
>
> > -----Original Message-----
> > From: owner-linuxppc-embedded@lists.linuxppc.org
> > [mailto:owner-linuxppc-embedded@lists.linuxppc.org]On
> Behalf Of Garcia
> > Jérémie
> > Sent: Friday, June 11, 2004 9:28 AM
> > To: linuxppc-embedded@lists.linuxppc.org
> > Subject: Compiling assembler file with ppc_405-gcc
> >
> >
> >
> > Hi everybody,
> > although I'm a newbie in Linux developement and even more in
> > LinuxPPC development, I have to work on a Linux PPC assembler
> > based application.
> > In order to achieve this, I need to compile an assembler file
> > (ppcsiafn.s) which now gives nightmares ...
> > Below this line you can dicover this file:
> >
> > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> > >>>>>>>>>>>>>>>
> > /*DESCRIPTION
> > This module contains chip-dependent routines written in
> > assembly language.
> > */
> >
> > #include <linux/config.h>
> > #include <asm/processor.h>
> > #include <asm/cache.h>
> > #include <asm-ppc/ppc_asm.h>
> >
> > #define _ASMLANGUAGE
> >
> > .globl sidma_AsDmaRegSet_F
> > .globl sidma_AsDmaRegGet_F
> > .globl AsfnDmapolGet
> > [etc...  ]
> >
> > .text
> >
> > /*************************************************************
> > ******************
> > * sidmai_AsDmaRegSet_F(reg, val) --> Set specified "reg" with
> > value "val"
> > *
> > * Return : N/A
> > *
> > * void sidma_AsDmaRegSet_F(uLong reg, uLong val)
> > */
> > sidma_AsDmaRegSet_F:
> >        mflr r5
> >        bl next_inst
> >        next_inst:
> >        mflr r6
> >       add r6,r6,r3
> >       addi r6,r6,20
> >
> > [etc...  ]
> >
> > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> > <<<<<<<<<<<<<<<<<<
> >
> > To compile this, I use the following lines in a makefile:
> > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> > >>>>>>>>>>
> > AS = ppc_405-gcc
> > CFLAGS_AS = -gdwarf -mcpu=405 -mstrict-align -nostdinc
> > -fvolatile -fno-builtin -fno-for-scope -P -x assembler -
> > D__KERNEL__ -DCPU=PPC405 -DPRJ_BUILD $(ALLINCLUDE)
> > -I$(SRC_PATH)/basic/services/include
> > -I$(SRC_PATH)/basic/ascii/include
> > -I$(SRC_PATH)/basic/hdwctl/include
> > -I$(SRC_PATH)/basic/core/include
> > -I$(SRC_PATH)/basic/hscx/include
> > -I$(SRC_PATH)/basic/enet/include -I$(SRC_PATH)/eq/include
> > -I$(SRC_PATH)/pzm/include -I$(SRC_PATH)/startup/init
> > -I$(SRC_PATH)/startup/maint -O0 -DEQ_CODE
> > ppcsiafn.o:
> >       $(AS) $(CFLAGS_AS) -c
> > $(SRC_PATH)/startup/init/ppcsiafn.s -o ppcsiafn.o
> >
> > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> > <<<<<<<<<
> >
> > nb: don't worry the CFLAGS_AS is on a single line in my makefile
> >
> > All that things to get the following compilation result:
> > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> > >>>>>>>>>
> > $> make all
> > /home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:
> > Assembler messages:
> > /home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:83:
> > Error: unsupported relocation against r5
> > /home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:86:
> > Error: unsupported relocation against r6
> > /home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:87:
> > Error: unsupported relocation against r6
> > /home/jgarcia/Desktop/kernel/ssc/startup/init/ppcsiafn.s:87:
> > Error: unsupported relocation against r6
> > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> > <<<<<<<<<<
> >
> > After a lot of tests, here are my conclusions: the different
> > "#include" are not considered by the compiler. Indeed, I
> > tried to introduce compilation errors in the different ".h"
> > files --> no difference in the result
> > If I suppress the # in the #include --> the compiler tells me
> > that is not a valid op code
> > So I guess that but I don't know why : the character "#" is
> > understood as a comment (equivalent to /* ...*/).
> >
> > To conclude : is there a specific compil option to give to
> > gcc for it to understand the #include command?
> > I checked the different linux assembler file and the #include
> > is used. So why am I not able to use it?
> >
> > Thanks for your help !
> >
> >
> >   Jérémie
> >
> >
>
>

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-06-14 11:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-11 16:28 Compiling assembler file with ppc_405-gcc Garcia Jérémie
2004-06-11 16:25 ` Wolfgang Denk
2004-06-12 23:19 ` T Michael Turney
  -- strict thread matches above, loose matches on Subject: below --
2004-06-11 16:44 Kerl, John
2004-06-11 16:55 Kerl, John
2004-06-11 17:47 ` Wolfgang Denk
2004-06-11 17:47 Kerl, John
2004-06-14  9:31 Garcia Jérémie
2004-06-14 11:15 Garcia Jérémie
2004-06-14 10:24 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).