ARM-WEC-2013-logo

As a continuation of the WEC 2013 – THUMB2 porting considerations article, I would like to share few more considerations during THUMB2 porting specifically during compilation, assembler will through an error “pre UAL syntax not allowed” frequently in earlier CE version BSPs. I have listed the pre UAL syntax instruction and its equivalent for replacement. Below instruction list prepared based on compilation issues faced during WEC2013 porting on TI EVM DM37x BSP.

Pre UAL syntax mnemonic

UAL syntax mnemonic

Remarks

ldrmib r1, [r6], #1

strmib r1, [r4], #1

ldrgeb r1, [r6, #1]

ldrgtb r2, [r6, #2]

strgeh r1, [r4, #4]
strgth r2, [r4, #4]

ldrneh r2, [r6]

strneh r2, [r4]

bicnes r10,r11, #7

ldrbmi r1, [r6], #1

strbmi r1, [r4], #1

ldrbge r1, [r6, #1]

ldrbgt r2, [r6, #2]

strhge r1, [r4, #4]
strhgt r2, [r4, #4]

ldrhne r2, [r6]

strhne r2, [r4]

bicsne r10,r11, #7

Before each instruction, “IT” instruction has to be added. But it is automatically added by WEC2013 assembler. You can see the .lst file of the corresponding .s file.

Stmdb sp! {r3-r12, lr}

ldmia sp!, { r3-r12, lr}

stmdb sp!, {r3}

ldmia sp! , {r3}

push {r3 – r12, lr}

pop { r3 – r12, lr}

push {r3}

pop {r3}

If you are not changing the stmdb, ldmia to push and pop respectively, assembler is doing it automatically. You can see this in the .lst file

Passing single register operant to stmdb and ldmia is strictly not allowed. You have to replace with push and pop

Stmia r0!, { r7 – r14}

Stmia r0!, { r7 –r12}

Mov r1, sp

Stmia r0! , {r1}

Mov r1, lr

Stmia r0! {r1}

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

ldmia r0!, {r7 – r14}

Ldmia r0!, {r7 – r12}

Ldmia r0!, {r1}

Mov sp, r1

Ldmia r0!, {r1}

Mov lr, r1

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

Orr r11,r10,r9, lsl r5

Orr r11,r11,r7, lsl r2

Lsl r9, r5

Orr r11,r10, r6

Lsl r6, r7, r2

Orr r11, r11, r6

You can’t combine the orr and lsl operation in a single instruction.

DCD WFI

DCD SMI

Wfi

SMCEQ #0

Assembler doesn’t support a particular instruction by hard coding opcodes.

and r6, pc, r5

mov r7, pc

and r6, r7, r5

Can’t do arithmetic with pc directly

addne r11,pc #g_AdrTable- (.+8)

adrne r11, g_Adrtable

This kind of implementation not supported in Thumb2 mode

bic r1, r2, r2

bic r1, r2

THUMB2 mode replacement for bic

cmp r9, #OEM_HIGH_SECURITY_HS

moveq r0, #OEM_HIGH_SECURITY_HS

movne r0, #OEM_HIGH_SECURITY_GP

cmp r9, #1

moveq r0, #1

movne r0, #2

Expected absolute numeric value

fstmiad r0!, {d0-d15}

fldmiad r0!, {d0-d15}

vstmia.64 r0!, { d0-d15}

vldmia.64 r0!, { d0-d15}

UAL mnemonic for VFP instruction Load and store multiple

 

Hope this will help you to resolve the pre UAL and UAL changes in WEC 2013.

Stmdb sp! {r3-r12, lr}

ldmia sp!, { r3-r12, lr}

stmdb sp!, {r3}

ldmia sp! , {r3}

Click here to continue reading Part2