MCR20A source migration from IAR to KDS

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

MCR20A source migration from IAR to KDS

3,611 Views
DipenPatel1z
Contributor III

Hi All,

In one of our design we are using MCR20A for 802.15.4 connectivity. But source (MCR20A_IEEE_802_15_4) for MCR20A is supported on IAR Workbench only. We would like to know how can we migrate source from IAR to KDS?

Also there are pre-built MAC libraries in MCR20A_IEEE_802_15_4\ieee_802_15_4\Lib\ folder. Is there a way to rebuild them? I couldn't find any project file under MCR20A_IEEE_802_15_4\ieee_802_15_4\?

Is it possible to achieve? Appreciate your response.

Regards,

Dipen Patel

Labels (1)
Tags (3)
11 Replies

2,523 Views
AngelC
Senior Contributor I

Hello Dipen,

IAR EWARM and KDS have very different toolchains and development frameworks, so there is not an automated process to convert projects between these IDEs at all. The normal procedure would be to create a new project in KDS and import all the required source/header/ files from the example project you need. However, we do not have any examples or guidelines about this.

Regards,

AngelC

2,523 Views
davidrwhite
Contributor I

Hello Angel,

Can the IAR mcr20a examples be converted to KDS?

I see compiled .a libs such as Freescale_802.15.4_MAC_06_M4_IAR.a in the C:\Freescale\MCR20A_IEEE_802_15_4\ieee_802_15_4\Lib.  Are these for IAR only or can I just use them with KDS?

I have a couple of FRDM-K64F and FRDM-CR20A pairs and have them working but I need to build with KDS.  Would the steps be:

1- with KDS 3.0 create kinetis project

2- use KSDK 1.1.0

3- copy Sources from working example

4- set paths and symbols for the needed C:\Freescale\MCR20A_IEEE_802_15_4 dirs as well as other needed dirs

5- use Freescale_802.15.4_MAC_06_M4_IAR.a libs even though they say IAR in the name

Is there a set of KDS 3.0 Freescale_802.15.4_xxxx libs that are gcc compiled for us mere mortals to use with the KSDK 1.1.0 and this mad quest?

Thanks,

David

.

0 Kudos

2,523 Views
sunilkumar_sing
Contributor III

Hi David,

Yes, It is possible to  convert  IAR MCR20a  to KDS.

We have recently done it for FRDMK22F/KL26.

Please go through with  my previous post . Hope this will help you.

Thanks,

Sunil

0 Kudos

2,523 Views
davidrwhite
Contributor I

Hello Sunil,

Yes it helped and thanks for posting your work.

My target is just the already working FRDM-K64F and not a port to a new chip as you have done.  I'm just bumbling along with the FRDM-K64 + FRDM-CR20A and have sensor data coming in and out via an embedded tornado server.  All so far is with the IAR stuff.  Alas, of course, to expensive for me and so I'm working on the K64 + CR20A mywirelessapp example with KDS 3.0 and KSDK 1.1.

Are you using KDS 3.0 and KSDK 1.1 ?

Did you link to ..\ieee_802_15_4\Lib\Freescale_802.15.4_MAC_06_M4_IAR.a ?

Thanks,

David

.

0 Kudos

2,523 Views
sunilkumar_sing
Contributor III

Hi David,

We used  KDS 3.0 and KSDK 1.2.

We did't link \ieee_802_15_4\Lib\Freescale_802.15.4_MAC_06_M4_IAR.a  and  it is not required.

It would be bit simple  for K64 because there are no pin mux changes are required in board files.

Just you need to set the source path of K64 which is available on KSDK1.2

I did't check it with KSDK1.1.

Thanks,

Sunil

0 Kudos

2,522 Views
sunilkumar_sing
Contributor III

Hi AngelC,

I am also working on the same thing.

Means ,We need to import all source code to KDS and compile it  ?

I found that  mcr20a source package is for K64 and we are using K22, So How can we migrate it for K22F ?

Would be great help if you can share some guideline for us. its  bit urgent.

Regards,

Sunil

0 Kudos

2,523 Views
AngelC
Senior Contributor I

Hello Sunil,

There is not any straight-forward process to migrate a solution from K64 to K22, although it should be possible in theory.  We have not done such thing with MAC examples so I could not say it is possible or easy to do. However, using KSDK should make it simpler. I could only recommend you to try it and verify whether it works or not. Sorry for the inconvenience. 

Regards,

AngelC

2,523 Views
sunilkumar_sing
Contributor III

Hi AngeIC,

Thanks for this input.

Thanks,

Sunil

0 Kudos

2,523 Views
sunilkumar_sing
Contributor III

Hi AngleC,

We are able to migrate MCR20A source IAR to KDS environment.

Below are the steps:

1-Create a New Project for  K22F.

2-Open the pre-build application in IAR Workbench, and copy all the files which  are used in     application in single directory "sources".

3-Then copy the board related files (Ex: Board.c, Board.h, gpio_pins.c, gpio_pins.h, pin_mux.c, pin_mux.h) from C:\Freescale\KSDK_1.2.0\examples\frdmk22f on the "sources" directory.

and modified the following files:

Board.c :

void BOARD_InitXCVR(void)                                             //Added start point

{

gpio_output_pin_user_config_t xcvrResetPin =

    {

.pinName = kGpioXcvrReset,

.config.outputLogic = 1,

.config.slewRate = kPortSlowSlewRate,

.config.driveStrength = kPortLowDriveStrength,

    };

   

    configure_xcvr_pins(0);

   

    /* Reset XCVR */

GPIO_DRV_OutputPinInit(&xcvrResetPin);

GPIO_DRV_ClearPinOutput(kGpioXcvrReset);

GPIO_DRV_SetPinOutput(kGpioXcvrReset);

PORT_HAL_SetSlewRateMode(PORTD, 5, kPortSlowSlewRate);

}

                                                                                                // Added end point

void dbg_uart_init(void)

{

// configure_uart_pins(BOARD_DEBUG_UART_INSTANCE);              //Commented

// DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_DEBUG_UART_BAUD, kDebugConsoleUART);                                 // Commented

}

int debug_printf(const char  *fmt_s, …)                      //Function Added

{

return 0;

}

  1. Board.h :

#define BOARD_USE_DSPI 1

#define gXcvrSpiInstance_c      1                   // Changed K22F use of SPI  1

#ifndef APP_SERIAL_INTERFACE_TYPE

#define APP_SERIAL_INTERFACE_TYPE (gSerialMgrUart_c)

#endif

#ifndef APP_SERIAL_INTERFACE_INSTANCE

#define APP_SERIAL_INTERFACE_INSTANCE (1)                               

#endif

/* Function to initialize the MCR20 XCVR */

void BOARD_InitXCVR(void);                                                       

gpio_pins.c :

gpio_input_pin_user_config_t switchPins[] = {

            {

                        .pinName = kGpioSW1,                                 // Added extra not available in K64F default

                        .config.isPullEnable = true,

                        .config.pullSelect = kPortPullUp,

                        .config.isPassiveFilterEnabled = false,

                        .config.interrupt = kPortIntFallingEdge           // Changed in default file kPortIntDisabled

            },

            {

                .pinName = kGpioSW4,                             // Added extra not available in k64f default file

                .config.isPullEnable = true,

                .config.pullSelect = kPortPullUp,

                .config.isPassiveFilterEnabled = false,

                .config.interrupt = kPortIntFallingEdge       //Changed  “kPortIntDisabled” with kPortIntFallingEdge

            },

gpio_output_pin_user_config_t ledPins[] = {

    {

.pinName = kGpioLED1,

.config.outputLogic = 1,

.config.slewRate = kPortSlowSlewRate,

.config.driveStrength = kPortHighDriveStrength,                      //Default kPortLOWDriveStrength

    },

gpio_pins.h :

enum _gpio_pins_pinNames{                                                 // added start point

  /* FRDM-MCRR20A switches */                                                    // K22F                        K64F

kGpioSW1 = GPIO_MAKE_PIN(GPIOA_IDX, 4U),                  // PTA4  <--PTB23

// kGpioSW2 = GPIO_MAKE_PIN(GPIOA_IDX, 1U),

  /* FRDM-K64F switches */

// kGpioSW3 = GPIO_MAKE_PIN(GPIOC_IDX, 6U),

kGpioSW4 = GPIO_MAKE_PIN(GPIOA_IDX, 4U),                  // PTA4  -- NOT FOUND

// kGpioAccelINT1 = GPIO_MAKE_PIN(GPIOC_IDX, 6U),        // PTC6  -- NOT FOUND

// kGpioAccelINT2 = GPIO_MAKE_PIN(GPIOC_IDX, 13U),      //PTC13 -- NOT FOUND

// kGpioSdhc0Cd = GPIO_MAKE_PIN(GPIOE_IDX, 6U),            //PTE6 -- NOT FOUND

  /* FRDM-MCR20A LEDs */

// kGpioLED1 = GPIO_MAKE_PIN(GPIOC_IDX, 10U),

// kGpioLED2 = GPIO_MAKE_PIN(GPIOC_IDX, 11U),

// kGpioLED3 = GPIO_MAKE_PIN(GPIOB_IDX, 11U),

  /* FRDM-MK64F LEDs */

// kGpioLED1 = GPIO_MAKE_PIN(GPIOE_IDX, 26U),

// kGpioLED2 = GPIO_MAKE_PIN(GPIOB_IDX, 22U),

// kGpioLED3 = GPIO_MAKE_PIN(GPIOB_IDX, 21U),

// kGpioUartDemoRX = GPIO_MAKE_PIN(GPIOB_IDX, 16),    // NOT FOUND

kGpioSpi0Cs0 = GPIO_MAKE_PIN(GPIOD_IDX, 0),                

kGpioSpi0Cs1 = GPIO_MAKE_PIN(GPIOD_IDX, 4),                

  /* SerialManager Data Available Pins */

kGpioSpiSlaveDAP  = GPIO_MAKE_PIN(GPIOC_IDX, 3U),     // PTC3 <-- PTC2

kGpioSpiMasterDAP = GPIO_MAKE_PIN(GPIOC_IDX, 3U),

kGpioI2cSlaveDAP  = GPIO_MAKE_PIN(GPIOC_IDX, 3U),

kGpioI2cMasterDAP = GPIO_MAKE_PIN(GPIOC_IDX, 3U),

  /* XCVR pins */

kGpioXcvrSpiMiso = GPIO_MAKE_PIN(GPIOD_IDX,  7),        //PD7 <-- PD3

kGpioXcvrSpiMosi = GPIO_MAKE_PIN(GPIOD_IDX,  6),

kGpioXcvrSpiSck  = GPIO_MAKE_PIN(GPIOD_IDX,  5),

kGpioXcvrSpiCs   = GPIO_MAKE_PIN(GPIOD_IDX,  4),

kGpioXcvrReset   = GPIO_MAKE_PIN(GPIOB_IDX,  18),

kGpioXcvrIrq     = GPIO_MAKE_PIN(GPIOB_IDX,  16),

kGpioXcvrGpio3   = GPIO_MAKE_PIN(GPIOC_IDX,  6),

kGpioXcvrGpio4   = GPIO_MAKE_PIN(GPIOB_IDX,  19),

kGpioXcvrGpio5   = GPIO_MAKE_PIN(GPIOA_IDX,  1),

kGpioXcvrClkOut  = GPIO_MAKE_PIN(GPIOE_IDX, 1)           // ALL DONE

};                                                                                                         // added end point

pin_mux.c :

/************************** Commented existing functions *******************/ 

//void pin_mux_SPI(uint32_t instance)                      

//{

// switch(instance) {

// case 0: /* SPI0 */

// /* PORTD_PCR0 */

// /*PORT_HAL_SetMuxMode(PORTD,0u,kPortMuxAlt2);*/

// PORT_HAL_SetMuxMode(PORTC,4u,kPortMuxAlt2);   /*** Temporary work around until next board spin. ***/

// /* PORTD_PCR3 */

// //PORT_HAL_SetMuxMode(PORTD,3u,kPortMuxAlt2);

// PORT_HAL_SetMuxMode(PORTC,5u,kPortMuxAlt2);   /*** Temporary work around until next board spin. ***/

// /* PORTD_PCR1 */

// /*PORT_HAL_SetMuxMode(PORTD,1u,kPortMuxAlt2);*/

// PORT_HAL_SetMuxMode(PORTC,6u,kPortMuxAlt2);   /*** Temporary work around until next board spin. ***/

// /* PORTD_PCR2 */

// /*PORT_HAL_SetMuxMode(PORTD,2u,kPortMuxAlt2);*/

// PORT_HAL_SetMuxMode(PORTC,7u,kPortMuxAlt2);   /*** Temporary work around until next board spin. ***/

// break;

// case 1: /* SPI1 */

// /* PORTD_PCR4 */

//      PORT_HAL_SetMuxMode(PORTD,4u,kPortMuxAlt7);

// /* PORTD_PCR5 */

// PORT_HAL_SetMuxMode(PORTD,5u,kPortMuxAlt7);

// /* PORTD_PCR6 */

// PORT_HAL_SetMuxMode(PORTD,6u,kPortMuxAlt7);

// /* PORTD_PCR7 */

// PORT_HAL_SetMuxMode(PORTD,7u,kPortMuxAlt7);

// break;

// default:

// break;

//  }

//}

//

//void pin_mux_UART(uint32_t instance)

//{

// switch(instance) {

// case 1: /* UART1 BT */

// /* PORTE_PCR0 */

//      PORT_HAL_SetMuxMode(PORTE,0u,kPortMuxAlt3);

// /* PORTE_PCR1 */

// PORT_HAL_SetMuxMode(PORTE,1u,kPortMuxAlt3);

// break;

// default:

// break;

//  }

//}

//************************ Add Below Functions********************

void configure_spi_pins(uint32_t instance)

{

switch(instance) {   

case SPI0_IDX: /* SPI0 */

/* Affects PORTD_PCR0 register */

PORT_HAL_SetMuxMode(PORTD,0u,kPortMuxAlt2);

/* Affects PORTD_PCR3 register */

      PORT_HAL_SetMuxMode(PORTD,3u,kPortMuxAlt2);

/* Affects PORTD_PCR1 register */

PORT_HAL_SetMuxMode(PORTD,1u,kPortMuxAlt2);

/* Affects PORTD_PCR2 register */

PORT_HAL_SetMuxMode(PORTD,2u,kPortMuxAlt2);

break;

case SPI1_IDX:                       /* SPI1 */

/* Affects PORTD_PCR4 register */

PORT_HAL_SetMuxMode(PORTD,4u,kPortMuxAlt7);

/* Affects PORTD_PCR7 register */

PORT_HAL_SetMuxMode(PORTD,7u,kPortMuxAlt7);

/* Affects PORTD_PCR5 register */

      PORT_HAL_SetMuxMode(PORTD,5u,kPortMuxAlt7);

/* Affects PORTD_PCR6 register */

PORT_HAL_SetMuxMode(PORTD,6u,kPortMuxAlt7);

break;

default:

break;

  }

}

void configure_uart_pins(uint32_t instance)

{

switch(instance) {   

    case UART1_IDX:                      /* UART1 */                  //  changed as per k22f

/* Affects PORTB_PCR16 register */

            PORT_HAL_SetMuxMode(PORTE,0u,kPortMuxAlt3);            //PORT_HAL_SetMuxMode(PORTB,16u,kPortMuxAlt3);

/* Affects PORTB_PCR17 register */

            PORT_HAL_SetMuxMode(PORTE,1u,kPortMuxAlt3);            //PORT_HAL_SetMuxMode(PORTB,17u,kPortMuxAlt3);

break;

// case UART4_IDX: /* UART4 */                            // Uart4 commented

// /* Affects PORTC_PCR14 register */

// PORT_HAL_SetMuxMode(PORTC,14u,kPortMuxAlt3);

// /* Affects PORTC_PCR15 register */

// PORT_HAL_SetMuxMode(PORTC,15u,kPortMuxAlt3);

// break;

default:

break;

  }

}

void configure_xcvr_pins(uint32_t instance)  // changes

{

            PORT_HAL_SetMuxMode(PORTD, 7u, kPortMuxAsGpio);                                  //PORT_HAL_SetMuxMode(PORTD, 3u, kPortMuxAsGpio);

            PORT_HAL_SetMuxMode(PORTA, 5u, kPortMuxAsGpio);           //We didn't found this pin for K22F

            //PORT_HAL_SetMuxMode(PORTA, 5u, kPortMuxAsGpio);

}

// ********************** done ********************************

pin_mux.h :

void configure_xcvr_pins(uint32_t instance);

Linker changes :

Now, Add the below flag in linker in project setting.

-specs=nosys.specs -specs=nano.specs -Xlinker –defsym=__ram_vector_table__=1

We have tested it to run send and receive demo application and verified it.

If you can spare your some time to validate the changes/inputs then that would be the great help for us.

Thanks,

Sunil

2,523 Views
trytohelp
NXP Employee
NXP Employee

Hi,

I don't have lot of experience with IAR tool but I know you can run IAR under Eclipse too.

This could be a good way to move the IAR workbench project to IAR Eclipse and at the end more easy to convert it to KDS.

This could help you:

Tutorial: Replacing IAR EW with Eclipse IDE | MCU on Eclipse

Have a great day,
Pascal
Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

2,523 Views
DipenPatel1z
Contributor III

Hi Pascal,

I have already referred to that link but it relies on IAR Workbench installed on your system. So not much helpful. Thanks for your response though.

Regards,

Dipen Patel

0 Kudos