Hi,
I need to :
1. Inline an assembly code that modifies Stack pointer directly (__asm directive is not allowed to modify stack pointer) in a C++ file.
What is the best option? A function call to a label is not an option since I need to manually update Stack Pointer. I need to inline.
I read I can create SRC file. Can I create SRC from the C++ compiler ? if so what is the Directive/Flag? --SRC didn't work.
#prama asm was unrecognized pragma. perhaps because I'm not creating SRC.
Thanks.
Regardless , I worked around the problem.
And of course cannot be bothered to explain what that workaround (or, for that matter, the actual problem) was. Do you really think that's the right approach to thanking the public for trying to help you?
Unnecessary comments like yours and Keith are disappointing to see in threads. I appreciate people (other folks that helped on this thread) who genuinely attempt to help instead of mocking. A simple "can you post your findings" would do.
You have to read the whole thread to see what the problem was. In case you don't want to be bothered with it or give you more reason to post comments like before... read below:
GCC allows for inline assembly that modifies Stack(push/pop and SP). ARM RVCT doesn't allow it.
1. I needed to save LR,and content of R0-R7 onto stack. Don't ask "why you need to do that". It was a HW issue work around. 2. Calling an assembly routine will modify LR so I wanted to figure out a way to inline a function in .s file to avoid modifying LR .
What I ended up doing is calling a subroutine with LR passed as a parameter. And that subroutine pushed passed LR and other registers onto stack.