Kinetis Bootloader to Update Multiple Devices in a Network - for Cortex-M0+

cancel
Showing results for 
Search instead for 
Did you mean: 

Kinetis Bootloader to Update Multiple Devices in a Network - for Cortex-M0+

No ratings

Kinetis Bootloader to Update Multiple Devices in a Network - for Cortex-M0+

Revise History:

Version 23:

NXP kinetis bootloader GUI upgrade from v1.0 to v1.1:

added 04 extended linear address record  and 02 sector address record processing for hex format.

This article describes how to do in-system reprogramming of Kinetis devices using standard communication media such as SCI. Most of the codes are written in C so that make it easy to migrate to other MCUs. The solution has been already adopted by customers.

The pdf document is based on FRDM-KL26 demo board and Codewarrior 10.6.  The bootloader and user application source codes are provided. GUI and video show are also provided. Now the bootloader source code is ported to KDS3.0, Keil5.15 and IAR7.40 which are also enclosed in the SW package. Customer can make their own bootloader applications based on them. The application can be used to upgrade single target board and multi boards connected through networks such as RS485. The bootloader application checks the availability of the nodes between the input address range, and upgrades firmware nodes one by one automatically.

pastedImage_0.png

Key features of the bootloader:

  • Able to update (or just verify) either single or multiple devices in a network.
  • Application code and bootloader code are in separated projects, convenient for mass production and firmware upgrading.
  • Bootloader code size is small, only around 2K, which reduces the requirement of on chip memory resources.
  • Source code available, easy for reading and migrating.
  • GUI supports S19,HEX and BIN format burning images.

For more information, please see attached document and code.

The attached demo code is for KL26 which is Cortex - M0+ core. For Cortex-M4 core demo, refer this url:

https://community.freescale.com/docs/DOC-328365

User can also download the document and source code from Github:

https://github.com/jenniezhjun/Kinetis-Bootloader.git

Thanks for the great support from Chaohui Guo and his team.

NOTE: The bootloader and GUI code are all open source, users can revise them based on your own requirement.

Enjoy Bootloader programming :-)

Attachments
Comments

Thanks for posting this!  FYI, the document linked at the bottom of your post is restricted and we cannot access it.

Hello,

Thanks for posting the documents.  I signed into the website and was able to download both documents.

Would it be possible for you to also post the source code for the windows gui program, titled "Freescale kinetis Bootloader V1.0"?

It looks like a simple enough program, simple enough that Microsoft .NET Framework 4.0 should not be needed, and even Visual Studio should not be needed.

Two comments about the windows gui program:

>>The program should include a menu bar with 'File', 'Help', and 'About' as a minimum.

>>The drop box that lists the COM ports shows four ports available on my Windows 7 PC, while Device Manager shows only two ports available.  Clicking on 'show hidden devices' brings up several hidden devices, but the two extra ports shown by the windows gui program are not included.

I'd also like an explanation of what the 'Scan' button does, which belongs in the 'help' section.  If it's meant to scan for serial ports, it doesn't work very well.  As a test, I plugged in an additional USB Com port, and after pressing the 'scan' button, it showed up in the list of Com ports, along with the two extra phantom ports mentioned above.

Thanks,   Rich.

Sorry, I should have been more specific.  I can download the two documents, but there's another document referenced in the post itself -- were you able to get to it as well?  I'm using a Cortex M4, and since I'm not an expert with ARM, I thought that the M4-specific info would be more appropriate for me.

Hi dave,

I clicked on the link to the referenced doc, it brought me to a sign in page and I signed in, then it gave me this error message:

Unauthorized

Access to this place or content is restricted. If you think this is a mistake, please contact your administrator or the person who directed you here.

So, no, I can't get to the Cortex M4 document either.
Rich.

Ok, that's what I got as well.  Thank you for checking!

strange. I just tried i can get to this link:

pastedImage_0.png

I will check it with the poster.

thanks for let me know it.

Best Regards,

Jennie

I just posted the GUI source code.

thanks for your advice. this GUI just implements basic function because time limit. I would update it in the next version when I have available time.

thanks!

Best Regards,

Jennie

Hi Jennie,

Great, thanks for source code.

Rich.

hi Rich,

If you could do some work that can improve the GUI performance, welcome to share them here too. thanks!

Best Regards,

Jennie

下载后怎么打不开KDS的那个工程呢?

I just re-upload the SW package, please try to download the Kinetis Bootloader SW.zip then try again.

can it work for you?

Thanks,It can be used 。

在KDS中如何ld文件,才能实现用这个示例代码跳转到我自己的App呢,我的App是用kds编译的,以及我修改了这个示例,我现在是用hex文件升级。

you need make sure app user code starts from 0x1000

besides:

1. you can refer document 3.3.7. User application Linker File Revision.

it is for CW10.6 but the method is quite similar if use KDS.

2. you can also refer User Application Source Code for K22 to port KL26 app to KDS, K22 app were made under KDS3.0. the only difference between K22 and KL26 app is, in KL26 user code starting address is 0x1000; while it is 0x4000 for K22.

Hope this helps!

Jennie

Thanks.But I still have some problem 。

     I have already write the application to falsh,but  is function

          “JumpToUserApplication(*((unsigned long*)RELOCATED_VECTORS), *((unsigned long*)(RELOCATED_VECTORS+4)));  ”

     seem doesn't  to work,What might be the cause? Please give me some advice,thanks。

上面的问题我已经解决了,现在遇到的问题是,我们的bootloader超过了2k,所以我修改了链接文件,导致升级之后,跳转到应运程序运行1.2秒以后就自动重启,又再次进入bootloader了。

in demo code, bootloader is from 0x410-0xfff which is 3k. so if your bootloader is less than 3k, you needn't modify linker file.

if your bootloader end address is over 0x1000, you need make sure the flash protection range covers bootloader (see 3.3.6. Flash Protection). and check if app is in valid app area.

I suggest you also  check SCB_VTOR register, if vector table is successfully relocated.

thank you very much .

hello

i need solver the next problem, when I want to write the W command, the program jumps me

void HardFault_Handler() __attribute__ ((weak, alias("Default_Handler2")));

not how to fix this

thanks

i work with MKM33Z128A thanks

Hello Jennie,

As described in another query

Problems with KinetisUpdater and Boot_Loader apps on KW01

I'm having a problem to flash .hex files bigger than 64K with the Boot_Loader.exe GUI app

Here are some more informations.

I would like to share two files that will gives you way to reproduce the problem!

How can I do that ?

The files are:

user_app_green_blink.hex is the 10K flash app that can be flashed with Boot_Loader.exe

MyWirelessAppCoordinator.hex is a 80K flash app that can't be flashed

The problem encoutered is:

An .hex file is a list of lines command with a specified syntax

A line can be describbed as :BBAAAATTHHHHHH.....HHHHCC

Where:

BB is the bytes number included in the line

AAAA is the absolute starting address of the line

TT defines the type

HHHH are the data

CC is the checksum

When the file includes data for a flash bigger than 64K, the file includes a line with a type TT equal to 04 for Extended Linear Address Record

When TT equals 04, the flash loader should move to the next 64K flash block.

.hex file extract, line with type 04 in bold

:10FFE000100001600F4A126880239A430D4B1A607B

:10FFF0000D4A12680D4B1340802252001A430A4BDF

:020000040001F9

:100000001A600B4A5062704700B50200002905D102

:100010000848036818000006C00F00E0002000BD7B

The GUI app included into BootLoader_SW pack doesn't support the TT type = 04.

When a file that includes such line is selected for flash download, Boot_Loader.exe prompt an error message.

Hope you be able to find the root cause with this.

Kind  regards.

Fabrice Tocci

hello andres,

sorry for the late. I am on vacation.

from my understanding, your CW program jumps to HardFault_Handler()  when receives W command.

for this problem, we have to track CW bootloader code step by step, set a breakpoint when bootloader has received all 0x40 bytes W command data. step over code, are those data programmed to flash successfully?

please track where triggers HardFault_Handler() ?

my latest version revised "I" command, "I" will respond a string of MCU identification and other information from bootloader().  see document Table 2. “Specific data” of Response Frame to command ‘I’

please check it with your device manual if yours is correct.

Best Regards,

Jennie

Hi Fabrice,

thanks for contacting us. I discussed the engineer who developed hex conversion part, you are correct 04 type is not implemented. currently it is in our country public holiday and personal vacation. we will add this feature to GUI as soon as we get back in 2 weeks.

for the moment, please use s19 instead. I had test GUI can burn over-64k data to flash to kl26 without problem.Again, thanks for bringing the problem to our attention.

Best Regards,

Jennie

Hi Jennie,

Thanks for answering so quickly!!

You are right, Boot_Loader.exe works well on .srec files with code over 64k data.

Best Regards.

Fabrice.

Hi Fabrice,

we have updated GUI. Added 04 extended linear address record  and 02 sector address record processing for hex format.

NXP kinetis bootloader GUI upgrade from v1.0 to v1.1.

Best Regards,

Jennie

hi  ZhangJennie

I get an error loading .HEX file , Do I need to modify CW source code?  Or what I must to do?pastedImage_1.png

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

Current time is 17/02/2016 8:38:06 a. m.

The s19 file is: C:\Users\USER\workspace\ENSAYO_SERIAL\FLASH\PCL_V2.hex

Station 1 is trying to enter Boot mode

Error 1 times!

Error 2 times!

Error 3 times!

Hi Fabrice,

from the error messsage "relocated vector address is not matched". this is due to the GUI recorded relocated vector address is not as same as the app hex file defined one.

what's your app code vector relocation address? please check your target bootloader and app code.

when click GUI "program" button, MCU bootloader will send 'I' command to GUI. this command includes app relocation address which is memorized by GUI as a standard one.

please make sure these address definition are matched.

Best Regards,

Jennie

Hi ZhangJennie

the problem is that if I upload the file s.19, works correctly but if upload .hex it does not work, the relocate vector is 0x1000

thanks

Andres

can you please send your bootloader, app project. and s19, hex files to jennie.zhang@nxp.com

I will check. thanks.

HI Andres,

I received your files. the PCL_V2.hex that included in your package is not hex format, you can see it by open with notepad.

hex format should be something like this:

pastedImage_0.png

I use your app project generate a hex format file, it can burn flash with new GUI v1.1 without problem.

please make sure you enable hex formation generation for your app project to generate correct hex file.

pastedImage_1.png

let me know if this can help you.

Best Regards,

Jennie

Version history
Revision #:
1 of 1
Last update:
‎09-20-2015 08:25 PM
Updated by: