can i jump from a bootloader designed by me to an application
program by changing the ProgramCounter .. i have an address location
in a variable ..
mov pc, addr .. is this possible or any other options
... there is no return from application to bootloader
program..
plz help me
Read-Only
Author Christoph Franck
Posted 12-Jan-2007 09:30 GMT
Toolset ARM
RE: jump to a location
Christoph Franck
From the ARM Assembler Guide:
You can also load the program counter directly using data
operation instructions.
Read-Only
Author robert francis
Posted 12-Jan-2007 09:45 GMT
Toolset ARM
RE: jump to a location
robert francis
plz help me .. how can i do that ..
when i used the move function it returned error
i am using GNU compiler
asm("MOV PC,=ADDR"); returns error as shifting register
expected
no error when asm("MOV PC,0x8000");
how can i jump to code block whose address is in global
variable
i have also tried LDR R0 and BX r0 as in startup.s
Read-Only
Author Jonny Doin
Posted 26-Jan-2007 15:14 GMT
Toolset ARM
RE: jump to a location
Jonny Doin
To jump to a function whose address is in a global var, you don't
need to go low-level. Declare your var as a function pointer:
// declare pmain var as a function pointer to a int(void) function
int (*pmain)(void);
// do whatever you do, and load the target address in pmain
pmain = (int (*)(void)) 0x40000000; // cast it to the func ptr type
// ...
// now call the code pointed by pmain.
pmain();
// pmain will never return ...
That is only one extra instruction from doing MOV PC, R0,
generally irrelevant in a ARM processor.
Another point in your post is to optimize for a function that
never returns. The RVCT has the function qualifier
__declspec(noreturn) to tell the compiler that it is OK to
remove the function return code from the target function.
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.