Forum: ARM programming with GCC/GNU tools Display registers value - ARM assembly

von Ab A. (abanel88)

Rate this post
0 useful
not useful
Hi there,
I was wondering If anyone can help me with this. I want to print or 
write to a file and save the values of the registers running a simple 
Hello world program for example. Can somebody guide me what I need to 
know so I can do that? Or print to the monitor the values for example of 
the R0-R4?
Any help or thoughts? Can I do this combining C or C++?

Many thanks!!

von M.K. B. (mkbit)

Rate this post
0 useful
not useful
You should explain what you want to achieve with your dump of the 
registers. Maybe you try to achieve something else where a different 
approach is more suitable.

Since you are talking about C, C++ the registers are assigned by the 
compiler  so each little change in the code or compiler settings might 
lead to the same data being stored in a different register. Only by 
writing assembler you can control directly which register you use.

Basically you can dump the registers using a debugger by single stepping 
through the assembler instructions and copy the current register value. 
Keep in mind that a simple looking prinft/cout contains lots of 
assembler instructions which might use your registers.


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.