bootloader porting to kl16 from kl26

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

bootloader porting to kl16 from kl26

1,409 Views
sachinjoy
Contributor I

Hi,

 

kl26z128 to kl16z64

 

I got a kl26 bootloader file and iam trying to port it into kl16, i know the only difference is an additional usb btw these two , but mine is 64 kb with 8 kb ram and kl26 is  128 kb with 12kb ram. Can anyone tell me what all things i should edit in it .......(Please find the attachment )

Original Attachment has been moved to: boorloader_kl26_MDK.zip

0 Kudos
7 Replies

808 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello ,

I have reply to you as this :

"

Hello sachin,

About change , it mainly include two parts:

- The first part is  bootloader code :

- the UART port ;

- the flash , especially the "APPOK_START_ADDRESS", it defined in the file of "FRDM_KL26Z_cfg.h":

#define APPOK_START_ADDRESS  0x1FFF8

for your chip is 64k size flash , here you need change it to 0xFFF8 .

and other about flash need to be change , please refer to this picture to check whether is right :

93616_93616.pngpastedImage_1.png

- The other part is the GUI code : mainly change the file of ""GlobalVars.cs" ,

you need refer to the "MKL26128" to add other part as it :

  93623_93623.pngpastedImage_2.png

You can first change the places i mentioned above , then test , if it sitll can not work , you can tell me the detail information or

which step it failed , then i will check with you .

Furthermore , if you use the keil , you only need check these folders :

-Kinetis-Bootloader-master\ Kinetis-Bootloader-master1027\Kinetis Bootloader SW\Bootloader and Application for KL26\Bootloader Source Code\boorloader_kl26_MDK

- Kinetis-Bootloader-master\Kinetis-Bootloader-master1027\Kinetis Bootloader SW\Bootloader GUI Source Code\Boot_Loader_GUI 20151026

- Kinetis-Bootloader-master\Kinetis-Bootloader-master1027\Kinetis Bootloader SW\Bootloader and Application for KL26\User Application Source Code (this are app code created on CodeWarrior)-

- Kinetis-Bootloader-master\Kinetis-Bootloader-master1027\Kinetis Bootloader DOC - 0915.pdf (This DOC is detail about the bootloader , i recommend you check it )

Hope it helps

Alice

  

0 Kudos

808 Views
sachinjoy
Contributor I

Hi Alice,

Thanks for the replay.. now iam able to write into flash but i am not able to jump to user program after writing.

Function ::

void JumpToUserApplication(LWord userSP, LWord userStartup)

{

  volatile LWord avoid_optimization;

  avoid_optimization = userSP;       //In order to avoid optimization issue when -Os

  avoid_optimization = userStartup;  //In order to avoid optimization issue when -Os

  // set up stack pointer

  __asm("msr msp, r0");

  __asm("msr psp, r0");

  // Jump to PC (r1)

  __asm("mov pc, r1");

}

is showing error ,,,,,,,,,,......

compiling bootloader.c...

..\Sources\bootloader.c(110): warning:  #1267-D: Implicit physical register R0 should be defined as a variable

    __asm("MSR MSP, R0");

..\Sources\bootloader.c(110): error:  #549: variable "R0" is used before its value is set

    __asm("MSR MSP, R0");

..\Sources\bootloader.c(114): error:  #20: identifier "PC" is undefined

    __asm("MOV PC, R1");

0 Kudos

808 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Joy,

In the KEIL ,  the define of the function "JumpToUserApplication" is in the "bootloader_asm.s" file ,

pastedImage_0.png

The function you mentioned have been shield in KEIL IDE :

pastedImage_1.png

And the whole version  and the lasted version of the project you download here :

jenniezhjun/Kinetis-Bootloader · GitHub

Hope it helps



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

Have a great day,
Alice

0 Kudos

808 Views
sachinjoy
Contributor I

Ya i got it ,, still some problem is there when i load app hex file to the bootloader through freescale application  .. app will not sent 0x00 ot 0x1000 address blocks and deliver only rest for the bootloader, to write to flash ...so when i read back my flash i can see partial flash data from 0x1000 address......what i have to change in Freescale app to sent the full data???

0 Kudos

808 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello sachin,,

In your app , please change the start address from 0X00 to 0X1000,

Please carefully refer to the Application note ->3.3.8. Steps of Adding Bootloader Communication Code to User code  .

BR

Alice

0 Kudos

808 Views
sachinjoy
Contributor I

can u sent me the application code ??      

Start address in globalVars.c ?? what about end address???

0 Kudos

808 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Sorry i only have the APP developed on CW , and it have upload to he Git i tell you before .

And about the end address , it is the flash memory address of your chip .

BR


Have a great day,

Alice

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

0 Kudos