WEC-2013-Logo

This blog is the continuation of Windows Embedded Compact 2013 THUMB2 ARM pre UAL syntax and its equivalent UAL syntax blog post to cover the missing items.

Pre UAL syntax mnemonic UAL syntax mnemonic Remarks
stmia   r0!, {r7, r13, r14} stmia   r0!, {r7-r12}
str       sp, [r0], #4
str       lr, [r0], #4
You can’t access sp,lr and pc registers directly through stmia instruction.

ldmia   r0!, {r7, r13, r14}

ldmia   r0!, {r7-r12}
ldr       sp, [r0], #4
ldr       lr, [r0], #4

You can’t access sp,lr and pc registers directly through ldmia instruction.

mcr   p15, 0, r15, c7, c14, 0

mov    r1, r15
mcr     p15, 0, r1, c7, c14, 0

R15 or PC can’t be directly used in mcr instruction

msr   cpsr_c, #SYS_MODE

mov   r1, #SYS_MODE
msr   cpsr_c, r1

Expected register operant


Whenever you are trying to use co processor 15 you may get the warning as to use ISB, DSB  or DMB instruction. These instructions are called memory barrier instructions.

In some circumstances, processor optimizations such as speculative reads or out-of-order execution (as in the example above), are undesirable and can lead to unintended program behaviour.  In such situations it is necessary to insert barrier instructions into code where there is a requirement for stricter, ‘Classic ARM processor-like’ behaviour.  There are three types of barrier instructions.  For simplicity, note that the descriptions below are for a uni-processor environment:

  • A Data Synchronization Barrier (DSB) completes when all instructions before this instruction complete.
  • A Data Memory Barrier (DMB) ensures that all explicit memory accesses before the DMB instruction complete before any explicit memory accesses after the DMB instruction start.
  • An Instruction Synchronization Barrier (ISB) flushes the pipeline in the processor, so that all instructions following the ISB are fetched from cache or memory, after the ISB has been completed.

Note that the CP15 equivalent barrier instructions available in ARMv6 are deprecated in ARMv7. Therefore, if possible, it is recommended that any code that uses these instructions is migrated to use the new barrier instructions described above instead.

For example,

WEC 2013 THUMB2 ARM pre UAL syntax and its equivalent UAL syntax

Hope this will help you to resolve the pre UAL and UAL changes in Windows Embedded Compact 2013.