Beginning to work on a somewhat larger complex function and I need to
store a whole bunch of variables on the stack.
So my first approach was as follows...
.equ x1, 148
then in the code:
cfldr32 c0, [sp, #x1]
so far...so good, or so I thought...
Compiler complains to me that it wants an offset! Apparently it does
not allow me to use a symbol defined via .equ as the offset.
So question is, is there a way to do the above? I seriously do not
want to hardcode 20 or so local variable offsets across a couple
hundred lines of code...it'll be a maintenance nightmare!
Thanks,
--
Stephan
2003 Yamaha R6
kimi no koto omoidasu hi nante nai no wa
kimi no koto wasureta toki ga nai kara
I'm not sure I understood what are you trying to do BTW you could try
the following (not tested):
CASE A
-------
.x1:
.word 148
cfldr32 c0, [sp, .x1]
CASE B
-------
#define X1 148
cfldr32 c0, [sp, #X1]
Ciao
--
_
.-._.=\-.
(_)=='(_)____Moto Guzzi V65 Lario_&_Honda CN250________/ helix \___
>> So my first approach was as follows...
>>
>> .equ x1, 148
>>
>> then in the code:
>>
>> cfldr32 c0, [sp, #x1]
>>
>> so far...so good, or so I thought...
>>
>> Compiler complains to me that it wants an offset! Apparently it does
>> not allow me to use a symbol defined via .equ as the offset.
>>
>> So question is, is there a way to do the above? I seriously do not
>> want to hardcode 20 or so local variable offsets across a couple
>> hundred lines of code...it'll be a maintenance nightmare!
>>
>> Thanks,
>>
>> --
>> Stephan
>> 2003 Yamaha R6
>
>I'm not sure I understood what are you trying to do BTW you could try
>the following (not tested):
>
No luck with either one =(
basically what I am trying to do is easy.
I have a lot of local variables all on the stack.
Instead of going around always doing this:
clfdr32 c0, [sp, #148]
clfdr32 c1, [sp, #152]
clfdr32 c2, [sp, #156]
clfdr32 c3, [sp, #160]
clfdr32 c4, [sp, #164]
clfdr32 c5, [sp, #168]
Do something like this:
clfdr32 c0, [sp, #x1]
clfdr32 c1, [sp, #x2]
clfdr32 c2, [sp, #x3]
clfdr32 c3, [sp, #y1]
clfdr32 c4, [sp, #y2]
clfdr32 c5, [sp, #y3]
Where x1,x2,x3,y1,y3,y3 are some set of symbols, #defines, or whatever
that contain the offset value.
Difference being that the first is a pure hell to maintain across a
large amount of lines of code and is not very readable. But the
compiler is fine with that...
The second case, much more readable, and if I ever need to for some
reason change the offset of a variable, I only need to change it in
one place and not every instruction it is used in. Just the compiler
doesn't appear to let me do that!
--
Stephan
2003 Yamaha R6
kimi no koto omoidasu hi nante nai no wa
I posted this reply a day ago via google groups -- don't know what
happened to it....
> .equ x1, 148
> cfldr32 c0, [sp, #x1]
> Compiler complains to me that it wants an offset! Apparently it does
> not allow me to use a symbol defined via .equ as the offset.
I could confirm the bug in binutils-2.16.1 and
this is fixed in binutils-2.17:
$ arm-elf-as --version
GNU assembler 2.17
$ arm-elf-as -mcpu=arm920+maverick -adhlns=try.lst try.S ; cat try.lst
1 # try.S
2 .text
3 .global _testfn
4 .func _testfn
5
6 .equ x1,20
7 .equ x2,x1+4
8 _testfn:
9 0000 05159DED cfldr32 cr1,[sp,#x1]
10 0004 07159DED cfldr32 cr1,[sp,#(x2+4)]
11 0008 0635BDEC cfldr32 cr3,[sp],#x2
12 000c 0835BDEC cfldr32 cr3,[sp],#(x1+12)
13
15 .endfunc
16 .end
DEFINED SYMBOLS
try.S:8 .text:00000000 _testfn
try.S:6 *ABS*:00000014 x1
try.S:7 *ABS*:00000018 x2
try.S:9 .text:00000000 $a
NO UNDEFINED SYMBOLS
Cheers
--
Manfred
Ill be creating a free OpSys , i call New Forth .
There will be 20 keys around the LCD , called SOFT keys .
You can get real power by assigning a chain of threads to
each key . You can assemble low level , but at a hi level !
I only need to create a small amt of code , then i'll use that
to bootstrap the remander of OpSys .
But i will never use C++ , nor Delphi , nor Linux , i have
no patience for such Luddite time wasters ...