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

USB secondary ISP bootloader for LPC23xx with RTX Kernel problem

I got the code USB secondary ISP bootloader for LPC23xx from NXP working fine with none RTX kernel but It does not working with RTX kernel. If anyone know more detail please help.

Thank you.

Parents Reply Children

  • http://www.keil.com/support/man/docs/rlarm/rlarm_ar_svc_func.htm

    SVC functions can still be interrupted.

    http://www.keil.com/support/man/docs/rlarm/rlarm_ar_swi_func.htm

    Software Interrupt (SWI) functions are functions that run in Supervisor Mode of ARM7â„¢ and ARM9â„¢ core and are interrupt protected.

    SWI functions can still be interrupted by FIQ interrupts.

    Is there a SWI_Handler provided by KEIL, that can be included without RTX kernle?

    If we use the SWI function with RTX kernel and its SWI_Handler to jump to the application, will the later interrputs work?

  • Is there a SWI_Handler provided by KEIL, that can be included without RTX kernle?

    if you remember how RTX is configured, you will know that RTX imports the RTL SWI handler. you can always add your SWI.s file to define your own SWI functions, as explained in the user manual of RTX.

  • Hi Tamir,

    Thanks for your responses.

    I will do some simple tests to make sure some basic points.

    Looks like you use the RTX kernel on BOTH your Bootloader and Application?

  • Looks like you use the RTX kernel on BOTH your Bootloader and Application?

    My bootloader is as simple as it can be; it either jumps (via a SWI) to the application or updates the application software. No RTX there, just an infinite loop.

  • I use the LPC23xx USB Bootloader from NXP directly, I do not modify anything of it. I download the Memory.bin (Bootloader) into my LPC2378. And I have an application with RTX kernel, I follow the solutions mentioned in the above of this thread.

    1. Set IROM1 Start: 0x2000 Size: 0x7E000
    2. Set IRAM1 Start: 0x40000200 Size: 0x7E00
    3. On the Startup file of my application:
    Set Options-> Asm-> Conditional Assembly Control Symbols: RAM_INTVEC REMAP RAM_MODE
    4. Add the below code into the Startup file of my application.

    ; 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.
    
    ; Start of edit
    
    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
    
    
    

    After all of that, I start my Debug Session. The Disassembly Window shows the Machine Code/ASM Code of the Bootloader (without the Source Code). Then, the Bootloader jumps to my application. So that, I get the state while the Bootloader just finishes its work, and pass the control to my application. I can observe the CPSR and the R13/SP of Supervisor Mode etc, to see if the solutions works properly.

    My problem is: sometimes the "memory re-mapping" works fine, sometimes the "memory re-mapping" just doesn't work; it seems it is related to the breakpoints I set; but I am not so sure.

    Does anyone else encounter the same problem? And How do people debug your Bootloader/Application?

  • I have never encounter a situation where these macros don't work. why are you augmenting the startup file? that is not required at all. just make the function that jumps to the application a SWI function, not forgetting to create a SWI table in a separate .s file as well documented.

  • http://www.keil.com/support/docs/2963.htm

    ARM: ATMEL REMAP CAUSES PROBLEMS WITH ULINK DEBUGGING

    The REMAP feature on Atmel devices exchanges RAM and Flash areas. When the remapping is done before ULINK can stop the device, you will see swapped memory areas in the debugger and the CPU may not behave correctly.

  • -> just make the function that jumps to the application a SWI function,

    Hi Tamir,

    I tried to do that once or twice, but failed. When I get a better understanding of all of these, maybe I will try it again.