(KL serial bootloader and userapp)how to modify scf file of userapplication in KEIL

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

(KL serial bootloader and userapp)how to modify scf file of userapplication in KEIL

Jump to solution
1,008 Views
fugrace
Contributor III

hI,everyone,I'm design an easy uart bootloader on KL14,the test bootloader has only jump code ,which is bellow:

  // relocate vector table

  SCB_VTOR = RELOCATED_VECTORS;//0x10000; 

    // Jump to user application

   JumpToUserApplication((RELOCATED_VECTORS),(RELOCATED_VECTORS+4));//*(unsigned long*)   //*((unsigned long*)

JumpToUserApplication

  msr msp, r0

  msr psp, r0       

  mov pc, r1

  END

but it almost never works. I said almost because once it works,it succeed in jumps to where my application locates and it works! but one day later,after some flash changing,

I can never make it work again.

SO now,I wonder if it's because my scf file which decides my code's  placement under KEIL.

I want to locate it in 0x10000,so I move the userapp's bin file entirely to this address.

Is it ok?or how should I modify it?

Really appreciate your help,I've worked for a whole week!

Labels (1)
0 Kudos
1 Solution
627 Views
fugrace
Contributor III

Hi,Kan, sorry for replying late.Thanks for your help.

Now I've known the answer.the user code should be loaded in the moved address.for example 0x1000;

then your sct file should be like this:

LR_IROM1 0x00001000 0x00020000  {    ; load region size_region

  ER_IROM1 0x00001000 0x00020000  {  ; load address = execution address

   *.o (RESET, +First)

   *(InRoot$$Sections)

   .ANY (+RO)

  }

  RW_IRAM1 0x1FFFF000 0x00001000  {  ; RW data

   .ANY (+RW +ZI)

  }

  RW_IRAM2 0x20000000 0x00003000  {  ; RW data

   .ANY (+RW +ZI)

    *(runinram)

  }

}

View solution in original post

0 Kudos
3 Replies
627 Views
fugrace
Contributor III

attach my scf file bellow:(128K flash,16K RAM):

; *************************************************************

; *** Scatter-Loading Description File generated by uVision ***

; *************************************************************

LR_IROM1 0x00000000 0x00020000  {    ; load region size_region

  ER_IROM1 0x00000000 0x00020000  {  ; load address = execution address

   *.o (RESET, +First)

   *(InRoot$$Sections)

   .ANY (+RO)

  }

  RW_IRAM1 0x1FFFF000 0x00001000  {  ; RW data

   .ANY (+RW +ZI)

  }

  RW_IRAM2 0x20000000 0x00003000  {  ; RW data

   .ANY (+RW +ZI)

    *(runinram)

  }

}

0 Kudos
627 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Fu Grace,

Please kindly refer to page 30 of http://cache.freescale.com/files/microcontrollers/doc/app_note/AN2295.pdf for more details on memory allocation. You may find bootloader demos for KL part in "an2295sw\src\Kinetis\KEIL_uV4" which is from an2295sw.zip(http://cache.freescale.com/files/microcontrollers/doc/app_note/AN2295SW.zip) .

Hope that helps,


Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

628 Views
fugrace
Contributor III

Hi,Kan, sorry for replying late.Thanks for your help.

Now I've known the answer.the user code should be loaded in the moved address.for example 0x1000;

then your sct file should be like this:

LR_IROM1 0x00001000 0x00020000  {    ; load region size_region

  ER_IROM1 0x00001000 0x00020000  {  ; load address = execution address

   *.o (RESET, +First)

   *(InRoot$$Sections)

   .ANY (+RO)

  }

  RW_IRAM1 0x1FFFF000 0x00001000  {  ; RW data

   .ANY (+RW +ZI)

  }

  RW_IRAM2 0x20000000 0x00003000  {  ; RW data

   .ANY (+RW +ZI)

    *(runinram)

  }

}

0 Kudos