EasyManua.ls Logo

Bosch XDK110 - Hello World Code Example; Hello World Operating Task

Bosch XDK110
25 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Workbench First Steps Guide XDK110
!
Page !15
XDK110 BCDS
© Bosch Connected Devices and Solutions GmbH reserves all rights even in the event of industrial property rights. We reserve all rights of disposal such as
copying and passing on to third parties. BOSCH and the symbol are registered trademarks of Robert Bosch GmbH, Germany.
Note: Specifications within this document are subject to change without notice.
2. Hello World Code Example
2.1 Hello World Operating Task
This section gives a small introduction about the operating and timer tasks. It should give the user a basic
understanding on how these tasks work via a hello world implementation. First, operating tasks will be
presented.
Note: main.c is required to start up the freeRTOS operating system. All code implementations will take place
in additional interface header .h files and implementation .c files. Please refer to the section 5.3 how to add
new interfaces to the XDK.
Code 4: Hello world implementation - main.c
!
/* system header files */
#include <stdio.h>
#include "BCDS_Basics.h"
/* additional interface header files */
#include "XdkSystemStartup.h"
#include "BCDS_Assert.h"
#include "BCDS_CmdProcessor.h"
#include "FreeRTOS.h"
#include "task.h"
/* own header files */
#include "application.h"
/* global variables ***************************************************** */
static CmdProcessor_T MainCmdProcessor;
/* functions */
int main(void){
/* Mapping Default Error Handling function */
Retcode_T returnValue = Retcode_initialize(DefaultErrorHandlingFunc);
if (RETCODE_OK == returnValue){
returnValue = systemStartup();
}
if (RETCODE_OK == returnValue){
returnValue = CmdProcessor_initialize(&MainCmdProcessor, (char *)
"MainCmdProcessor", TASK_PRIO_MAIN_CMD_PROCESSOR,
TASK_STACK_SIZE_MAIN_CMD_PROCESSOR, TASK_Q_LEN_MAIN_CMD_PROCESSOR);
}
if (RETCODE_OK == returnValue){
/* Here we enqueue the application initialization into the command
* processor, such that the initialization function will be invoked
* once the RTOS scheduler is started below.*/
returnValue = CmdProcessor_enqueue(&MainCmdProcessor, appInitSystem,
&MainCmdProcessor, UINT32_C(0));
}
if (RETCODE_OK != returnValue){
printf("System Startup failed");
assert(false);
}
/* start scheduler */
vTaskStartScheduler();
}