2008-03-27 01:40:54     Declaring variables in asm (.S) files in uClinux 2007R1

Document created by Aaronwu Employee on Aug 5, 2013
Version 1Show Document
  • View in full screen mode

2008-03-27 01:40:54     Declaring variables in asm (.S) files in uClinux 2007R1

svs k (INDIA)

Message: 53092   

 

Hi ,

 

How do i need to declare a variable in .S files in the user application?

 

In asm (.S) file i have declared a variable in 2 ways,

 

WAY 1 -   .var  InputBufRdPtr;

 

WAY 2 -  .int  InputBufRdPtr;

 

It results in following error while compiling.

 

~~~~~~~~~~~~~~~~~~ WAY 1~~~~~~~~~~~~~~~~~~~~~~~~~~

 

AudioPlayBack/AudioAlgorithms/Equalizer/Equaliser.o: In function `_shelving':

AudioPlayBack/AudioAlgorithms/Equalizer/Equaliser.S:(.text+0x26): warning: warning: relocation references a different segment

AudioPlayBack/AudioAlgorithms/Equalizer/Equaliser.S:(.text+0x2a): warning: warning: relocation references a different segment

AudioPlayBack/AudioAlgorithms/Equalizer/Equaliser.o: In function `LoopEqBegin':

AudioPlayBack/AudioAlgorithms/Equalizer/Equaliser.S:(.text+0x3a): warning: warning: relocation references a different segment

AudioPlayBack/AudioAlgorithms/Equalizer/Equaliser.S:(.text+0x3e): warning: warning: relocation references a different segment

AudioPlayBack/AudioAlgorithms/Equalizer/Equaliser.S:(.text+0x78): warning: warning: relocation references a different segment

AudioPlayBack/AudioAlgorithms/Equalizer/Equaliser.S:(.text+0x7c): warning: warning: relocation references a different segment

AudioPlayBack/AudioAlgorithms/Equalizer/Equaliser.o: In function `_Equaliser':

AudioPlayBack/AudioAlgorithms/Equalizer/Equaliser.S:(.text+0x124): undefined reference to `InputBufRdPtr'

AudioPlayBack/AudioAlgorithms/Equalizer/Equaliser.S:(.text+0x124): warning: relocation references symbol not defined in the module

/opt/ucl2007R1/bfin-linux-uclibc/bin/../lib/gcc/bfin-linux-uclibc/4.1.1/../../../../bfin-linux-uclibc/bin/ld: final link failed: Nonrepresentable section on output

collect2: ld returned 1 exit status

make: *** [NP] Error 1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WAY 2~~~~~~~~~~~~~~~~~~~~~~~~

 

AudioPlayBack/AudioAlgorithms/Equalizer/Equaliser.o:(.text+0x0): undefined reference to `InputBufRdPtr'

AudioPlayBack/AudioAlgorithms/Equalizer/Equaliser.o:(.text+0x0): warning: cannot emit dynamic relocations in read-only section

/opt/ucl2007R1/bfin-linux-uclibc/bin/../lib/gcc/bfin-linux-uclibc/4.1.1/../../../../bfin-linux-uclibc/bin/ld: final link failed: Nonrepresentable section on output

collect2: ld returned 1 exit status

make: *** [NP] Error 1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

Kindly help.

 

 

 

 

QuoteReplyEditDelete

 

 

2008-03-27 02:17:58     Re: Declaring variables in asm (.S) files in uClinux 2007R1

Yi Li (CHINA)

Message: 53097    you can refer to the gnu "as" manual.

 

InputBufRdPtr:

.long 0;

 

should work.

QuoteReplyEditDelete

 

 

2008-03-27 07:54:46     Re: Declaring variables in asm (.S) files in uClinux 2007R1

svs k (INDIA)

Message: 53129   

 

Hi Yi Li,

 

Thanks for ur reply.

 

Declaring variables in asm files as you suggested cleared the issue.

 

How can a buffer be declared in asm (.S) files ?

 

I need to declare a buffer , int coeffBuff[10];

 

How can i do the above buffer declaration? Can I use this buffer in C by declaring it as extern.

 

Kindly suggest.

QuoteReplyEditDelete

 

 

2008-03-27 09:42:09     Re: Declaring variables in asm (.S) files in uClinux 2007R1

Mike Frysinger (UNITED STATES)

Message: 53144    the document Yi provided your covers this

QuoteReplyEditDelete

 

 

2008-03-27 21:59:40     Re: Declaring variables in asm (.S) files in uClinux 2007R1

sj tian (CHINA)

Message: 53194   

 

If I need to anounce a extern globle variable in isr.S file,  HOW  to deal with it in isr.S file.

 

For example:

 

I defined a globle variable i "unsigned short  a " in  a.h file, and I will use this globle variable  in isr.S file,  I have used ".extern _a" to declear this globle variable in isr.S file, but  it does not work, when compiling, the sysytem shown: "warning: variable a undefined" .

 

how to declare "unsigned short  a " in isr.S file? thanks!

QuoteReplyEditDelete

 

 

2008-03-27 23:04:57     Re: Declaring variables in asm (.S) files in uClinux 2007R1

Mike Frysinger (UNITED STATES)

Message: 53203    Yi gave you the document with the answer.  he also gave you an example for how to declare storage in assembly files:

InputBufRdPtr:

.long 0;

 

you could also just read the assembly code produced by gcc:

$ echo 'int a = 10;' > test.c

$ bfin-uclinux-gcc -S test.c -o -

Attachments

    Outcomes