I'm attempting to write the integer contents of a register to a text file in ARM Assembly. I have been reading with little success - I have deduced from reading the technical manual I will require some SWI instruction, but I cannot for the life of me find a concrete example of how to do this.
Operating system is Raspbian running on Pi B model.
Thank you in advance for any help, if you require any clarifications please let me know!
EDIT : To clarify, I am assembling and executing my code successfully using GCC. I want to store the values of my data registers to a text file.
Example :
.global main .func main main: mov r1, #19 mov r2, #11 add r0, r1, r2 bx lr In the above case, r0 would hold the value 30. I want to write that value to a text file.
itoain C? Do you know how to write '3' to a text file? Why not to just STDOUT? Do you know the difference between a file and STDOUT? Are you able to use the tools to produce an executable from an assembly file? Since I don't know your foundations, I don't know where to start answering.fopen(),fwrite(),fclose()and possibly various other bits of the C library that's already right there, there's a strong argument for just linking the C library and calling its I/O functions directly (learning the details of calling conventions in the process). Of course, that's not to say you shouldn't learn the details of the OS interface, just that it's possibly something that can wait.