STM - Get assembler error when updating base register using ^

stmia r0!, {r1-r14}^

I'm getting an error on the above instruction, but don't understand why. Can anyone help? If you could point me to where it states that this is illegal, I'd appreciate that also. Thanks.

Reply to
Michael
Loading thread data ...

I assume this question is for the ARM instruction set -- but you don't say which ARM version. The ARM7TDMI Data Sheet (August 1995) says, in section 4.11.4 (Use of the S bit, with LDM/STM) that "base write-back should not be used" when R15 is not in the register list and the S bit is set (i.e. the ^ is used), just as in your case.

The Data Sheet does not give a reason for this prohibition, but I guess it has to do with the fact that this instruction (thanks to the ^ modifier) deals with two register sets, the User bank registers (transferred) and the current-mode registers (the Data Sheet does not explicitly say so, but I assume that the base register, here R0, is always the current-mode register, not the User bank register).

HTH

--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .
Reply to
Niklas Holsti

Thanks, but it generates the same error msg even if you specify r15 in the list. And sorry, yes, I'm referring to the ARM processor. Any other ideas?

Reply to
Michael

Op Fri, 29 Aug 2008 06:12:21 +0200 schreef Michael :

My ARM ARM (from 2005) only specifies two forms of STM in ARM mode:

STM{} {!}, STM{} , ^

Your form conforms to none of these.

--
Gemaakt met Opera's revolutionaire e-mailprogramma:  
http://www.opera.com/mail/
Reply to
Boudewijn Dijkstra

There are different versions of the ARM processor, and you still did not tell which.

Are you running in a mode that is not using the user register set (not user or system)? The ^ modifier temporarily accesses the user register set from a privileged mode.

You should also leave either the ^ modifier or the ! modifier out - it is not allowed to have both.

--

Tauno Voipio
tauno voipio (at) iki fi
Reply to
Tauno Voipio

I believe I'm using arm7tdmi. If both ^ and ! cannot be used at the same time, then you've answered my question - thanks. Too bad, because it would be nice to push registers onto the user mode stack, and update the stack pointer.

Reply to
Michael

In fact the statement "base write-back should not be used" appears in the same ARM7TDMI Data Sheet also when R15 is in the register list for STM and the ^ modifier is used, which agrees with what you experience. My apologies if my first reply implied that the presence of R15 is significant for STM (I looked only at the specific point in the Data Sheet that matched your instruction).

According to this Data Sheet, it seems that combining write-back and ^ is allowed for LDM with R15 in the register list. I don't know why LDM differs from STM on this point.

--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .
Reply to
Niklas Holsti

Thanks for your helpful comments.

Reply to
Michael

Assuming the stack pointer is in r0 and the stack is "full descending", how about this:

SUB r0, r0, #(14 * 4) STMIA r0, {r1-r14}^

Not exactly what you were looking for, but should work fine.

Regards

-- Marcus Harnisch Consultant

DOULOS - Developing Design Know-how VHDL * SystemC * Verilog * SystemVerilog * e * PSL * Perl * Tcl/Tk ARM Approved Training Centre (ATC)

Doulos Ltd., Central European Office, Garbsener Landstr. 10, 30419 Hannover Tel: +49 (0)511 2771340 mailto: snipped-for-privacy@doulos.com Fax: +49 (0)511 2771349 Web:

formatting link

This e-mail and any attachments are confidential and Doulos Ltd. reserves all rights of privilege in respect thereof. It is intended for the use of the addressee only. If you are not the intended recipient please delete it from your system, any use, disclosure, or copying of this document is unauthorised. The contents of this message may contain personal views which are not the views of Doulos Ltd., unless specifically stated.

Doulos Ltd is registered in England and Wales: Company No. 3723454. Registered Office: Brackley Close, Christchurch, Dorset BH23 6SE, UK. VAT No: GB 730 3456 59 Directors: Rob Hurley, John Aynsley, David Crowder

Reply to
Marcus Harnisch

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.