AnsweredAssumed Answered

Problem with appliaction SPI ISR vector table using bootloader,  Kinetis K20

Question asked by Tom Junkans on Aug 21, 2015
Latest reply on Aug 25, 2015 by soledad

Using MQX 4.0 CW 10.5 with a Kinetis K20XD256VMD10

I completed a bunch of smart cards using the Kinetis K20 and I'm ready to deploy a bootloader. A master CPU communicates to these smart cards via SPI. I hard-coded the SPI ISR into the vector table in vectors.c to eliminate the RTOS for this ISR. Everything works great without the bootloader installed.


For the Bootloader: what I did-->

#1 -I modified the USB MSD bootloader (AN4379) to bootload from SPI as well as from USB. Way cool.

#2 -In my application user_config.h file I added the line --> #define MQX_ROM_VECTORS         0

#3 -In my application linker file (intflash.lcf) I modified MEMORY per the AN4379 instructions -->




   vectorrom   (RX): ORIGIN = 0x0000C000, LENGTH = 0x00000400

   cfmprotrom (RX): ORIGIN = 0x0000C400, LENGTH = 0x00000020

   rom             (RX): ORIGIN = 0x0000C420, LENGTH = 0x00033BE0  # Code + Const data  

   ram             (RW): ORIGIN = 0x1FFF8400, LENGTH = 0x0000FC00  # SRAM - RW data


   # kernel space starts after RAM variables (Location of MQX Kernel data + MQX heap)

   end_of_kd   (RW): ORIGIN = 0x20007FF0, LENGTH = 0x00000000


   # Boot stack reused by MQX Kernel data

   bstack      (RW): ORIGIN = 0x20007A00, LENGTH = 0x00000200  # Boot stack

   end_bstack  (RW): ORIGIN = 0x20007C00, LENGTH = 0x00000000



#4 -In my application main_task() I added the code to copy my hard-coded SPI ISR to the SRAM vector table


// Copy Application Stored Interrupt Vector table for SPI2 to SRAM

pdst=(uint_32*)0x1FFF80B0;     // SPI2 interrupt vector in SRAM.  

psrc=(uint_32*)0x0000C0B0;     // SPI2 interrupt vector in Flash.

for (i=0;i<0x1;i++,pdst++,psrc++) 




                                     //SCB_VTOR = (uint_32)0x1FFF8000;  



#5 -When I look at the SRAM vector table memory my SPI ISR vector is there and it matched what I see in the .MAP file, as do all the other vectors match the .MAP file.

#6 -After I load my application using the bootloader with the line in the application //SCB_VTOR = (uint_32)0x1FFF8000;  commented out I can see my application main task running(my LED is blinking). I can't talk to my card using SPI now.

#7 -When I un-comment the line SCB_VTOR = (uint_32)0x1FFF8000; in the application I do not see my application run after a reset, i.e. no blinking LED , and the bootloader SPI ISR is still firing when I try to talk SPI to it.


#8 -A hint for you MQX gurus that are trying to save my day, I am positive this all worked (#6) almost 3 years ago when I first made this bootloader, but then I was running MQX 3.8. 


Thank you in advance to anyone who read this and is trying to help.