Products > Programming

GCC ARM32 32F417 how to call or jump to a specific address?

(1/9) > >>

Of course, the "answers" are all over the internet, but none of them compile, or (if they compile) none work.

I have what is basically an overlay at FLASH base+32k ie.. 0x08008000 and need to jump to that address.

The address is actually a symbol from the linkfile called FLASH_APP.

I see examples like

   ldr  r3, =JMPADDR
   bx   r3

and have been trying various forms of stuff like asm volatile("bx %0" : : "r" (0x08008000)); but nothing works. I spent decades coding in asm so this should be simple :)

I am using GCC v10. Many thanks for any tips.


That doesn't appear to go to a fixed absolute address:


If you're using GCC, you can also use computed gotos:
Of course, this is not standard C, and if the pointer points to an absolute address rather than "the address of a label", the behavior *may* be undefined. Not sure.
But it's just a "fun" feature to know, and it seems to "work":


[0] Message Index

[#] Next page

There was an error while thanking
Go to full version