Header file confusion

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

Header file confusion

Jump to solution
882 Views
jrychter
Contributor V

I recently tried KDS for the first time (on a Mac). I tried recreating a simple K20 project that I had in CodeWarrior by creating a new project in KDS, then moving the C source files over. However, I encountered problems, and I am confused:

 

First, there is no derivative.h — I only got a MK20D5.h include. I changed my source file to include that directly, instead of derivative.h — is that the right thing to do?

 

Second, lots of defines seem to have vanished — basic things like PORTA_PCR18, or GPIOC_PSOR.

 

I proceeded to quickly diff the old MK20D5.h that I had in my CodeWarrior project and the new one in KDS and the results are even more confusing: the old version was labeled as "rev. 3.3", and the one in KDS is labeled as "rev 2.3". But they both share the same date. The changelog does not indicate any massive changes, and yet the files are very different.

 

What am I doing wrong?

Labels (1)
0 Kudos
1 Solution
512 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Jan:

Sorry for the confusion created so far. There is no error or problem with the header files, you are just looking at two different kind of headers and the fact that the name is the same is just an inconvenience.

Please read my last response in the next thread: KL25Z CMSIS-Core/CMSIS Peripheral Access Layer headers

And the next discussion as well: why bare-metal head file is so different from PE head file even with same version like MK21F12.h

You can read the abstract for each type of MK20D5.h:

K20D50_Header.png

In KDS you may find both kind of files in these paths:

- C:\Freescale\KDS_3.0.0\eclipse\ProcessorExpert\Config\PE\CPE\wizard_data\wizards\kds\MK20D5\Include

- C:\Freescale\KDS_3.0.0\eclipse\ProcessorExpert\lib\Kinetis\iofiles

The No CMSIS compliant header is now only used when creating a project with Processor Expert using legacy LDD components (No KSDK).

There are macros not present in the CMSIS file, but you can easily replace such register accesses. In your case this would be the code:

PORTA->PCR[18]

PTC->PSOR

I hope this helps to clarify.

Regards!

Jorge Gonzalez

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

Note: If this post answers your question, please click the Correct Answer button. It would be nice!

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

View solution in original post

7 Replies
513 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Jan:

Sorry for the confusion created so far. There is no error or problem with the header files, you are just looking at two different kind of headers and the fact that the name is the same is just an inconvenience.

Please read my last response in the next thread: KL25Z CMSIS-Core/CMSIS Peripheral Access Layer headers

And the next discussion as well: why bare-metal head file is so different from PE head file even with same version like MK21F12.h

You can read the abstract for each type of MK20D5.h:

K20D50_Header.png

In KDS you may find both kind of files in these paths:

- C:\Freescale\KDS_3.0.0\eclipse\ProcessorExpert\Config\PE\CPE\wizard_data\wizards\kds\MK20D5\Include

- C:\Freescale\KDS_3.0.0\eclipse\ProcessorExpert\lib\Kinetis\iofiles

The No CMSIS compliant header is now only used when creating a project with Processor Expert using legacy LDD components (No KSDK).

There are macros not present in the CMSIS file, but you can easily replace such register accesses. In your case this would be the code:

PORTA->PCR[18]

PTC->PSOR

I hope this helps to clarify.

Regards!

Jorge Gonzalez

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

Note: If this post answers your question, please click the Correct Answer button. It would be nice!

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

512 Views
jrychter
Contributor V

Thank you, Jorge, this explanation makes everything clear. I somehow missed the transition to CMSIS, even though I've spent some time reading the user guide and release notes. This is a good direction, and I will update my code.

However, one question still remains — is the idea of a "derivative.h" file gone? I have library code that is reusable across multiple Kinetis devices, and I'd rather include a "derivative.h" than specify the exact variant in my library code. How does one include "whatever CPU the project targets" in library C code?

0 Kudos
512 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Jan:

The derivative.h is no longer used, you would need to add it manually. Only KSDK projects have the CPU explicitly declared as a macro in the project properties. Sorry for that inconvenience.

Regards!

Jorge Gonzalez

0 Kudos
512 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Jan,

You are right .Some header files have not the define of "PORTA_PCR18" , it not your error , it have not been update .

While , i recommend you use the latest version of KDS3.0 , you can download it here :

https://freescale.flexnetoperations.com/control/frse/product?entitlementId=123588587&lineNum=1&authC...

For i checked it on my side , the version is :

Version:      

rev. 3.4, 2013-10-29  

And it have the define :

pastedImage_0.png

While my PC is windows , and if you have use the latest version in you pC  of MAC , it still have not the define , it meaning have not update .

it doesn't matter , you can copy and paste the define you use from CW .

Hope it helps


Have a great day,
Alice

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
512 Views
jrychter
Contributor V

I just checked and the Linux version of KDS 3.0.0 also installs "rev. 2.3, 2013-06-24" of the MK20D5.h header file.

Steps to reproduce:

1. Install KDS 3.0.0 as described in documentation

2. Create a new project

3. Choose "Kinetis project" as a template

4. Enter project name

5. Choose MK20DX128xxx5 in "Processors"

6. Open the "Includes" directory in the project — there is no derivative.h and the MK20D5.h header is rev. 2.3.

0 Kudos
512 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Jan,

In my personal  opinion, i also agree with you about that they are should use the same version on different PC system.

While i think maybe the update not synchronize among different system .

Now you only can develop it with this version you have , and define something it did not have , i think the update in the future will update it .

BR

Alice

0 Kudos
512 Views
jrychter
Contributor V

I use a freshly installed KDS 3.0.0 on a Mac, where I created a new project. My MK20D5.h header file says "Version: rev. 2.3, 2013-06-24".

I think this is a serious problem — why are the KDS 3.0.0 header files different on different platforms?

0 Kudos