2019-01-10 10:30 AM
Hi. I'm trying to determine which flash bank running code resides in. I'm planning on reading the program counter and use that to determine which bank I'm in. Both GCC and the Arm compiler have some variant of a __current_pc() intrinsic. I haven't been able to find anything like that in TrueStudio (or I haven't found the right include file, directory, something). Can anyone point me to either the location of this function, or another method of finding the information I need. Thanks.
Lee
2019-01-10 10:45 AM
2019-01-10 10:55 AM
Thank you, Uwe. In fact, I found that same posting about 2 minutes after I posted my question and it works well.
2019-01-10 11:31 AM
Before looking at complicated macro, you can get the function start address like this:
uint32_t myfunction(uint32_t v);
uint32_t myfunction(uint32_t v) {
uint32_t function_address = (uint32_t) myfunction;
return 0;
}
2019-01-10 12:01 PM
It works out to 2 lines of code, so not that complicated. But thanks for your suggestion as well.
2019-01-10 01:11 PM
More interesting would be where it's being called from, so MOV R0, LR; BX LR