variablesassemblyarmcortex-a8

ARM assembly variable declaration


Hi I have a question about the order of declaration variables. Little example. If in declaration i write:

    .data
    .align  0
res:    .long 0
num:    .long   7
var2:   .short  30

the program works, but if I write this:

    .data
    .align  0
    res:    .long 0
    var2:   .short  30
    num:    .long   7

the program don't work: for example I can't do a simple

ldr     r5, =num
ldr     r5, [r5]

with the second configuration. the error is: no source available for "0x20010"

I'm using eclipse on a processor am335x Thx


Solution

  • SOLVED, if some one is interested I explain here: It's a problem of alignment, because I tough that once you write the directive .aligne this is for all the next commands, but is not like that. So if I write .aligne 4 before num it works.