building project for CY8CKIT-064S0S2-4343W

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
senfrost
Level 1
Level 1
First like received 10 sign-ins 5 questions asked

Hi,

I am using the CY8CKIT-064S0S2-4343W development kit and want to build a new application but board is not in the new application wizard so how do I go about making a project for this board?

I have imported the AWS demos project but I have no idea how to make a new project any help would be amazing

0 Likes
1 Solution
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Hello @senfrost ,

Basically, let's say you did the following change in vApplicationDaemonTaskStartupHook function in main.c file.

init_application();

//DEMO_RUNNER_RunDemos();


You will have to create this function in the following manner in main.c:

void init_application(void)
{
	static demoContext_t appContext =
	{
	       .networkTypes = AWSIOT_NETWORK_TYPE_WIFI,
	       .demoFunction                = run_application,
	       .networkConnectedCallback    = NULL,
	       .networkDisconnectedCallback = NULL
	};

	Iot_CreateDetachedThread( runDemoTask,
			&appContext,
			tskIDLE_PRIORITY,
			(configMINIMAL_STACK_SIZE * 10) );
}


Now the "run_application" function is where you will create your other tasks that need to be run for example:

int run_application(bool aws_iot_mqtt_mode,
		const char * p_identifier,
		void * p_network_server_info,
		void * p_network_credential_info,
		const IotNetworkInterface_t * p_network_interface )
{
	/* Create your tasks */
	xTaskCreate(sensor_task, "runinferenceengine", TASK_STACK_SIZE, NULL, TASK_PRIORITY, NULL);
	xTaskCreate(control_task, "getinferenceresult", TASK_STACK_SIZE, NULL, TASK_PRIORITY, NULL);
	xTaskCreate(task_mqtt, "mqtt_task", TASK_MQTT_STACK_SIZE, NULL, TASK_MQTT_PRIORITY, NULL);

	return 0;
}


Now, each of the header/source files of these tasks can be added in the root directory, or a source folder can be created and added as shown below:

DheerajK_81_0-1629378335748.png

At this point, it is pretty how you would write FreeRTOS code. Hope this helps 🙂

Regards,
Dheeraj

View solution in original post

0 Likes
3 Replies
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Hello @senfrost ,

Yes, the S0S2 kit was developed for the AWS ecosystem and this is why you do not see its BSP in the New Application Wizard. We are planning to support it soon and I will update the thread once it is released. 

Once the aws_demos project is imported, go to vApplicationDaemonTaskStartupHook function in main.c and comment out DEMO_RUNNER_RunDemos(). Here you can add your own function that spawns off multiple threads based on your application. Please refer to this code example to understand more about the implementation.

Hope this helps 🙂

Regards,
Dheeraj

0 Likes
senfrost
Level 1
Level 1
First like received 10 sign-ins 5 questions asked

Hi @DheerajK_81,

Thanks for the help just one more question.

if I now want to add other .c .h file to the program in order to organise my code do I need to edit any files and if I do which files and what do I need to add?

Kind Regards

senfrost

0 Likes
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Hello @senfrost ,

Basically, let's say you did the following change in vApplicationDaemonTaskStartupHook function in main.c file.

init_application();

//DEMO_RUNNER_RunDemos();


You will have to create this function in the following manner in main.c:

void init_application(void)
{
	static demoContext_t appContext =
	{
	       .networkTypes = AWSIOT_NETWORK_TYPE_WIFI,
	       .demoFunction                = run_application,
	       .networkConnectedCallback    = NULL,
	       .networkDisconnectedCallback = NULL
	};

	Iot_CreateDetachedThread( runDemoTask,
			&appContext,
			tskIDLE_PRIORITY,
			(configMINIMAL_STACK_SIZE * 10) );
}


Now the "run_application" function is where you will create your other tasks that need to be run for example:

int run_application(bool aws_iot_mqtt_mode,
		const char * p_identifier,
		void * p_network_server_info,
		void * p_network_credential_info,
		const IotNetworkInterface_t * p_network_interface )
{
	/* Create your tasks */
	xTaskCreate(sensor_task, "runinferenceengine", TASK_STACK_SIZE, NULL, TASK_PRIORITY, NULL);
	xTaskCreate(control_task, "getinferenceresult", TASK_STACK_SIZE, NULL, TASK_PRIORITY, NULL);
	xTaskCreate(task_mqtt, "mqtt_task", TASK_MQTT_STACK_SIZE, NULL, TASK_MQTT_PRIORITY, NULL);

	return 0;
}


Now, each of the header/source files of these tasks can be added in the root directory, or a source folder can be created and added as shown below:

DheerajK_81_0-1629378335748.png

At this point, it is pretty how you would write FreeRTOS code. Hope this helps 🙂

Regards,
Dheeraj

0 Likes