Using DCD to create a "global variable"

Hi All,

Please bear with me, I'm new to ARM/Assembly and just trying to get to grips with how to use it.

I have a jump table currently set-up like this

ProcTable

DCD Proc1

DCD Proc2

DCD Proc3

EndTable

Another part of my program that is acting as a processes manager which needs to keep track of the number of the process so it can calculate a stack pointer (PSP) for it so that each program has it's only section of the stack. I'm trying to use some sort of 'global variable' like this

"ProcCount DCD 0"

I then want to increment the value stored in ProcCount although I'm having trouble getting this to work, most examples I can find involve reading the value of ProcCount but never writing/updating the other way. I was trying to do something like this:

LDR r2,=ProcCount

ADD r4,r4,#1

STR r4, [r2]

NOP

LDR r5,ProcCount

NOP

I'm trying to add #1 to ProcCount then reading it back into r5 to check that it has changed (Nothing changes r5 stays at 0x0)

Any advice would be much appreciated!

More questions in this forum