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.

how to use global variables in asm

hi

I am trying to use global variable as follows in the asm. it throws error as undefined symbol.

.global test

.global result

ldr r0, resultadd

;str ;as required

resultadd   .word    result

i have not done extern to c file yet because asm itself is throwing error. I have seen other post int he community but somehow this doesnt work for me.

Request for help

Regards

Chitra

  • Hi Chitra,

    The assembler is looking for an actual definition of the symbol "result". This needs to be explicitly defined either in this file or another file in which it is declared as a global variable.

    For example, you could add the following line in your asm code:

    result    .word    0x08000000

    Regards, Sunil