USB-MSD bootloader for KL43Z

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

USB-MSD bootloader for KL43Z

Jump to solution
1,067 Views
piotrcerba
Contributor III

I am having trouble finding a way to implement USD-MSD bootloader in my board.

It was suggested as a solution for my needs in this thread: Easy bootloader for updates and configuration data for an end user

From the application notes AN4368 and AN4379 it looks like it is already present in the device, even the name of the bootloader I have sent to the board contains "USB-MSD" (MSD-DEBUG-FRDM-KL43Z48M_Pemicro_v117).

1. If it is present - how to configure it so that it creates two folders, one with app code and the other with config data?

2. If it is not, then where do I download it? How do I apply and configure it?

NOTE: I just want the device functionality. The board does not need to be the host.

Any help is very appreciated!

Labels (2)
Tags (3)
0 Kudos
1 Solution
812 Views
mjbcswitzerland
Specialist V

Hi

1. If you have OpenSDA on the board the loaded firmware can be easily read back (it acts as a debugger).

If you secure the KL43 the debugger will stop working but also the OpenSDA boot loader will become inoperable as well. Therefore you really need the USB-MSD loader in the KL43 and not in the OpenSDA's K20 because this will never give you the solution that you are really aiming at.

2. The OpenSDA USB-MSD loader also accepts binary files. It will not work with ELF files.

3. To convert ELF to SREC or BIN simply use GCC "objcopy"

Regards

Mark

Kinetis: µTasker Kinetis support

KL43: µTasker FRDM-KL43Z support  / µTasker TWR-KL43Z48M support

For the complete "out-of-the-box" Kinetis experience and faster time to market

View solution in original post

7 Replies
812 Views
mjbcswitzerland
Specialist V

Piotr

""USB-MSD" (MSD-DEBUG-FRDM-KL43Z48M_Pemicro_v117)" is the loader for the OpenSDA K20 on the KL43 board and so has nothing to do with the SW in the KL43 itself. It allows programming software to the KL43, adds a virtual COM port and a debugger.

If you have the same K20 HW on your board you could use it as a boot loader to the board but it won't appear as two drives and therefore won't allow uploading also config data (unless as part of a complete program).

Regards

Mark

Kinetis: µTasker Kinetis support

KL43: µTasker FRDM-KL43Z support  / µTasker TWR-KL43Z48M support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos
812 Views
piotrcerba
Contributor III

Thank you Mark for answering.

My configuration file is just going to be a separate header file with some DEFINEs, at least as of now. So I guess that this two folder configuration won't be needed that much.

1. How about securing the device? Can I obtain it with the bootloader I already have (OpenSDA)?

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

Besides, I have found the USB-MSD Device bootloader version 1.0 on the site, after typing AN4379SW to the search bar.

It seems to be a pretty old archive, with creation date far from the introduction of Kinetis Design Studio. Is there any newer version for KL4x boards?

If no, then is the information present in AN4379 still applicable (Porting USB MSD device bootloader to other platforms)?

I don't understand several steps of porting to a new board eg.:

"Modify the linker command file to segment the bootloader and application, and allow the bootloader to be in protected flash."

Also - are the code snippets suitable for any board? I mean all those defines like:

#define MIN_RAM1_ADDRESS 0x20000000

#define MAX_RAM1_ADDRESS 0x2000FFFF

#define MIN_FLASH1_ADDRESS 0x00000000

#define MAX_FLASH1_ADDRESS 0x0007FFFF etc.

I just don't want to lock my board. That is why I am very cautious with those modifications.

Thank you in advance for any suggestions!

0 Kudos
812 Views
mjbcswitzerland
Specialist V

Hi

Most tools don't allow you to secure a device but to be absolutely sure just open the binary file that you have generated with a binary editor and inspect the content between 0x400 and 0x40f - check that it is as you expect it to be (the content of the security byte not matching anything that could cause problems) and then you will never load anything that could cause problems.

I don't have any more details about AN4379SW than you but it will certainly not be operational with Windows 8.1 or MAC OSX unless it has been updated since its introduction. Don't forget that there is a complete solution for USB-MSD on your processor at the link below in case your project can't handle the cost and time delays of porting the AN and updating it to Win 8.1 compatibility.

Regards

Mark

Kinetis: µTasker Kinetis support

KL43: µTasker FRDM-KL43Z support  / µTasker TWR-KL43Z48M support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos
812 Views
piotrcerba
Contributor III

Thank you again.

Regarding securing of the device: I just want to protect it from some kind of reverse engineering and allow updates at the same time.

1. Can I lock the device unintentionally when I do something incorrect while following AN4379?

2. What about KBoot? Can I use it instead of USB-MSD? Or is it a completely different product?

0 Kudos
812 Views
mjbcswitzerland
Specialist V

Hi

1. Theoretically it is always possible to unintentionally lock a device, however it would need a drastically misconfigured project to happen.If you start based on something working it will probably never happen. Other than that, the advice in the previous post is still valid.

2. KBOOT supports loading via various interfaces. If loading via USB, it can be used together with the KBOOT utility program. However it doesn't really have any advantages over USB-MSD since it requires the user to install SW on the PC (including about 1GBytes of Microsoft framework so that it will run), and is not as easy to use as USB-MSD.

Securing device:

In the uTasker serial loader I use this when not secured:

#define KINETIS_FLASH_CONFIGURATION_SECURITY (FTFL_FSEC_SEC_UNSECURE | FTFL_FSEC_FSLACC_GRANTED | FTFL_FSEC_MEEN_ENABLED | FTFL_FSEC_KEYEN_ENABLED)

and

#define KINETIS_FLASH_CONFIGURATION_SECURITY (FTFL_FSEC_SEC_SECURE | FTFL_FSEC_MEEN_ENABLED | FTFL_FSEC_KEYEN_ENABLED)

when all debug access is denied.

Note that if FTFL_FSEC_MEEN_ENABLED is disabled it is possible to completely lock a device so that it can never be recovered again.

Regards

Mark

Kinetis: µTasker Kinetis support

KL43: µTasker FRDM-KL43Z support  / µTasker TWR-KL43Z48M support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos
812 Views
piotrcerba
Contributor III

I appreciate your posts very much!

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

I will express my question in another way. As it has been said at the beginning of the topic - I have the default OpenSDA bootloader, which represents the board as a removable drive.

1. I only need to know if the software sent to the board can be read by the end user. Will it be possible to extract the binary/hex from the board? Maybe there is no reason for me to secure the board in any way?

2. From Freescale Quick Start Guide I see that the board accepts precompiled examples in .srec format. Is it the only file extension that is accepted? Is "installing" a normal .elf also accepted by dragging and dropping on FRDM-KL43Z drive?

3. If not - how to obtain a .srec file?

Best regards,

Peter

0 Kudos
813 Views
mjbcswitzerland
Specialist V

Hi

1. If you have OpenSDA on the board the loaded firmware can be easily read back (it acts as a debugger).

If you secure the KL43 the debugger will stop working but also the OpenSDA boot loader will become inoperable as well. Therefore you really need the USB-MSD loader in the KL43 and not in the OpenSDA's K20 because this will never give you the solution that you are really aiming at.

2. The OpenSDA USB-MSD loader also accepts binary files. It will not work with ELF files.

3. To convert ELF to SREC or BIN simply use GCC "objcopy"

Regards

Mark

Kinetis: µTasker Kinetis support

KL43: µTasker FRDM-KL43Z support  / µTasker TWR-KL43Z48M support

For the complete "out-of-the-box" Kinetis experience and faster time to market