calledfromwhere ; subroutine returns address from whence it came
movs r0, lr
bx lr
Usage
bl calledfromwhere ; assembler
printf("%p\n", calledfromwhere() ); // C
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
In debug mode, place a breakpoint or stop the code, and view the disassembly window which will show you which address the PC value is. Or view the SFR core registers.... why do you need this?
Explain better what it is you're attempting to do.
In assembler you can move the value to other registers or do math directly with the PC. You could perhaps create a subroutine which moves LR to R0 and see where it was called from.
Perhaps learn MCU registers, instructions and assembler?
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Yes, I have some programs running on flash, I want to save some values from register r0 to r15 and the value of register pc, so that I can go back and continue doing my old work.
calledfromwhere ; subroutine returns address from whence it came
movs r0, lr
bx lr
Usage
bl calledfromwhere ; assembler
printf("%p\n", calledfromwhere() ); // C
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..