Search code examples
assemblyarm

Assembly instruction set issue


I have a bit of problem what instruction set I need to use when I am using unoptimized instructions that the compiler thing is great.

I have this a void function like this:

void feed(void)
{
 IWDG_ReloadCounter();
}

Here are the instructions.

//PUSH REGISTER ONTO STACK
push {r7}
//ADD
add r7, sp, #0

//???
mov.w r3, #12288
//MOVE TOP
movt r3, #16384
//MOVE 16-BIT CONSTANT
movw r2, #43690
//STORE REGISTER WORD
str r2, [r3, #0]

//MOVE
mov sp, r7
//POP REGISTER FROM STACK
pop {r7}
//BRANCH INDIRECT
bx lr

Can understand which of them to use. Anyone have some words of wisdom.


Solution

  • Because the function is made with a pointer I only needed to use these instructions:

    mov.w r3, #12288 
    movt r3, #16384 
    movw r2, #43690 
    str r2, [r3, #0]