Hi all,
Is there any way to jump some flash locations inside a code. eg:
Starting location of flash
0x00000050 int main() 0x00000054 { 0x00000058 printf("Hai"); 0x0000005C Jumpt to flash address for 2nd printf 0x00075000 printf("Bye") ------------ }
How to implement this type of Flash location jumping in Keil compiler.Is it possible to jump?? Kindly reply...
I thionk this is the old nugget "sharing routines between boot and app"
there is only one answer: DONT
Erik
As I did write in previous post: Sharing routines normally requires assembler code to make sure that the developer don't have to suffer from unknown global variables or helper library functions that are linked at different locations in the different builds.
Sharing routines can work. But it so very often fails badly. When it works, it wasn't developed by someone who starts the project by asking on a forum how to do it.
Just such a thing as printf("hello world"). printf() sounds like one function. But it has a large backend of helper functions. And depending on implementation, it may not be fully reentrant but may have global state variables that must be stored at a specific address.
And why have a printf("hello world") stored at a specific location when it's enough to just store the string "hello world"?
Sharing routines can work. But it so very often fails badly
an assumed situation:
someone ask me "to save memory, can we share routines between boot and app"
with decades of experience, my answer will be: "sure, but first you must sign this document stating that I am not responsible for whatever ill effects that may pop up resulting from this"