2018-02-23 05:29 AM
Hi.
I'm trying to get the MSP and PC values in the example of STM32F4 firmware.
How can I do to get the Main stack pointer and Program counter value?
I came across the below snippet code from
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.kui0097a/armcc_cihccdja.htm
int f(int x)
{ int r0; __asm { ADD r0, x, 1 EOR x, r0, x } return x;}but I can't see the that function whether work as well or not, because break point doesn't work in uVision.
Would you please let me know how to do to get the MSP and PC value ?
Also how do set the breakpoint into the f function? in my case when I set the breakpoint by using F9 function key, that break point doesn't work.
2018-02-23 05:53 AM
extern int32_t __Vectors[];
printf('MSP:%08X PC:%08X\n',__Vectors[0],
__Vectors[1]);
You could try to break-point the call to f() and step-into it
2018-02-23 07:36 AM
In my case, I can't step into f(). Break point disabled in that moment.
Have you tried this? Not sure, I don't know the reason if why that break point is disabled when I debug mode.
2018-02-23 08:03 AM
Look at a disassembly of the code actually generated by the compiler. In the C source view there may be granularity issues, or where it in-lines at the calling address rather than emit a function.
Break-point or step in the 'Disassembly View', or use run to cursor type execution.
>>
Have you tried this?
I've done this stuff for a long time, and I'm situationally adaptive. Perhaps you work with someone who is similarly adept?
I really don't understand the purpose/goal of what you're attempting to do. Design Validation?