Does the Kinetis Bootloader support KL26Z family?

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

Does the Kinetis Bootloader support KL26Z family?

2,548 Views
danieltruong
Contributor IV

In its main page, such devices are not listed.

Kinetis Bootloader|NXP 

 

I'm using MKL26Z256VLL4 device specifically. Need a way to update firmware on the field. Please help.

 

Thanks,

Daniel

Labels (1)
19 Replies

1,598 Views
harshpatel
Contributor IV

Hello Daniel

10.3.1:

I have 2 questions on this:

1. although you typed MKL25Z4, do you actually mean MKL26Z4?

- Yes you are right. i mean MKL26Z4

2. what is the equivalent path for KSDK_2.0 so I can copy exact files? (I tried this path Freescale\KSDK_2.0\devices\MKL26Z4 but it didn't work)

- Well i have not tried using KSDK2.0 but i don't think it may create a problem.  Also you ahve mentioned that "  I tried to copy from both KSDK 1.3" than its fine it must to work.

10.3.2:

1. Do you mean MKL26Z4 instead of KL26Z ?

- You are right..

2. Do you mean copy the entire \NXP_Kinetis_Bootloader_2_0_0\targets\MKL25Z4\  or only the src directory onto \NXP_Kinetis_Bootloader_2_0_0\targets\MKL26Z4\ ? If we copy only the src dir, then the tree structure is not the same and is it OK with the tool?

- We need to prepare directory  \NXP_Kinetis_Bootloader_2_0_0\targets\MKL26Z4 as like as \NXP_Kinetis_Bootloader_2_0_0\targets\MKL25Z4 but with kl26 related files.

Well you are still facing issue you can try one thing as mentioned by fanyang‌(NXP). KL25 and KL26 both are compatible. So just change CPU in KL25Z4 boot-loader code. After that you may need to add #define for KL26 and need to change some path.  I think now It is most shortcut way to try..

Let me know after this try...

Thanks & regards

Harsh

0 Kudos

1,598 Views
harshpatel
Contributor IV

Hello Daniel Truong

Can you please go step by step according to chapter 10 of reference manual?

well according to my view

1] Pick up a fresh code of Kboot 2.0.0  

2] Make a directory MKL26Z4 at \NXP_Kinetis_Bootloader_2_0_0\targets\ 

3] Now follow steps 10.3.1 ,10.3.2 and 10.3.3 carefully. these three are main basic steps if any problem in these steps may generates path related errors as you face.

   - 10.3.1: see KL25 files at \NXP_Kinetis_Bootloader_2_0_0\src\platform\devices\MKL25Z4

   -  Make a directory MKL25Z4 and copy files for KL26Z available at Freescale\KSDK_1.3.0\platform\devices\MKL26Z4

   - 10.3.2 Make a directory KL26Z at \NXP_Kinetis_Bootloader_2_0_0\targets\      

   - now copy KL25Z files from \NXP_Kinetis_Bootloader_2_0_0\targets\MKL25Z4\src. and paste to KL26z directory by changing names from KL25 to KL26

  10.3.3: change start up file at \NXP_Kinetis_Bootloader_2_0_0\targets\MKL26Z4\src\startup\gcc .  available at Freescale\KSDK_1.3.0\platform\devices\MKL26Z4\startup\gcc

  Now Set your project like as shown in Image of 10.3.4  for device MKL26.

and now go ahead with other steps...

Let me know if any...

Thanks & regards

Harsh

0 Kudos

1,598 Views
danieltruong
Contributor IV

Hi Harsh,

I tried the steps you mentioned in chapter 10 of reference manual but wasn't very successful. Your instructions seem to provide more specific details than the reference manual. However, your instructions indicated that I should copy files from KSDK_1.3.0\ whereas I'm using KSDK_2.0.  I tried to copy from both KSDK 1.3 or 2.0, it did not work either way.

 

Have you seen anybody using KSDK 2.0 and succesfully porting from KL25Z to KL26Z?

As for your instructions:

 - 10.3.1: see KL25 files at \NXP_Kinetis_Bootloader_2_0_0\src\platform\devices\MKL25Z4

               -  Make a directory MKL25Z4 and copy files for KL26Z available at Freescale\KSDK_1.3.0\platform\devices\MKL26Z4

I have 2 questions on this:

1. although you typed MKL25Z4, do you actually mean MKL26Z4?

2. what is the equivalent path for KSDK_2.0 so I can copy exact files? (I tried this path Freescale\KSDK_2.0\devices\MKL26Z4 but it didn't work)

 - 10.3.2 Make a directory KL26Z at \NXP_Kinetis_Bootloader_2_0_0\targets\      

            - now copy KL25Z files from \NXP_Kinetis_Bootloader_2_0_0\targets\MKL25Z4\src. and paste to KL26z directory by changing names from KL25 to KL26

This one is nothing to do with SDK, but I have 2 questions to make sure :

1. Do you mean MKL26Z4 instead of KL26Z ?

2. Do you mean copy the entire \NXP_Kinetis_Bootloader_2_0_0\targets\MKL25Z4\  or only the src directory onto \NXP_Kinetis_Bootloader_2_0_0\targets\MKL26Z4\ ? If we copy only the src dir, then the tree structure is not the same and is it OK with the tool?

10.3.3: change start up file at \NXP_Kinetis_Bootloader_2_0_0\targets\MKL26Z4\src\startup\gcc .  available at Freescale\KSDK_1.3.0\platform\devices\MKL26Z4\startup\gcc

Again can you provide the equivalent path in KSDK_2.0 ?

I tried with Freescale\KSDK_2.0\devices\MKL26Z4\gcc , but it did not work.

 

 

Thanks,

Daniel

0 Kudos

1,598 Views
ramboyang
NXP Employee
NXP Employee

Hi Harsh,

Actually, from Bootloader’s perspective, KL25 is basically the same with KL26. So, maybe an alternative way to reduce your development effort is just reusing the KL27 bootloader in KBOOT2.0.

Have a nice day.

0 Kudos

1,598 Views
harshpatel
Contributor IV

Hello Fan Yang

I have not tried it but according to me as application size increases more than 128 Kbyte, KL25 Kboot code may fail to load because KL25z has 128Kbyte flash. In my case, Our custom board is with two controllers KL25128xxx4 and KL26z256xxx4 so i needed two different bootloader codes. well when i have ported for KL26z from KL25z it had taken 4-5 hours only and also it is straight forward.

Well Yang, we had faced too much issues while porting for MK20dxxx10. I want to know that "why NXP not providing Bootloader support for all Kinetis devices?"

Thanks & regards

Harsh

0 Kudos

1,598 Views
ramboyang
NXP Employee
NXP Employee

Hi Harsh,

KBOOT calculates actual Flash size at runtime, so maybe you won’t meet the scenario that KL25 bootloader doesn’t support the image size exceeds 128KB, Of course, it would be great if you have ported a KL26 bootloader successfully.

Regarding the MK20dxxx10 Bootloader porting, I am not clear about which issues you have encountered.

Best wishes.

0 Kudos

1,598 Views
harshpatel
Contributor IV

Attached here with patch file which includes changes in Kboot 1.2.0 to add KL26 support.

0 Kudos

1,598 Views
harshpatel
Contributor IV

Hello Daniel Truong

The steps you have mentioned are not sufficient. follow each steps of chapter 10 carefully.

Let I share steps which i have followed for Kboot1.2.0. take a reference of this and follow same steps for Kboot 2.0.0:

Porting for KL26Z:

  • There is no support of KL26z in freescale bootloader. Kl26z support is added.

  1. Directory Added:

    -src/startup/MKL26Z4

    -src/include/device/MKL26Z4

  2. Files Added:

    - MKL26Z4.h at /src/include/device/MKL26Z4

    - MKL26Z4_features.h at /src/include/device/MKL26Z4

    - fsl_bitaccess.h at /src/include/device/MKL26Z4

    - system_MKL26Z4.h at /src/include/device/MKL26Z4

    - startup_MKL26Z4.S at /src/startup/MKL26Z4/gcc/

    - system_MKL26Z4.c at /src/startup/MKL26Z4

    - clock_config_MKL26Z4.c at targets/MKL26Z4/src

    - hardware_init_MKL26Z4.c at targets/MKL26Z4/src

    - memory_map_MKL26Z4.c at targets/MKL26Z4/src

    - peripherals_MKL26Z4.c at targets/MKL26Z4/src

    - peripherals_msd_MKL26Z4.c at /targets/MKL26Z4/src

    - system_MKL26Z4.c at targets/MKL26Z4/src/

    - target_config.h at /targets/MKL26Z4/src/

    - added linker files at /targets/common/linker/kds/MKL26Z4/

  3. CPU "CPU_MKL26Z256VLH4" changed project property-> c/c++ build ->setting -> cross ARM c compiler -> Preprocessor ->debug symbols

  4. Files Modified:

  • File: fsl_device_registers.h

  • Path: /src/include/device

  • Changes: added kl26z256 defination and header file

5. CPU "CPU_MKL26Z256VLH4" changed project property-> c/c++ build ->setting -> cross ARM c compiler -> Preprocessor ->debug symbols

Well Due to some issue i am not able to attach  patch file. Later on i will share it. Just take it as reference because these steps are for KBOOT 1.2.0. some path may vary for kBOOT 2.0.0 but procedures will remain same.

Let me know if any...

------------------------------------------------------------------------------------------------

NOTE: Please Mark it as correct if this post gives your answer.

------------------------------------------------------------------------------------------------

Thanks & regards

Harsh Patel

0 Kudos

1,598 Views
danieltruong
Contributor IV

Hi Harsh,

Thanks for extending your efforts to help me out here.

I'm using KBOOT v2.0 and I don't see any directory under both paths you mentioned, only files: 

-src/startup/

-src/include/device/

However, I do see:

-targets/MKL25Z and others

-targets/common/linker/kds/MKL25Z4 and others

So according to your statement "Just take it as reference because these steps are for KBOOT 1.2.0. some path may vary for kBOOT 2.0.0 but procedures will remain same", I just followed your instructions and did the followings:

1. Ignored adding the directories/files under those 2 paths (src/) and just added MKL26Z4 dir and associated files under targets/  and targets/common/linker/kds

2. For good measure, I also added those things under src/platform/devices

3. For 2 items above, in order to create new MKL26Z4 dir and files under it, I followed a common strategy of copying the existing MKL25Z4 and renamed everything to MKL26Z4. Everything was going well, except a small problem: I failed to create the file MKL26Z256xxx4_application_0x0000.ld, since MKL25Z256xxx4_application_0x0000.ld did not exist.

4. I also modified the file fsl_device_registers.h, which is now under src/platform/devices/MKL26Z4 to include the microcontroller CPU_MKL26Z256VLH4

5. I checked the step you mentioned CPU "CPU_MKL26Z256VLH4" changed project property-> c/c++ build ->setting -> cross ARM c compiler -> Preprocessor ->debug symbols, the tool was defaulted to DEBUG anyway

6. Create a new project in KDS by importing the modified Kboot v2 (after step 1->4)

7. Changed the setting of some paths under Projects->Properties->C/C++ Build->Settings

8. However, I still got a lot of errors in compiling. Here are what I got:

Capture1.PNG

Capture2.PNG

As you can see, there are some de-highlighted paths in the Project Explorer window which the tool either:

1. can't find them because they don't exist, such as C:/Users/daniel.truong/Documents/NXP KDS Projects/src

OR

2. in the case the paths exist, there must be some kind of problem, such as freedom_bootloader/src/platform, etc

For problem 1., I went through all the menus/tabs/windows I could find inside the KDS. I could not spot anything that points to the path above. Perhaps it was hidden somewhere in some *.h file.

For problem 2., I have no idea why the tool is not happy about those paths. Maybe the setup is still not right.

--Daniel

0 Kudos

1,598 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Daniel,

  Add the according attachment.


Have a great day,
Kerry

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

1,598 Views
danieltruong
Contributor IV

Kerry,

First of all, thank you so much for giving a pointer on the User Guide pdf, as well as all the details that I need to get started on the right track.

However, I encountered a problem in step 2 when I tried to download the bootloader into my board.

I used the same Debug Configuration launch as yours because I also used a J-Link debugger via SWO header to the board. It failed to launch with message "errors existed in active configuration". 

There are a lot errors of the following type shown on the console (only 4 of many are listed)

...

make -k all
make: *** No rule to make target 'C:/Users/daniel.truong/src/utilities/src/fsl_assert.c', needed by 'src/utilities/src/fsl_assert.o'.
make: *** No rule to make target 'C:/Users/daniel.truong/src/utilities/src/fsl_rtos_abstraction.c', needed by 'src/utilities/src/fsl_rtos_abstraction.o'.
make: *** No rule to make target 'C:/Users/daniel.truong/src/usb_stack/usb_core/hal/fsl_usb_khci_hal.c', needed by 'src/usb_stack/usb_core/hal/fsl_usb_khci_hal.o'.
make: *** No rule to make target 'C:/Users/daniel.truong/src/usb_stack/usb_core/device/sources/controller/khci/khci_dev.c', needed by 'src/usb_stack/usb_core/device/sources/controller/khci/khci_dev.o'.

...............

I'm wondering whether or not it's due to the conflict in Kinetis families. I noticed there are a lot of "kl25z4" notation in the bootloader whereas my board is KL26Z-based ? That prompts me with the following questions:

1. You said you sent your KL26Z bootloader to me, right? Why is the folder's name under target dir still KL25Z4? Is the KL26Z a spelling error and you didn't mean that?

2. If it was KL25Z4 and a conversion was needed (as it is called porting in Chapter 10 of the Reference Manual), I attempted to follow instruction in Ch 10, but I was stuck right in the first step (section 10.3.1. Download the device header file). The instruction said "NXP provides CMSIS-compatible packages for all Kinetis devices that contain bootloader-compatible device header files. These packages can be found on the product page for the MCU.".

I could not find anything close to such naming in the product page.

Can you please provide a link or the exact name of the package so it would help in my search for the right one?

3. Your instruction provided ways to modify the application code (change the offset in linker file) to change location of application area in flash. That was very helpful, but I'm still searching an answer on how to change code in the bootloader area in order to force the micro to make decision whether to enter "bootload mode" or to jump to user application (i.e. upon sensing a boot switch). What particular file in the bootloader source tree should I modify to achieve that purpose?

Thanks,

Daniel

0 Kudos

1,598 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Daniel Truong,

    

     Now answer your several questions:

1. build errors.

   Did you use my attached project directly?

   Your problem should caused by missing the source file, or the headfile in the include path.

2. KL25 in the project.

KL25's code can run in KL26 directly, to the uart flash bootloader, it is the same, KL26 can downward compatible with KL25.

   You use my attached code before in your KL26, I already test it on my FRDM-KL26 board.

  If you really want to use the KL26, it is also very simple, just modify the headfile to KL26 headfile. Then select the part number as KL26 in the project.

3. CMSIS header file download link

  You can refer to the KSDK2.0 sample code, which can be download from this link:

Welcome to Kinetis Expert | Kinetis Expert

Build an SDK, choose FRDM-KL26, then generate the code and download it, you can find the head file in folder:SDK_2.0_FRDM-KL26Z\devices\MKL26Z4

I also attached the MKL26Z4 according head files for your reference .

4. decision whether to enter "bootload mode" or to jump to user application

You can find these functions in the uart bootloader which I give you before. These function should in the bootloader, not the in application code.

After power up, the code will enter bootloader code automatically, then it will wait you update the application code, if you didn't update the application code, after timer out, it will jump to the user application code. If you want to decide it, you just need to printf some data in the bootloader or the app to check it.

Wish it helps you!

If you still have question, please let me know!

Have a great day,
Kerry

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

0 Kudos

1,598 Views
danieltruong
Contributor IV

Hi Kerry,

After trying to debug my Build error issue, I think I'm in a deep hole now with no way out. So I really need your help to sort this thing out, because NXP official documentation didn't help much.

Here is what I did so far in following your instruction.

1. Downloaded your "FSL_Kinetis_Bootloader_1_2_0" package and installed in a local directory.

2. Renamed the folder under "FSL_Kinetis_Bootloader_1_2_0/targets/MKL25Z4" to "MKL26Z4"

3. Downloaded your MKL26Z4, copied it into  "FSL_Kinetis_Bootloader_1_2_0/src/include/device" directory (note that I have been working with KSDK v2.0 on my MKL26Z4-based for many months now, so I have that folder already but I'm using yours anyway).

4. In KDS, I imported the existing project at the root directory (FSL_Kinetis_Bootloader_1_2_0/targets/MKL25Z4/kds) into my workspace (only freedom_bootloader box checked, tower_bootloader box unchecked)

5. Immediately upon importing this project, I see a lot of paths in the "freedom_bootloader/Includes" directory in the Project Explorer are de-highlighed signaling these paths are wrong already.

Capture1.PNG

The reason for this is under Project->Properties->C/C++ Build/Settings, the paths were set up like this:

Capture2.PNG

6. So I changed all of them to this (to match the hierarchy in KDS - I made a copy inside my workspace while importing). Capture3.PNG 

After I did this, all paths in the Includes dir were back highlighted, EXCEPT one as follows:

Capture5.PNG

As you can see, there is still something wrong with the path "src/include/device" although the path exists. Maybe there is something to do with the new folder I copied in there in step 3 above.

7. I tried to rebuild the project again but still got the following errors:

Capture6.PNG

Apparently, somewhere the make file defines the paths for these files the way they are shown. Obviously the errors are due to the wrong paths (there is no "src" directory under "C:/Users/daniel.truong/"). I just don't know how to change the setting to correct these paths. Can you please help?

0 Kudos

1,598 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Daniel,

  Just as Harsh has said, you can refer to the KL25 kboot flash bootloader code, KL26 can compatible with KL25.

  Please download the KBOOT2.0 at first from this link:

https://www.nxp.com/webapp/Download?colCode=NXP_KINETIS_BOOTLOADER_2_0_0&appType=license&Parent_node... 

The KL25 flash bootloader can be found from this folder:

NXP_Kinetis_Bootloader_2_0_0\NXP_Kinetis_Bootloader_2_0_0\targets\MKL25Z4

Besides KBOOT2.0, you also can refer to AN2295, this is also the uart bootloader.

Wish it helps you!


Have a great day,
Kerry

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

1,598 Views
danieltruong
Contributor IV

Kerry/Harsh,

Thank you for answering my question. However, I'm new to this Bootloader thing especially from the implementation point of view. So I downloaded the KBOOT link you sent above and after reading the Reference Manual, I'm still getting lost as to what specific procedure to follow to integrate the Bootloader code with my code. Porting aside, I guess that I still need some kind of "user guide" that gives instructions from A to Z on how to do this integration. That would help me to clear up all the basic questions such as:

 

1. How can I bring the original bootloader code (before modification) into my project using KDS v3.2.0?

2. Where is the linker file located in the project so that I can modify the offset?

3. I have a momentary switch on the board that acts as a way (when pressed) to tell the bootloader to switch to "bootloader mode" as opposed to bypassing it and going straight to user application. What file(s) in the bootloader folder do I need to modify to create a custom flash resident bootloader ? 

Thanks for your help.

--Daniel

0 Kudos

1,598 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Daniel,

 Please read Kinetis Bootloader Demo Application User's Guide.pdf in the KBOOT doc folder carefully at first. You can try the official FRDM-kl26 board at first.

Now, I take FRDM-KL26 board and the JLINK debugger firmware as an example, please also use my attached KL25 bootloader.

The following will give you the detail step how to download the bootloader to the board, and how to use the kinetisFlash tool to download the application code.

1. You can use the debugger to download the code to your KL26 board. The debugger can be JLINK, opensda to download the bootloader to the chip.

   My board is using JLINK firmware:

pastedImage_1.png

2. Use KDS open :FSL_Kinetis_Bootloader_1_2_0\targets\MKL25Z4\kds\freedom_bootloader

  Please use my attached Kboot for KL26.

pastedImage_3.png

Because I am using the JLINK debugger, so choose JLINK file to download. And exit the debug mode,then the bootloader code has downloaded to the board.

3. Modify the application code.

 I am using the KSDK2.0-FRDM-KL26 code as the application code, and modify the offset address to 0x8000, because the bootloader already define the app address to 0x8000;

Application source code folder:

SDK_2.0_FRDM-KL26Z\boards\frdmkl26z\driver_examples\gpio\led_output

Now modify the link file to change the application start address, take IAR project link file as an example:

pastedImage_4.png

Change the interrupt start, text start to base 0x8000, instead of the 0x0000;

Generate the bin file. I have attached the modified bin file in :FSL_Kinetis_Bootloader_1_2_0\KinetisFlashTool\win\KL25\gpio_led_output_0x8000.bin

4. open FSL_Kinetis_Bootloader_1_2_0\KinetisFlashTool\win\KinetisFlashTool

pastedImage_5.png

(1) Browse

  Choose FSL_Kinetis_Bootloader_1_2_0\KinetisFlashTool\win\KL25\gpio_led_output_0x8000.bin

(2) Target address

 Choose 0X8000

(3) Choose port as your board's COM in the PC, then click connect.

(4) Click Update button.

You will find the code is updated to the chip with uart bootloader.

Now my board is blinking the red light which is the function of the application code.

Wish  it helps you!


Have a great day,
Kerry

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

0 Kudos

1,598 Views
harshpatel
Contributor IV

Hello Kerry

Well i have used Kboot and An2295 but found that An2295 is not as power full as Kboot. ri8?

0 Kudos

1,598 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Harsh,

  KBOOT is the new bootloader, it contains all the full function and support more kinetis chip than AN2295. AN2295 is the old uart bootloader. So, normally, we recommend the customer to use the KBOOT, AN2295 just another select for uart bootloader.


Have a great day,
Kerry

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

0 Kudos

1,598 Views
harshpatel
Contributor IV

Hello Daniel

You can port bootloader for your target device MKL26Z256VLL4 by getting reference of MKL25Z4.

Refer chapter 10 of attached document. 

Porting is quit straigth forward just follow all the steps of chapter 10 carefully. 

Hope it works

Let me know if any.

==============================================================

PLEASE MARK IT AS CORRECT IF IT HELPS

===============================================================

Thanks & regards

Harsh Patel