How to use C++ in SDK 2.0 Project

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

How to use C++ in SDK 2.0 Project

1,077 Views
simplethings
Contributor III

Hello guys, I've just started using Kinetis SDK.

I downloaded SDK_2.1_FRDM-KL25Z folder from kex.nxp.com

I created a new project using

File -> Kinetis SDK 2.x Project

However while creating project I was never asked what compiler should be used nor is it  C or C++ project.

In the source folder there is a following code:

[code]

#include <string.h>

#include "board.h"
#include "pin_mux.h"
#include "clock_config.h"
/*#include "fsl_debug_console.h"*/

/* FreeRTOS kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "timers.h"


/* Task priorities. */
#define hello_task_PRIORITY (configMAX_PRIORITIES - 1)

/*!
 * @brief Task responsible for printing of "Hello world." message.
 */
static void hello_task(void *pvParameters) {
  for (;;) {
    /*PRINTF("Hello world.\r\n");*/
    /* Add your code here */
    vTaskSuspend(NULL);
  }
}

/*!
 * @brief Application entry point.
 */
int main(void) {
  /* Init board hardware. */
  BOARD_InitPins();
  BOARD_BootClockRUN();
  BOARD_InitDebugConsole();

  /* Add your code here */

  /* Create RTOS task */
  xTaskCreate(hello_task, "Hello_task", configMINIMAL_STACK_SIZE, NULL, hello_task_PRIORITY, NULL);
  vTaskStartScheduler();

  for(;;) { /* Infinite loop to avoid leaving the main function */
    __asm("NOP"); /* something to use as a breakpoint stop while looping */
  }
}

[/code]

After trying the build the project from

Project -> Build all I get the following error (in the picture attached)

Also If I try to run the program it says that 'Binary could not be found'

I am really not familiar with eclipse so if someone could help me I am stuck with googleing whole day this problem.

Big thanks!

0 Kudos
4 Replies

839 Views
simplethings
Contributor III

The error I get following your steps: Binary not found

0 Kudos

839 Views
MarekTrmac
NXP Employee
NXP Employee

Hi fsa saf,

I suppose the question is related to KDS - there is separate community for the tool: https://community.nxp.com/community/kinetis/kinetis-design-studio

To answer your question:

  • Go to File - New - C++ Project
  • Enter Project Name
  • Select Executable - Kinetis Project for SDK 2.x
  • Continue as in your previous step

Compiler is used based on the file extension - *.c files are compiled using C compiler and *.cpp files are compiled using CPP compiler.

Regards

Marek

0 Kudos

839 Views
simplethings
Contributor III

I followed your steps:

[url=https://postimg.org/image/oqjap7w53/][img]https://s23.postimg.org/oqjap7w53/CPP_Kinetis.jpg[/img][/u...]

Also regarding link you provided I am getting the following message:

Unauthorized

This place or content does not exist or access to it is restricted. If you think this is a mistake, please contact your administrator or the person who directed you here.

0 Kudos