cancel
Showing results for 
Search instead for 
Did you mean: 

jump to specific location

Rahimi.Meysam
Associate II
Posted on September 14, 2015 at 17:31

Hi.

I have a problem with jumping to specific location on stm32 flash memory. At that location some functions should be implemented and the result from these functions have to be kept in any of (all purpose)registers. after jump to specific location i want to back to main program and using data from the registers.

i would be thank full if everybody help me.i am in a dark situation. Any clue will be help me so much.

Thank you

#stm32-jump-function-call
4 REPLIES 4
Posted on September 14, 2015 at 18:27

If you need to return a lot, use a structure pointer, and fill that with the data, or learn to use assembler?

The routine here could be changes to expect parameters, or return a different type. The first four parameters passed would be in R0, R1, R2, and R3, and the return in R0 (and R1 if 64-bit, as I recall), beyond this the stack is used, refer to ABI documentation.

typedef int (*pFunction)(void);
void CallFlashCode(void)
{
pFunction RunCode;
RunCode = (pFunction)0x080012345; // ODD for Thumb code - Address of your function
printf(''%d
'',RunCode());
}

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Rahimi.Meysam
Associate II
Posted on September 15, 2015 at 17:15

Thank you for your answer.

Unfortunately i am still dark at this subject. i saw you recommend ABI Documentation.

if you think this document can help me would you please guide me to this document(where i can find it?)

thank you.

Posted on September 15, 2015 at 19:57

I think it might help enlighten you,

http://www.google.com/search?q=arm+abi

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Rahimi.Meysam
Associate II
Posted on September 18, 2015 at 11:59

Thank you Clive.

with your Suggestion and using 

#progma location = ''Specific Sector''

Befor function definition my problem solved.

thank you again.