Porting a bootloader to k20 MCU

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

Porting a bootloader to k20 MCU

2,175 Views
eduard2566
Contributor I

Hello everyone,

 

I'm trying to port a bootloader to a k20 MCU. Reading the reference manual chapter 10 ( which talks about bootloader porting).

I really don't know if this is possible in this particular MCU or if someone has aldready done.

I'm using KDS to port the bootloader.

 

The first step talks about editing the header files, provided by NXP as CMSIS-compatible packages, has someone any idea where to find them? And if not, is there any other way to implement a bootloader to k20 MCU?

 

Thank you in advance,

 

Eduard

Labels (1)
0 Kudos
7 Replies

1,455 Views
harshpatel
Contributor IV

Hello Eduard

I thinks its fine keep it up. well some more file need to be modify. Let me attach list of files i had modified when i have successfully ported.it may help you more.  Just take a reference of it because my target controller was MK20DX256xxx10.

Files Modified:
File: fsl_device_registers.h
Path: /src/include/device
Changes:

  • added Mk20d10 defination and header files

 Files Modified:
File: botloader_config.h
Path: targets/MK20D25610/src
Changes:

  • Changed application jump location BL_APP_VECTOR_TABLE_ADDRESS to 0x5000.

 Files Modified:
File: startup.c
Path: src/startup/
Changes:

  • init_interrupts function added

 File Modified: hardware_init_K20D256.c
Path: targets/MK20D25610/src/hardware_init_K20D256.c
Changes:

  • changed UART1 Pin muxing (UART1_RX_GPIO_PIN_NUM0-1 to UART1_RX_GPIO_PIN_NUM 14-15).
  • changed IRQHandler.
  • Changed Interrupt setting PORTE to PORTA at all the places.

 File Modified: target_config.h
Path: targets/MK20D25610/src/target_config.h
Changes:

  • kMaxCoreClock changed to 96000000u.
  • kMaxBusClock changed to 48000000u.
  • kMaxFlashClock changed to 24000000u

 File Modified: memory_map_K20D256.c
Path: targets/MK20D25610/src/memory_map_K20D256.c
Changes:

  • memory settings changed according to Mk20d25610 memory.

 CPU "CPU_MK20DX256VLL10" changed at project property-> c/c++ build ->setting -> cross ARM c compiler -> Preprocessor ->debug symbols

Need to change linker file

Let me know if any...

Regards,

Harsh

0 Kudos

1,455 Views
harshpatel
Contributor IV

Hello Eduard Pérez

i have already ported for K20DX256xxx10. 

Take a reference of MK22F12810 code if you want to port for mk20dx256xxx10.  

MK22f25612 for Mk20dx256xxx12.

If you have installed Kinetis design studio than you will get all related header files from \Freescale\KSDK_1.3.0\platform\devices.

Follow chapter 10 of user reference manual.

Let me know if any...

Regards

Harsh

0 Kudos

1,455 Views
eduard2566
Contributor I

Hello Harsh Patel

I keep trying to port the bootloader following step by step the instructions of reference manual:

The context is:

- Bootloader porting MCU= MK20DX256VHL7  

- Reference MCU= MK22F12810 (is that correct?, closest match?)

- CMSIS files, located C:\Freescale\KDS_v3\eclipse\ProcessorExpert\Config\PE\CPE\wizard_data\wizards\kds\MK20D7

(device header files)

- Downloaded NXP_Kinetis_Bootloader_2_0_0

  1. Copy C:\Freescale\KDS_v3\eclipse\ProcessorExpert\Config\PE\CPE\wizard_data\wizards\kds\MK20D7 which contains "Include" and "Source" sub-folders to /src/platform/devices (unziped NXP_Kinetis_Bootloader_2_0_0 folder)
  2. Copy NXP_Kinetis_Bootloader_2_0_0\src\platform\devices\MK22F12810 to NXP_Kinetis_Bootloader_2_0_0\targets and rename NXP_Kinetis_Bootloader_2_0_0\src\platform\devices\MK22F12810 to NXP_Kinetis_Bootloader_2_0_0\src\platform\devices\MK20D7
  3. Browse the new renamed folder and rename the following files like this:

         In NXP_Kinetis_Bootloader_2_0_0\targets\MK20D7\src

           clock_config_K22F128R ------>  clock_config_MK20D7

           hardware_init_K22F128R -----> hardware_init_MK20D7

           memory_map_K22F128R ----->memory_map_MK20D7

           peripherals_K22F128R---------> peripherals_MK20D7

 

From now I've followed this steps can somebody see an error, if so, let me know it.

Thank very much,

Eduard

0 Kudos

1,455 Views
mjbcswitzerland
Specialist V


Hi

A note about uTasker KBOOT compatible loader and K20s:

- support KBOOT compatible UART, USB-HID and/or MSD
- supports additional options for SD card, memory stick, Ethernet
- Documented at http://www.utasker.com/docs/uTasker/uTaskerSerialLoader.PDF
- Fully tested and operational without any porting

For various K20s see:
- http://www.utasker.com/kinetis/FRDM-K20D50M.html
- http://www.utasker.com/kinetis/TWR-K20D50M.html
- http://www.utasker.com/kinetis/TWR-K20D72M.html
- http://www.utasker.com/kinetis/TEENSY_3.1.html
- http://www.utasker.com/kinetis/tinyK20.html
- Also includes K20F support which has been used in various products based on these parts

- Further potential benefits are smaller code size and greater IDE choice (CW, KDS, IAR, Keil, Atollic, Rowley, CooCox, Green Hills, GCC stand-alone and VisualStudio)

Regards

Mark
Kinetis for professionals: http://www.utasker.com/kinetis.html

0 Kudos

1,456 Views
eduard2566
Contributor I

Hello David,

First of all lot of thanks for the answer. I use a K20 at 72MHz in particular a mk20dx256, I've just downloaded the ksdk and used the SDK builder tool to download the corresponding package, the path in my case is C:\nxp\SDK_2.0_MK20DX256xxx10\devices\MK20D10.

Is that the correct one? I'm going to use the MK22F25612 as the closest match MCU to copy the header files, is there any way to asure this is a good option to choose?

Thanks a lot.

Regards,

Eduard

0 Kudos

1,455 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hi Eduard,

The CMSIS files mentioned in the KBOOT Reference Manual are available from KDS installation. In this case for K20_72 MHz device this would be the path:

C:\Freescale\KDS_v3\eclipse\ProcessorExpert\Config\PE\CPE\wizard_data\wizards\kds\MK20D7

However, the porting process might be tricky if you are not experienced with Kinetis. You can port the AN2295 project (serial bootloader) which directly supports your device to KDS and whose latest version was shared in the next thread:

https://community.nxp.com/thread/354802 

Another option is to go with a third party solution such as uTasker.

Regards!

Jorge Gonzalez

0 Kudos

1,456 Views
DavidS
NXP Employee
NXP Employee

Hi Eduardo,

That documentation is a bit vague.

I suspect that it really wants you to generate a KSDK_v2 to use.

Which K20 device are you using?  100MHz?  72MHz? or 50MHz?

The 100MHz version is a subset of the K60-100MHz devices as FYI.

If you use the KSDK_v2 SDK Builder tool you can select the specific processor you are using.

Once you download that ZIP and place someplace then you have access to the header files mentioned earlier.

My download has following path for reference:

C:\NXP\KSDK_v2\SDK_2.0_MK20DN512xxx10_KDS\devices\MK20D10 

Regards,

David 

0 Kudos