How to get started with AN2295?

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

How to get started with AN2295?

4,010 Views
lander
Contributor IV

I have the AN2295_Kinetis_rev5_works folder with all the bootloader files. I want to create a bootloader with the AN2295 with the KL25z board...

In my project, I tried to organize the necessary files as best I can. I added these files:

FLASH folder:

     flash_kinetis.c

     flash_kinetisRamFunc.c

Project_Headers folder:

     AN2295_FRDM_KL25Z_cfg.h

     bootloader_cfg.h

     crc.h

     derivative.h

     flash_kinetis.h

     gpio.h

     kinetis_params.h

     main.h

     MKL25Z128LK4.h

     rs232.h

     wdg.h

Sources folder:

     bootloader.c

     bootloader.h

     crc.c

     gpio.c

     main.c

     rs232.c

     sa_mtb.c

Am I missing anything? I kept getting errors saying that AN2295_TWR_K60_cfg.h couldn't be found but why would I need it if I'm using the KL25Z? Also, when I did add AN2295_TWR_K60_cfg.h I got errors saying that I was declaring twice, or reinitializing.

Thank you,

Lander

Labels (1)
15 Replies

2,782 Views
pavel_krenek
NXP Employee
NXP Employee

Hi Lander,

I did some print screens of setting in CodeWarrior 10.3, it would be more helpful for you:

First step choose the correct TARGET:

cw10_3.jpg

Second step choose correct configuration file (cfg):

cw10_3_a.png

I hope that helps,

Regards,

Pavel

0 Kudos
Reply

2,782 Views
lander
Contributor IV

If I already have OpenSDA on my KL25z, how to I also allow Multilink debugging for this project?

Thank you.

0 Kudos
Reply

2,781 Views
pavel_krenek
NXP Employee
NXP Employee

Hi,

you can select conection type P&E ARM.... and in Connection type you can choose Interface Multilink or OpenSDA debugger:

opesda.png

Regards,

Pavel

0 Kudos
Reply

2,782 Views
lander
Contributor IV

Ok, I know exactly why I was so lost. I think I may have the wrong version... there are so many versions of this out there!! My version doesn't have Kinetis L listed in the targets (does have K60 though).... currently searching for the right version now.

Thank you.

0 Kudos
Reply

2,782 Views
pavel_krenek
NXP Employee
NXP Employee

The AN2295 is very user friendly bootloader but for first time of use it is always detects some irregularities. I do not think so that AN2295 is not good enought. This AN2295 based bootlaoder is not connected with another system which you have to use.

My suggestion: I can send you the example with all needed setting for Freedom board KL25Z, I think it is the easiest way. Let me know.

Regards,

Pavel

0 Kudos
Reply

2,782 Views
lander
Contributor IV

That would be great. I believe it's user friendly, I hate having to always use the excuse that I'm extremely new to all of this. I'm an intern and still working on my computer science degree...

This community is a great way to help me learn. Everyone is really friendly. I'm very grateful.

2,782 Views
kai_liu
Senior Contributor I

If you just want a serial bootloader, AN2295 is not good enough. Although I created a paper for AN2295 bootloader hands on tutorial on FRDM-KL25Z, I would like to recommend Erich's serial bootloader, which only requires virtual terminal software on PC, instead of dedicated PC util software. Check it out here. mcuoneclipse/Examples/FRDM-KL25Z/FRDM_Bootloader at master · ErichStyger/mcuoneclipse · GitHub

Re-inventing wheel is kind of waste.

0 Kudos
Reply

2,782 Views
pavel_krenek
NXP Employee
NXP Employee

Hello,

I created the bootloader AN2295. I recomend to you download all sw pack and there is included examples for most of Kinetis MCUs. The examples is ported on tower boards and freedom boards. The AN2295 also supports three of developing tools for Kinetis MCUs (CodeWarrior, IAR, Keil).

There will be my first step how to use bootloader,

Pavel

0 Kudos
Reply

2,782 Views
Microfelix
Contributor IV

Hello

I used the application AN2295 with K70 and MQX 4.0.2

I am having difficulty.

I saw that if you do not comment out the line for SIM_SCGC4, the firmware will not start.

Remains locked.

It 'happened to you?

Maurizio

0 Kudos
Reply

2,782 Views
hectorsanchez
Contributor IV

I recommend you to check this thread: AN2295 bootloader hands on tutorial on FRDM-KL25Z

Are you creating a new project? Or are you using an example project from another source?

0 Kudos
Reply

2,782 Views
lander
Contributor IV

I couldn't find an example project from a different source. So, I'm creating a new project and trying to add the necessary files from the sw pack.

Thank you, I'll check the link out.

LA

0 Kudos
Reply

2,782 Views
pavel_krenek
NXP Employee
NXP Employee


Hi,

the bootloader project includes support for three of developing tools. You may select which one you will be use.

-     next step is select the correct target of Kinetis MCU - for example (Kinetis K 100 MHz, Kinetis L, Kinetis M etc.)

-     next step is select correct configuration header file in "bootloader_cfg.h" (there is also prepared some configuration file for freescale tower board, freedom etc.). You can use some of them or if you are using another board, you have create the new one exactly for your board (use some of created configuration file as template).

Best regards,

0 Kudos
Reply

2,782 Views
lander
Contributor IV

I'm just lost on where to select these options? Bootloader project as in AN2295SW > AN2295sw > src > Kinetis > CW_10.2? And then change the target MCU?

0 Kudos
Reply

2,782 Views
pavel_krenek
NXP Employee
NXP Employee


Are you using the CW ? If yes, you as you wrote CW_10.3 -> AN2295_Kinetis/.project. This file you have to open in your workspace in CodeWarior, after that you can start with previosly mentioned settings.

Pavel

0 Kudos
Reply

2,782 Views
lander
Contributor IV

Okay, here is what I did.

1. I created a project and selected the correct target. (KL25Z128)

2. I copied all the .h and .c files from the AN2295_Kinetis/.project, but replaced K60 header with the KL25 header and the bootloader_cfg.h with the AN2295_FRDM_KL25Z_crg.h.

3. I had errors everywhere so I made sure the variables that I won't need from K60 are commented out.

I am running into errors on the bootloader.c and the flash_kinetis.c files. Below are my errors. They seem to be spawning from the lines with __declspec because the parameters do exist in bootloader.h and all those parameters are declared after __declspec. I'm using the same files from AN2295_Kinetis/.project but if you need me to attach anything, I will.

What am I doing wrong?

Description Path Resource Location Type

declaration for parameter 'address' but no such parameter /KL25Z_Boot/Sources/bootloader bootloader.c line 88 C/C++ Problem

declaration for parameter 'bootloaderIdent' but no such parameter /KL25Z_Boot/Sources/bootloader bootloader.c line 105 C/C++ Problem

declaration for parameter 'crc_res' but no such parameter /KL25Z_Boot/Sources/bootloader bootloader.c line 99 C/C++ Problem

declaration for parameter 'enableBootMode' but no such parameter /KL25Z_Boot/Sources/bootloader bootloader.c line 101 C/C++ Problem

declaration for parameter 'ExecuteOnStackStart' but no such parameter /KL25Z_Boot/Sources/flash flash_kinetis.c line 31 C/C++ Problem

declaration for parameter 'FlashConfig_t' but no such parameter /KL25Z_Boot/Sources/bootloader bootloader.c line 78 C/C++ Problem

declaration for parameter 'FTFL_FlashCommandSequence' but no such parameter /KL25Z_Boot/Sources/flash flash_kinetis.c line 29 C/C++ Problem

declaration for parameter 'length' but no such parameter /KL25Z_Boot/Sources/bootloader bootloader.c line 93 C/C++ Problem

declaration for parameter 'programbuffer' but no such parameter /KL25Z_Boot/Sources/flash flash_kinetis.c line 25 C/C++ Problem

declaration for parameter 'result' but no such parameter declaration for parameter 'i' but no such parameter /KL25Z_Boot/Sources/bootloader bootloader.c line 95 C/C++ Problem

declaration for parameter 'rom_vector' but no such parameter /KL25Z_Boot/Sources/bootloader bootloader.c line 49 C/C++ Problem

declaration for parameter 'srs_backup' but no such parameter /KL25Z_Boot/Sources/bootloader bootloader.c line 97 C/C++ Problem

declaration for parameter 'timeout_cnt' but no such parameter /KL25Z_Boot/Sources/bootloader bootloader.c line 103 C/C++ Problem

declaration for parameter 'tmp_transpone' but no such parameter /KL25Z_Boot/Sources/bootloader bootloader.c line 89 C/C++ Problem

declaration for parameter 'write_buffer' but no such parameter /KL25Z_Boot/Sources/bootloader bootloader.c line 91 C/C++ Problem

expected '{' at end of input /KL25Z_Boot/Sources/bootloader bootloader.c line 639 C/C++ Problem

expected '{' at end of input /KL25Z_Boot/Sources/flash flash_kinetis.c line 288 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/bootloader bootloader.c line 138 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/bootloader bootloader.c line 152 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/bootloader bootloader.c line 173 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/bootloader bootloader.c line 190 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/bootloader bootloader.c line 216 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/bootloader bootloader.c line 252 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/bootloader bootloader.c line 337 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/flash flash_kinetis.c line 37 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/flash flash_kinetis.c line 58 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/flash flash_kinetis.c line 73 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/flash flash_kinetis.c line 103 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/flash flash_kinetis.c line 153 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/flash flash_kinetis.c line 216 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/flash flash_kinetis.c line 229 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/flash flash_kinetis.c line 242 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/flash flash_kinetis.c line 249 C/C++ Problem

expected '=', ',', ';', 'asm' or '__attribute__' before '{' token /KL25Z_Boot/Sources/flash flash_kinetis.c line 262 C/C++ Problem

expected declaration specifiers before '__declspec' /KL25Z_Boot/Sources/bootloader bootloader.c line 81 C/C++ Problem

expected declaration specifiers before ';' token /KL25Z_Boot/Sources/bootloader bootloader.c line 84 C/C++ Problem

mingw32-make: *** [Sources/bootloader/bootloader.o] Error 1  KL25Z_Boot   C/C++ Problem

mingw32-make: *** [Sources/flash/flash_kinetis.o] Error 1  KL25Z_Boot   C/C++ Problem

mingw32-make: *** Waiting for unfinished jobs....  KL25Z_Boot   C/C++ Problem

parameter 'bootloaderIdent' is initialized /KL25Z_Boot/Sources/bootloader bootloader.c line 105 C/C++ Problem

parameter 'rom_vector' is initialized /KL25Z_Boot/Sources/bootloader bootloader.c line 49 C/C++ Problem

storage class specified for parameter 'FlashConfig_t' /KL25Z_Boot/Sources/bootloader bootloader.c line 78 C/C++ Problem

storage class specified for parameter 'FTFL_FlashCommandSequence' /KL25Z_Boot/Sources/flash flash_kinetis.c line 29 C/C++ Problem

0 Kudos
Reply