Hi All,
I am using STR912FAW44 and keil MDK to develop the DFU bootloader. When the program jumps to Application, it hangs there. I set up a breakpoint before jump, I find it always goes to undefined handler. I wonder what causes to go to the undefined handler. Greatly appreciate any suggestions.
FMI->BBSR = 0x0; FMI->NBBSR = 0x6; FMI->BBADR = 0x400000 >> 2; FMI->NBBADR = 0x0 ; /* Jump to the user application and execute it */ Jump_To_Application = (pFunction) 0x00; Jump_To_Application(); (set breakpoint here)
Best Regards,
Lillian
Finally, my DFU bootloader can jump to the application. However, new issues come out.
1. The application works fine as loaded by uLink2 without DFU bootloader. 2. Load the DFU bootloader and it jumps to the application. But the application will crash after running a while.
My application includes FIQ timer and USB CDC.
I wonder it may be caused by the stack size and increase them, but no luck.
The stack size for DFU bootloader is set as followes.
UND_Stack_Size EQU 0x00000040 SVC_Stack_Size EQU 0x00000040;0x00000008 ABT_Stack_Size EQU 0x00000040 FIQ_Stack_Size EQU 0x00001800 IRQ_Stack_Size EQU 0x00001800 USR_Stack_Size EQU 0x00002000 ISR_Stack_Size EQU (UND_Stack_Size + SVC_Stack_Size + ABT_Stack_Size + \ FIQ_Stack_Size + IRQ_Stack_Size) AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE USR_Stack_Size __initial_sp SPACE ISR_Stack_Size Stack_Top ;// <h> Heap Configuration ;// <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF> ;// </h> Heap_Size EQU 0x00000400;0x00000200 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit
The stack size for application is
UND_Stack_Size EQU 0x00000020 SVC_Stack_Size EQU 0x00000ff0;0x00000008 ABT_Stack_Size EQU 0x00000020 FIQ_Stack_Size EQU 0x00001200 IRQ_Stack_Size EQU 0x00000400 USR_Stack_Size EQU 0x00001000 ISR_Stack_Size EQU (UND_Stack_Size + SVC_Stack_Size + ABT_Stack_Size + \ FIQ_Stack_Size + IRQ_Stack_Size) AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE USR_Stack_Size __initial_sp SPACE ISR_Stack_Size Stack_Top ;// <h> Heap Configuration ;// <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF> ;// </h> Heap_Size EQU 0x00000400 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit
Please help me. What may results in the issues above. Appreciate any suggestions.
For a NXP LPC23xx:
When the bootloader jumps to the application, it should be in the privilege mode; otherwise the application will fail to set the stack.