Including existing libraries from KSDK1.2

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

Including existing libraries from KSDK1.2

967 Views
nelsonlobo
Contributor II

Ive created a project in the following manner in KDS3.0

 

File--> New --> ProjectName --> Next -->Processors --> Kinetis L --> MKL2x --> KL25Z(48MHz) --> MKL25Z128xxx4 --> Next -->(Nothing selected here) --> Finish

 

Now i write following piece of code in main:

#include "MKL25Z4.h"

/*!

* @brief Main function

*/

int main (void)

{

       unsigned int count = 0;

       SIM_BASE_PTR->SCGC5 |= SIM_SCGC5_PORTB_MASK; //refer to page 206 to check the SCGC5 register which is the System clock gating control register

 

       //PORTB_BASE_PTR->PCR[18] =  PORT_PCR_MUX(1); //

       PORTB_PCR18 = PORT_PCR_MUX(1);

 

       //PTB_BASE_PTR->PDDR = 1 << 18;

       GPIOB_PDDR = 1<<18;

 

       while(1)

       {

         //PTB_BASE_PTR->PSOR = 1 << 18;

         GPIOB_PSOR |= 1<<18;

         for(count = 0;count <1000000;count++);

 

         //PTB_BASE_PTR->PCOR = 1 << 18;

         GPIOB_PCOR |= 1<<18;

         for(count = 0;count <1000000;count++);

         }

         return 0;

}

 

This code toggles bit 18 of PORTB.

 

I wanted to know if i were to use the libraries as done in KSDK1.2.0 examples into this code how do i do it ?

 

Following is the code example for the same output using KSDK1.2.0 example Hello World:

NOTE: in this code ive removed the LPTMR section since i just want to focus on basic port pins functions

 

// SDK Included Files

#include "board.h"

 

/*!

* @brief Main function

*/

int main (void)

{

     unsigned int count = 0;

 

    // Initialize standard SDK demo application pins

    hardware_init();

 

    // Initialize LED1

    LED1_EN;

    LED2_EN;

    LED3_EN;

 

    LED1_ON;

    LED2_ON;

    LED3_ON;

 

    while(1)

    {

         LED1_TOGGLE;

         for(count = 0;count <10000;count++);

    }

}

 

I want to know a way wherein i could provide a path in the project to these KSDK1.2.0 headers so that i could use these functions.

Labels (1)
0 Kudos
5 Replies

512 Views
ivadorazinova
NXP Employee
NXP Employee

Hello Nelson,

better way is create new project with KSDK 1.2 selected option and remove what you do not need because you have included libraries in KSDK project.

ksdk.png

For this case you can use GPIO example.

Every KSDK example has included board folder, which contains board.c/h, gpio_pins.c/h and pin_mux.c/h.

board.h is board configuration - contains specific macros as LEDs, push buttons...

board.c contains clock and oscillator initialization functions

gpio_pins.h/c - contains definitions which KSDK GPIO driver uses for the platform´s GPIO pins.

pins_mux.c/h - contains peripheral-specific pin mux configurations.These functions can be called by the

hardware_init() function or individually by the demo application.

gpio.png

Please, look at the example code,gpio example is located here <ksdk_path>\examples\<board>\driver_examples\gpio it is unnecessary to copy the code here.

I hope this helps

Iva

0 Kudos

512 Views
nelsonlobo
Contributor II

OK. I just tried creating a project using KSDK 1.2.0 but it wouldnt let me to do so. I guess i have to install KSDK 1.2.0 Eclipse update inroder to do dat.

Now the issue is that everytime i try downloading this package it crashes with some error. Is there any alternative link to the same?

0 Kudos

512 Views
ivadorazinova
NXP Employee
NXP Employee

Hello,

for eclipse update is the only way.

Please, follow this procedure to Installing Kinetis SDK into KDS

If does not help, please, let me know.

I hope it helps you,

Best Regards,

Iva

0 Kudos

512 Views
nelsonlobo
Contributor II

Hi Iva,

I have installed KSDK1.2.0 update. Also created a new project using KSDK1.2.0 from project creation.

The problem is that when i try to add board.h it throws an error stating ""../Sources/main.c:33:19: fatal error: board.h: No such file or directory"

pastedImage_1.png

As u notice the board folder is missing. How do you add the board folder that possesses all the board related libraries ?

0 Kudos

512 Views
ivadorazinova
NXP Employee
NXP Employee

Hello Nelson Lobo,

No, KSDK code is different.

There is different structure with functions for that.

You can try it by this way:

How to toggle LED in KDS 2.0 with KSDK 1.1.0 and Processor Expert

Video Link : 3195

I hope this helps you.

Best Regards,

Iva

0 Kudos