This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Load a variable into a register using inline assembly.



Hi,

I'm trying to load a C variable inside a register.

I tried the following whiteout success.

    register const uint32_t test = 0x10000;

    __asm__ volatile ("MOV R10, %[input]"
        : // no C variable outputs
        : [input] "r" (test)
        : "R10"      // tell the compiler R10 is modified
        );

For context: the goal is to make this workaround work better.

Best regards,
Gabriel