This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

BRANCHING INSTRUCTION

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

Parents
  • 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.

Reply
  • 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.

Children
No data