Kinetis Bootloader

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

Kinetis Bootloader

1,761 Views
neilporven
Senior Contributor I

Hi everyone,

I don't understand how the Kinetis bootloader work?

I would like to do field updates using the SDHC peripheral and a SD card.  From some of the reading,

it doesn't look like the SDHC is one of the peripherals it supports.  I don't have an issue with

it (not supporting the SDHC) because I already have the SDHC + FatFs working.  I am trying

to understand how to tie the Kinetis bootloader to the SDHC + FatFs ?

How is this achieved?  In the bootloader reading it states that the source is available, but there isn't a link

or a document that explains how to tie the bootloader to a peripheral?

Can someone help me with this?

Neil Porven

Tags (2)
10 Replies

1,065 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Neil:

Just like David says, I would not suggest that approach of trying to add SD Card support to KBOOT. While source code is provided, it might require much effort.

It would be better to create your bootloader from scratch or use an existing one, like Mark's loader or take other bootloaders as reference, for example this:

SD Card Bootloader :how to using SD card to update existing firmware on CodeWarriror or KDS

Regards!

Jorge Gonzalez

1,065 Views
neilporven
Senior Contributor I

Thank you all David, Mark, and Jorge.

I am using SD Card Bootloader :how to using SD card to update existing firmware on CodeWarriror or KDS​ as reference to

create the bootloader. 

As I stated above, the SD Card I already have working and I can easily integrate it to the bootloader.  I reviewed what was done

on the reference above.  Is there documentation on how to use the driver flash?

Neil

0 Kudos

1,065 Views
DavidS
NXP Employee
NXP Employee

Hi Neil,

We used to rely in Flash Driver's from our internal Flash Team and now we are transitioning to using the KSDK drivers.

But you can get the older flash driver that was used in the Link you provided for the SD Card Bootloader here :

TFS Flash Driver Software for Kinetis and ColdFire+ Microcontrollers (REV 1.03)

28 Oct 2014 Driver software for C90TFS flash devices including the Kinetis and ColdFire+  families. These drivers are meant to be compiled into an embedded application ...

Download, Install, and look in:

~Standard_Software_Driver_v1.03/C90TFS folder for FSL_eNVM_FTFx_UM.pdf.

Regards,

David

1,065 Views
neilporven
Senior Contributor I

Thank you David.

I noticed that you said that now the transition is to the KSDK drivers.  Does the KSDK have a

bootloader driver?

Suggestion:  It will be neat to have a document like the one Jorge Gonzalez did, for the SD card for a

bootloader.  I found it to be helpful and it went step by step guiding the user.  I believe others will agree

as well.

I will look into what you suggested.  Currently I am looking at the reference above and trying to link

what needs to change (which I imagine are just memory address) from the TWR-K60F120 (K60P144M120SF3)

to the FRDM-K64F for the bootloader example.

Best Regards,

Neil

0 Kudos

1,065 Views
neilporven
Senior Contributor I

Hi David,

I just found this in the KSDK (KSDK->Platform->drivers->src->flash).  I guess that answers my question regarding

the bootloader for the KSDK and there being an existing one.  I also see that it says C90TFS, so it is the same as

what I am following in that example.

Can you tell me what is the difference if there is one?

Best Regards,

Neil

0 Kudos

1,065 Views
DavidS
NXP Employee
NXP Employee

Hi Neil,

They are one and the same.  KSDK is now the method for providing the drivers to customers.

Regards,

David

0 Kudos

1,065 Views
neilporven
Senior Contributor I

Update,

I switched to the KSDK flash driver.  Now, I am following the MKL25_EEPROM_CW103.zip example.

I find that all the examples use a function called NormalDemo.

In the documentation: FSL_eNVM_FTFX_UM , I found a structure that needs to be set

typedef struct _ssd_config

{

uint32_t ftfxRegBase;

uint32_t PFlashBase;

uint32_t PFlashSize;

uint32_t DFlashBase;

uint32_t DFlashSize;

uint32_t EERAMBase;

uint32_t EEESize;

bool DebugEnable;

PCALLBACK CallBack;

} FLASH_SSD_CONFIG, *PFLASH_SSD_CONFIG;

under the NormalDemo.h I see how some of these parameters were set:

/* FTFL module base */

#define FTFx_REG_BASE                  0x40020000    

#define PFLASH_BLOCK_BASE         0x00000000

#define DEFLASH_BLOCK_BASE      0xFFFFFFFF     

#define EERAM_BLOCK_BASE          0x14000000

#define PBLOCK_SIZE                      0x00020000      /* 128 KB size */

#define EERAM_BLOCK_SIZE          0x00000000      /* 0 KB size */

#define PFLASH_OUT_OF_RANGE  0x00020000 /* out of Pflash range */

#define DFLASH_OUT_OF_RANGE  0x15000000 /* L2K does not have D-FLASH */

#define PFLASH_START_ADDR       0x00000000 /* PFlash start address */

#define DFLASH_START_ADDR         DEFLASH_BLOCK_BASE /* DFlash start address */

#define EE_ENABLE                         0x00

#define RAM_ENABLE                      0xFF

#define PFLASH_IFR_ADDR            0x00000000

#define DFLASH_IFR_ADDR            0x00800000

My question is how do I know what values to populate?  By the way, I am using the processor for

the FRDM-K64F evaluation board.

It seems that after that step, eeprom_demo is called from the main and that's were they test writing

to that particular area of RAM.

I need help with this, to understand how this works.

thank you,

Neil

0 Kudos

1,065 Views
DavidS
NXP Employee
NXP Employee

Hi Neil,

I would recommend sticking with the flash example in KSDK_1.3 and not the older ZIP file you have.

The KSDK_1.3 is more up-to-date and is the method Freescale is using to distribute the flash driver.

Regards,

David

0 Kudos

1,065 Views
DavidS
NXP Employee
NXP Employee

Hi Neil,

My $0.02.

First the KBOOT does not support boot from SDHC (i.e. SD Card).

The question is "Is it possible to make the KBOOT do what you want".

My answer to that is anything is possible but not sure it is practical.

I would suggest developing an application from the existing demo to get SD Card (with a MFS FAT filesystem) going.  After tuning to your needs rename it to be called a "bootloader" and then develop your real application to run from upper flash space and have its vector table in RAM as the bootloader will own the flash vector table.

Note it is possible with Kinetis to have the application have vector table in flash...just not using the same vector table as the bootloader.

A perfect starting point would be KSDK_1.3 :

C:\Freescale\KSDK_1.3.0\middleware\filesystem\mfs\examples\sdcard\build\kds\sdcard_twrk64f120m

Their is a Freedom frdm-k64f120m version too.

I only tested on Tower as fyi.

Regards,

David

1,065 Views
mjbcswitzerland
Specialist V

Hi Both

The uTasker serial loader supports SD card loading:

- for 46 standard Freescale boards

- using SPI or SDHC

- With encrypted mode to distribute and load code which cannot be reverse-engineered

- Builds with 10 IDEs (incl. CodeWarrior, KDS, IAR, Keil, CooCox, etc.)

- Small footprint (Kboot, SD card, USB-MSD in parallel < 32k)

- Can be completely simulated for study or analysis purposes

- Completely documented (no additional work for audits etc.)

- Proven in many projects and products and so risk-free

- Works with applications from any other souce

- Fully supported for professional use

SD card mode can be mixed with USB-MSD to SD card operation.

Can also be mixed with KBOOT compatible (UART and/or USB-HID), S-REC, USB-MSD, Memory Stick, or Ethernet web server (combined as required)

No development and no porting necessary.

Therefore, projects requiring the most powerful and economical solution can be solved within an hour so that developers can concentrate on their application!

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html

Serial Bootloader (Ethernet, USB, MSD, KBOOT, AN2295, SREC, SD-card): http://www.utasker.com/forum/index.php?topic=1873.msg6796#msg6796 / http://www.utasker.com/docs/uTasker/uTaskerSerialLoader.PDF

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

:smileyinfo: Out-of-the-box boot loader support for 46 Kinetis boards, 8 modes and 10 IDEs (over 15'000 combinations from a single code source with no porting required)