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

LPC2368 bootloader and RL-ARM

Hello,

I developped an usb bootloader which works perfectly when I use an simple firmware, but which doesn't works with an firmware using RTX kernel.

Anyone can help me ?

Thanks

Parents
  • There is more problem (with ARM modes stacks setup) in startup file after bootloader.

    You can to change the bootloader, so program user code will called in Supervisor mode or to add the following code to startup file (LPC2300.S) in the user program:

    ; Setup Stack for each mode ----------------------------------------------------
    
    ; Stack setup code will not run when MCU in User mode
    ; as occur when this code run after secondary boot loader
    ; The following code will do fake calling to Software interrupt to enter Supervisor mode
    ; so stacks init code will work properly.
    
    SWI_RAM_ADDR    EQU             0x40000028
                                    LDR             R8, =SWI_RAM_ADDR         ;
                                    LDR             R7, [R8]                          ;Save SWI_Handler address
                                    LDR             R9, =Stack_Set_Addr
                                    STR             R9, [R8]                          ;Replace SWI_Handler (for next command) with Stack_Set_Addr
                                    SWI             11                                        ;Just jump to Stack_Set_Addr in Supervisor mode
    
    Stack_Set_Addr  DCD             Stack_Setup
    
    Stack_Setup             STR             R7, [R8]                          ;Restore SWI_Handler address
    ;End of edit
                            LDR     R0, =Stack_Top
    
    

    For detailes look in the dicussion in http://www.keil.com/forum/docs/thread13707.as

Reply
  • There is more problem (with ARM modes stacks setup) in startup file after bootloader.

    You can to change the bootloader, so program user code will called in Supervisor mode or to add the following code to startup file (LPC2300.S) in the user program:

    ; Setup Stack for each mode ----------------------------------------------------
    
    ; Stack setup code will not run when MCU in User mode
    ; as occur when this code run after secondary boot loader
    ; The following code will do fake calling to Software interrupt to enter Supervisor mode
    ; so stacks init code will work properly.
    
    SWI_RAM_ADDR    EQU             0x40000028
                                    LDR             R8, =SWI_RAM_ADDR         ;
                                    LDR             R7, [R8]                          ;Save SWI_Handler address
                                    LDR             R9, =Stack_Set_Addr
                                    STR             R9, [R8]                          ;Replace SWI_Handler (for next command) with Stack_Set_Addr
                                    SWI             11                                        ;Just jump to Stack_Set_Addr in Supervisor mode
    
    Stack_Set_Addr  DCD             Stack_Setup
    
    Stack_Setup             STR             R7, [R8]                          ;Restore SWI_Handler address
    ;End of edit
                            LDR     R0, =Stack_Top
    
    

    For detailes look in the dicussion in http://www.keil.com/forum/docs/thread13707.as

Children
No data