I am trying to do a Bootloader. On my bootloader program the LCF is the following:
vectorrom (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
code (RX) : ORIGIN = 0x00000410, LENGTH = 0x00001BF0
data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00020000
cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
I din't use any MQX or interrupt for this code.
As for the application code here are the details:
vectorrom (RX): ORIGIN = 0x00002000, LENGTH = 0x00000400
rom (RX): ORIGIN = 0x00002400, LENGTH = 0x0003FDF0 # Code + Const data
ram (RW): ORIGIN = 0x1FFF0000, LENGTH = 0x00020000 # SRAM - RW data
The application does have an MQX. Also, I already define MQX_ROM_VECTORS as 0 in BSP.
On my BL program I have this function:
static void JumpToUserApplication(LWord userStartup)
unsigned long* ptr_jump = (LWord*)userStartup;
test = userStartup;
/* set up stack pointer */
asm("LDR r13, [r1] ");
/* jump to application reset vector */
the userStartup variable being pass is 0x2000. However if I debug my BL program and tried to jump to that location it goes to another location unknown to me. After line asm("BX *ptr_jump"), it lands to address 0x11a20.
Anybody can point to me what am I missing here?
I am using Kinetis K60512
Also contents of flash where application program should start (0x2000 onwards) was verified by reading the memory of Kinetis itself. It is exactly the same as generated S19 file from application code. Thus it is not like I am jumping to an empty or FF byte.
Thanks in advance.