AnsweredAssumed Answered

IMX53 inline assembler with use of module/global variables

Question asked by David Golke on Feb 24, 2016
Latest reply on Feb 25, 2016 by David Golke

I am wondering if there is a way to make use of the __asm() or asm() with global or module variables.  Say for example, I have myModuleVariable and I wish to variable inside of the __asm() or asm() inline assembler functions, is this possible? 

 

Say for example, I want to set a global variable to 1 by doing something like this:

__asm(

"        MOV      R0,#+1\n"

"        LDR      R3,myModuleVariable\n"

"        STRB     R0,[R3, #+0]\n"
);

 

This is giving me the following error:
Error[Lp002]: relocation failed: value out of range or illegal: (someAddress)

 

I notice that the other disassembled functions that make use of this do so through means of the data table such  as

 

LDR R3, ??DataTable1_1 when disassembled to a .s file.  However because of the risk of the data table changing throughout compilations I cannot use this ??DataTableX_X, unless I were to double check and update with every build. 

Outcomes