Dear All,
I am trying to add a boot loader for my LPC2478 based application. I want to conditionally Branch to my main code at 0x1000 from the boot loader code. When i tried from Startup.s as below
IMPORT __main ; LDR R0, =__main LDR R0, =0x1000 BX R0 it worked fine. Now the problem is that I cannot do the same from main().
This does not compile int main(){
__asm{ LDR R0, =0x1000 B R0 }
}
generating following errors...
boot.c(8): error: #29: expected an expression boot.c(8): error: #1097: Expected a [ or ] boot.c(9): error: #114: label "R0" was referenced but not defined
PLS HELP...THANKS
there is more problems in the project,,,,,,, one is not job done,,,, try balelfish,,,,,
No it did not! As stated above, a simple jump won't get the job done, but you won't immediately feel it.
Thanks everyone.
Seems that solved my problem...thank you very much
Depending on the compiler, optimisation, etc, that could give you a call rather than a jump...
A jump to an absolute address in C can be as simple as "((void (*)(void))0x1000)();"
You are fundamentally wrong. 1. Don't kill people - your code will one day of you go on like this. 2. use a SWI function for the jump - you must be in any privileged mode to configure stack pointers during startup. Branching alone will not work. 3. Don't use inline assembly - only embedded assembly. See your assembler manual. That is the reason for the compilation error by the way.
View all questions in Keil forum