X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/cc1afb21bdc089426652f21769164645cae062fd..243fec4450d3a3246f3f0d92751a95daef7c1503:/embedded/arch/arm/mach-lpc21xx/libs/hal/startup.S diff --git a/embedded/arch/arm/mach-lpc21xx/libs/hal/startup.S b/embedded/arch/arm/mach-lpc21xx/libs/hal/startup.S index 3201fbc..5e0f84f 100644 --- a/embedded/arch/arm/mach-lpc21xx/libs/hal/startup.S +++ b/embedded/arch/arm/mach-lpc21xx/libs/hal/startup.S @@ -27,7 +27,7 @@ # Starupt Code must be linked first at Address at which it expects to run. .text -# .arm + .code 32 .global _stack // top of stack .global _startup @@ -109,18 +109,45 @@ LoopZI: CMP R1, R2 # Enter the C _setup_board code - ADR LR, __main_start LDR R0, =_setup_board CMP R0, #0 BEQ __main_start + ADR LR, __main_start +#if defined(__thumb__) + TST R0,#1 + ADRNE LR, __main_start_from_thumb + BX R0 + .code 16 +__main_start_from_thumb: + BX PC + NOP + .code 32 +#else BX R0 +#endif +__main_start: -__main_start: + LDR R0, =main ADR LR, __main_exit - LDR R0, =main +#if defined(__thumb__) + TST R0,#1 + ADRNE LR, __main_exit_from_thumb + BX R0 + .code 16 +__main_exit_from_thumb: + BX PC + NOP + .code 32 +#else + BX R0 +#endif +__main_exit: + LDR R0, =_mem_app_start + CMP R0, #0 + BEQ __main_loop BX R0 -__main_exit: B __main_exit +__main_loop: B __main_loop .size _start, . - _start .endfunc