knowledge-database (beta)

Current group: codewarrior.embedded

CW for ARM 1.22 inline asm error msg

CW for ARM 1.22 inline asm error msg  
Grant Killey
 Re: CW for ARM 1.22 inline asm error msg  
42Bastian Schick
 Re: CW for ARM 1.22 inline asm error msg  
Grant Killey
 Re: CW for ARM 1.22 inline asm error msg  
MW Ron
 Re: CW for ARM 1.22 inline asm error msg  
Grant Killey
 Re: CW for ARM 1.22 inline asm error msg  
MW Ron
From:Grant Killey
Subject:CW for ARM 1.22 inline asm error msg
Date:Tue, 07 Dec 2004 12:41:05 -0700
I'm useing inline asm in the form of:
__asm {

ldr SP, [gTmpStack]



}

and getting an error msg that I can't figure out how to get rid of. The
msg is:

"Error : (Serious) C2076E: illegal write to SP"

There is nothing illegal with this, other than the compiler deciding
that I don't know what I'm doing. I've tried to find a IDE switch or
inline pragma that will get around this problem but haven't had any luck.

Does anyone know how to get around this problem?
From:42Bastian Schick
Subject:Re: CW for ARM 1.22 inline asm error msg
Date:Fri, 10 Dec 2004 09:31:05 GMT
On Tue, 07 Dec 2004 12:41:05 -0700, Grant Killey
wrote:

>I'm useing inline asm in the form of:
>__asm {
>
> ldr SP, [gTmpStack]
>
>
>
> }
>
>and getting an error msg that I can't figure out how to get rid of. The
>msg is:
>
>"Error : (Serious) C2076E: illegal write to SP"
>
>There is nothing illegal with this, other than the compiler deciding
>that I don't know what I'm doing. I've tried to find a IDE switch or
>inline pragma that will get around this problem but haven't had any luck.
>
>Does anyone know how to get around this problem?

I am pretty sure that you are not allowed to change the SP in inline
assembly because the compiler has after this no idea where to find
local variables !

--
42Bastian
Do not email to bastian42@yahoo.com, it's a spam-only account :-)
Use @epost.de instead !
From:Grant Killey
Subject:Re: CW for ARM 1.22 inline asm error msg
Date:Fri, 10 Dec 2004 07:40:46 -0700
42Bastian Schick wrote:
> On Tue, 07 Dec 2004 12:41:05 -0700, Grant Killey
> wrote:
>
>
>>I'm useing inline asm in the form of:
>>__asm {
>>
>> ldr SP, [gTmpStack]
>>
>>
>>
>> }
>>
>>and getting an error msg that I can't figure out how to get rid of. The
>>msg is:
>>
>>"Error : (Serious) C2076E: illegal write to SP"
>>
>>There is nothing illegal with this, other than the compiler deciding
>>that I don't know what I'm doing. I've tried to find a IDE switch or
>>inline pragma that will get around this problem but haven't had any luck.
>>
>>Does anyone know how to get around this problem?
>
>
> I am pretty sure that you are not allowed to change the SP in inline
> assembly because the compiler has after this no idea where to find
> local variables !
>


Normally I would agree but I'm writing validation code that needs to
read and write the SP at certain points during the 'C' code to
physically prove that that stack (and other registers) are where they
should be after calling task initialization routines and after task
switching routines.

Grant Killey
From:MW Ron
Subject:Re: CW for ARM 1.22 inline asm error msg
Date:Thu, 16 Dec 2004 15:45:15 -0500
In article <31tqrfF3e50tcU1@individual.net>,
Grant Killey wrote:

>42Bastian Schick wrote:
>> On Tue, 07 Dec 2004 12:41:05 -0700, Grant Killey
>> wrote:
>>
>>
>>>I'm useing inline asm in the form of:
>>>__asm {
>>>
>>> ldr SP, [gTmpStack]
>>>
>>>
>>>
>>> }
>>>
>>>and getting an error msg that I can't figure out how to get rid of. The
>>>msg is:
>>>
>>>"Error : (Serious) C2076E: illegal write to SP"
>>>
>>>There is nothing illegal with this, other than the compiler deciding
>>>that I don't know what I'm doing. I've tried to find a IDE switch or
>>>inline pragma that will get around this problem but haven't had any luck.
>>>
>>>Does anyone know how to get around this problem?
>>
>>
>> I am pretty sure that you are not allowed to change the SP in inline
>> assembly because the compiler has after this no idea where to find
>> local variables !
>>
>
>
>Normally I would agree but I'm writing validation code that needs to
>read and write the SP at certain points during the 'C' code to
>physically prove that that stack (and other registers) are where they
>should be after calling task initialization routines and after task
>switching routines.

In the C code is the variable delcared as volatile?

Ron

--
Metrowerks Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and Metrowerks' staff
-- http://www.metrowerks.com/community --

Ron Liechty - MWRon@metrowerks.com - http://www.metrowerks.com
From:Grant Killey
Subject:Re: CW for ARM 1.22 inline asm error msg
Date:Fri, 17 Dec 2004 09:50:36 -0700
MW Ron wrote:
> In article <31tqrfF3e50tcU1@individual.net>,
> Grant Killey wrote:
>
>
>>42Bastian Schick wrote:
>>
>>>On Tue, 07 Dec 2004 12:41:05 -0700, Grant Killey
>>> wrote:
>>>
>>>
>>>
>>>>I'm useing inline asm in the form of:
>>>>__asm {
>>>>
>>>> ldr SP, [gTmpStack]
>>>>
>>>>
>>>>
>>>>}
>>>>
>>>>and getting an error msg that I can't figure out how to get rid of. The
>>>>msg is:
>>>>
>>>>"Error : (Serious) C2076E: illegal write to SP"
>>>>
>>>>There is nothing illegal with this, other than the compiler deciding
>>>>that I don't know what I'm doing. I've tried to find a IDE switch or
>>>>inline pragma that will get around this problem but haven't had any luck.
>>>>
>>>>Does anyone know how to get around this problem?
>>>
>>>
>>>I am pretty sure that you are not allowed to change the SP in inline
>>>assembly because the compiler has after this no idea where to find
>>>local variables !
>>>
>>
>>
>>Normally I would agree but I'm writing validation code that needs to
>>read and write the SP at certain points during the 'C' code to
>>physically prove that that stack (and other registers) are where they
>>should be after calling task initialization routines and after task
>>switching routines.
>
>
> In the C code is the variable delcared as volatile?
>
> Ron
>


Ron,
Assuming you are referring to "gTmpStack", I've tried it both with and
without a volatile. The error msg is always the same. The variable is
defined in the same file that I'm having the errors in.

What I'm trying to do is temporarily move the stack so I can create a
snapshot of it. Then I move it back to where it belongs, run some code,
call a subroutine and then take another snapshot of the stack and
compare the two copies for symmetry.

The only way to do this is to use inline asm so I can be sure that
nothing touches the SP and/or stack in-between
Grant
From:MW Ron
Subject:Re: CW for ARM 1.22 inline asm error msg
Date:Sat, 18 Dec 2004 11:41:42 -0500
In article <32gh2sF3m7kujU1@individual.net>,
Grant Killey wrote:


>>>>>and getting an error msg that I can't figure out how to get rid of. The
>>>>>msg is:
>>>>>
>>>>>"Error : (Serious) C2076E: illegal write to SP"
>>>>>

>Assuming you are referring to "gTmpStack", I've tried it both with and
>without a volatile. The error msg is always the same. The variable is
>defined in the same file that I'm having the errors in.
>
>What I'm trying to do is temporarily move the stack so I can create a
>snapshot of it. Then I move it back to where it belongs, run some code,
>call a subroutine and then take another snapshot of the stack and
>compare the two copies for symmetry.
>
>The only way to do this is to use inline asm so I can be sure that
>nothing touches the SP and/or stack in-between

All I can ask you to do is submit this as a bug report to support@metrowerks.com

Include and example that reproduces this error message they can sort it
out. I'm sorry I couldn't help online.

Ron

--
Metrowerks Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and Metrowerks' staff
-- http://www.metrowerks.com/community --

Ron Liechty - MWRon@metrowerks.com - http://www.metrowerks.com
   

Copyright © 2006 knowledge-database   -   All rights reserved