bootloader porting to kl16

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

bootloader porting to kl16

Jump to solution
1,895 Views
sachinjoy
Contributor I

Hi,

MCU----->MKL16z64vlh4

Aim------>Upgrade my firmware through Low power uart

I have checked the kinetis bootloader part and found out my mcu wont support Boot Rom,going further i understood there is some way to port the kinetis bootloader(Time consuming ??) ....so i was searching for some sample code in keil for kl16 series that i can copy and  edit to do my application,unfortunately i didn't find anything.... can any one help me with this.....................???  and is there any way to open code-warrior project in keil ?????

0 Kudos
Reply
1 Solution
1,413 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello  sachin,

We have one bootloader for kl26 through UART , and include the KEIL version . It will be published on the web soon.

Now i send it to you by attachment .

I think it is easy to porting it to KL16 .

In the attachment , you can fund the KEIL version on :

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

And about the Reference manual you can fund here :

Kinetis-Bootloader-master1027\Kinetis-Bootloader-master1027\Kinetis Bootloader DOC - 0915.pdf .

(This RM is refer to the CW version , while you can refer to ).

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

Alice

View solution in original post

0 Kudos
Reply
4 Replies
1,414 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello  sachin,

We have one bootloader for kl26 through UART , and include the KEIL version . It will be published on the web soon.

Now i send it to you by attachment .

I think it is easy to porting it to KL16 .

In the attachment , you can fund the KEIL version on :

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

And about the Reference manual you can fund here :

Kinetis-Bootloader-master1027\Kinetis-Bootloader-master1027\Kinetis Bootloader DOC - 0915.pdf .

(This RM is refer to the CW version , while you can refer to ).

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

Alice

0 Kudos
Reply
1,413 Views
sachinjoy
Contributor I

Thanks Alice ,,,

I have one more question regarding this,,,,kl26 have 128kb flash and kl16z64 have only 64kb, does this cause any problem ...what all things i should edit in it to make it kl16 IC...

0 Kudos
Reply
1,413 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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 :

pastedImage_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 :

  pastedImage_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
Reply
1,413 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
Reply