RT1050_FreeRTOS_Hello/source/freertos_hello.c

72 lines
1.8 KiB
C
Raw Normal View History

2021-02-03 17:44:12 +00:00
/*
* Copyright (c) 2015, Freescale Semiconductor, Inc.
* Copyright 2016-2017 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/* FreeRTOS kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "timers.h"
/* Freescale includes. */
#include "fsl_device_registers.h"
#include "fsl_debug_console.h"
#include "pin_mux.h"
#include "clock_config.h"
2021-02-08 14:37:11 +00:00
#include "peripherals.h"
2021-02-03 17:44:12 +00:00
#include "board.h"
/*******************************************************************************
* Definitions
******************************************************************************/
/* Task priorities. */
#define hello_task_PRIORITY (configMAX_PRIORITIES - 1)
/*******************************************************************************
* Prototypes
******************************************************************************/
static void hello_task(void *pvParameters);
/*******************************************************************************
* Code
******************************************************************************/
/*!
* @brief Application entry point.
*/
int main(void)
{
/* Init board hardware. */
BOARD_ConfigMPU();
BOARD_InitBootPins();
BOARD_InitBootClocks();
2021-02-08 14:37:11 +00:00
BOARD_InitBootPeripherals();
2021-02-03 17:44:12 +00:00
BOARD_InitDebugConsole();
2021-02-03 17:44:12 +00:00
if (xTaskCreate(hello_task, "Hello_task", configMINIMAL_STACK_SIZE + 100, NULL, hello_task_PRIORITY, NULL) !=
pdPASS)
{
PRINTF("Task creation failed!.\r\n");
while (1)
;
}
vTaskStartScheduler();
for (;;)
;
}
/*!
* @brief Task responsible for printing of "Hello world." message.
*/
static void hello_task(void *pvParameters)
{
for (;;)
{
PRINTF("Hello world.\r\n");
2021-02-08 14:37:11 +00:00
vTaskDelay(pdMS_TO_TICKS(400));
2021-02-03 17:44:12 +00:00
}
}