EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Secondary Bootloader Jump

Started by asvi...@yahoo.co.in April 7, 2009
Hi,

change your low-level startup code for the boot-loader to leave the CPU
in svc mode.

Foltos

An Engineer's Guide to the LPC2100 Series

I didn't realise that, It's an important point when you want to setup your
stack correctly.
An small fix should handle that situation, may be changing the startup.S of
bootloader
not to setup/change the mode of the system down to USER. Or recovering the
SVC status
back before leaving the bootloader (A swi handler should be enough for
that?)

I thought that in that situation the ARM7 TDMI would raise an
exception/abort/"privileged instruction", etc.
Greetings,
Miguel gel.
--- In l..., Miguel Angel wrote:
>
> I didn't realise that, It's an important point when you want to setup your
> stack correctly.
> An small fix should handle that situation, may be changing the startup.S of
> bootloader
> not to setup/change the mode of the system down to USER. Or recovering the
> SVC status
> back before leaving the bootloader (A swi handler should be enough for
> that?)

Hi,
I just found a trick, reading ARM's manual. I had to change the Startup.s in the bootloader, so instead of entering the USER mode, it enters the SYSTEM mode: it is equivalent to USER mode (same register set) but with privileges. For a vanilla Startup.s from Keil, the line to change is near the end of the file:
; Enter User Mode and set its Stack Pointer
; COMMENTED OUT MSR CPSR_c, #Mode_USR
; Enter SYSTEM Mode and set its Stack Pointer
MSR CPSR_c, #Mode_SYS

>
> I thought that in that situation the ARM7 TDMI would raise an
> exception/abort/"privileged instruction", etc.

The good old ARM core runs like a panzer-tank over these poor instructions: no effect!

>
> Greetings,
> Miguel gel.


The 2024 Embedded Online Conference