/**
  ******************************************************************************
  * @file    main.c 
  * @author  LI
  * @version V3.5.0
  * @date    08-April-2015
  * @brief   Main program body
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
  ******************************************************************************
  */

/* Includes ------------------------------------------------------------------*/
#include "includes.h"

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/





void  	 AppTaskStart(void *p_arg);
OS_TCB   AppTaskStartTCB;
CPU_STK  AppTaskStartStk[APP_TASK_START_STK_SIZE];


int main(void)
{
	/*!< At this stage the microcontroller clock setting is already configured, 
			 this is done through SystemInit() function which is called from startup
			 file (startup_stm32f10x_xx.s) before to branch to application main.
			 To reconfigure the default setting of 
	
	
	
	SystemInit() function, refer to
			 system_stm32f10x.c file*/
	
	OS_ERR  err;
	OSInit(&err);                                     // Init uC/OS-III.       
	OSTaskCreate((OS_TCB     *)&AppTaskStartTCB,      // Create the start task  
							 (CPU_CHAR   *)"App Task Start",
							 (OS_TASK_PTR )AppTaskStart, 
							 (void       *)0,
							 (OS_PRIO     )APP_TASK_START_PRIO,
							 (CPU_STK    *)&AppTaskStartStk[0],
							 (CPU_STK_SIZE)APP_TASK_START_STK_SIZE / 10,
							 (CPU_STK_SIZE)APP_TASK_START_STK_SIZE,
							 (OS_MSG_QTY  )0,
							 (OS_TICK     )0,
							 (void       *)0,
							 (OS_OPT      )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
							 (OS_ERR     *)&err);
							 
	NVIC_SetVectorTable(FLASH_BASE, 0x20000);//0x10000
	__ASM volatile ("cpsie i");
	OSStart(&err);
}
