13.07.2015 Views

Cortex-M0+ Devices Generic User Guide - Keil

Cortex-M0+ Devices Generic User Guide - Keil

Cortex-M0+ Devices Generic User Guide - Keil

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The <strong>Cortex</strong>-<strong>M0+</strong> Instruction Set3.4.5 LDM and STMLoad and Store Multiple registers.SyntaxLDM Rn{!}, reglistSTM Rn!, reglistwhere:RnIs the register on which the memory addresses are based.! Writeback suffix.reglistIs a list of one or more registers to be loaded or stored, enclosed in braces. It cancontain register ranges. It must be comma separated if it contains more than oneregister or register range, see Examples on page 3-17.LDMIA and LDMFD are synonyms for LDM. LDMIA refers to the base register being Incremented Aftereach access. LDMFD refers to its use for popping data from Full Descending stacks.STMIA and STMEA are synonyms for STM. STMIA refers to the base register being Incremented Aftereach access. STMEA refers to its use for pushing data onto Empty Ascending stacks.OperationLDM instructions load the registers in reglist with word values from memory addresses based onRn.STM instructions store the word values in the registers in reglist to memory addresses based onRn.The memory addresses used for the accesses are at 4-byte intervals ranging from the value inthe register specified by Rn to the value in the register specified by Rn + 4 * (n-1), where n is thenumber of registers in reglist. The accesses happens in order of increasing register numbers,with the lowest numbered register using the lowest memory address and the highest numberregister using the highest memory address. If the writeback suffix is specified, the value in theregister specified by Rn + 4 *n is written back to the register specified by Rn.RestrictionsIn these instructions:• reglist and Rn are limited to R0-R7.• the writeback suffix must always be used unless the instruction is an LDM where reglist alsocontains Rn, in which case the writeback suffix must not be used.• the value in the register specified by Rn must be word aligned. See Address alignment onpage 3-8 for more information.• for STM, if Rn appears in reglist, then it must be the first register in the list.Condition flagsThese instructions do not change the flags.ARM DUI 0662A Copyright © 2012 ARM. All rights reserved. 3-16ID041812Non-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!