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
You need to supply more information.
Are interrupts enabled/disabled when you start your application?
Are you in supervisor mode or user mode when you start your application?
Exactly what happens/doesn't happen?
Does the RTX application work ok if linked to start address 0, i.e. used without a boot loader?
My RTX application works perfectly, it's the RTX_Blinky demo project.
Exactly what happens/doesn't happen? It goes to the SWI_Handler
SWI_Handler B SWI_Handler
Thanks for your help.
The problem is that the default LPC2368 behavior is to look for interrupt vectors table in the start of the flash (0x40000000). Specific, The RTX application go there every OS switching (to SWI_handler).
But in your case the vectors table that reside in flash beginning is the bootloader one, not the one of RTX Application.
To resolve this problem, you have to add the following options to the Startup File (LPC2300.S) of your application, in Options - Asm - Define : RAM_INTVEC REMAP RAM_MODE
Now the startup procedure will copy the interrupt vectors table to the RAM and will look for it there. (I hope that your startup file version recognize all these options, if not I copy that in message end).
Additionally, you have to change memory area for application in Options for Target -> Target -> Read\Write memory area to start from 0x40000100 and contain only 0x7F00 (possible lower, but this for safty). So, the application will leave the vectors table RAM untouchable.
Code for LPC2368.S Insert if not exist before stack setup for each mode:
; Copy Exception Vectors to Internal RAM --------------------------------------- IF :DEF:RAM_INTVEC ADR R8, Vectors ; Source LDR R9, =RAM_BASE ; Destination LDMIA R8!, {R0-R7} ; Load Vectors STMIA R9!, {R0-R7} ; Store Vectors LDMIA R8!, {R0-R7} ; Load Handler Addresses STMIA R9!, {R0-R7} ; Store Handler Addresses ENDIF ; Memory Mapping (when Interrupt Vectors are in RAM) --------------------------- MEMMAP EQU 0xE01FC040 ; Memory Mapping Control IF :DEF:REMAP LDR R0, =MEMMAP IF :DEF:EXTMEM_MODE MOV R1, #3 ELIF :DEF:RAM_MODE MOV R1, #2 ELSE MOV R1, #1 ENDIF STR R1, [R0] ENDIF
Ok, it works now. Thank you very much
View all questions in Keil forum