main.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. ******************************************************************************
  3. * @file main.c
  4. * @author LI
  5. * @version V3.5.0
  6. * @date 08-April-2015
  7. * @brief Main program body
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  12. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  13. * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  14. * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  15. * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  16. * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  17. *
  18. * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
  19. ******************************************************************************
  20. */
  21. /* Includes ------------------------------------------------------------------*/
  22. #include "includes.h"
  23. /* Private typedef -----------------------------------------------------------*/
  24. /* Private define ------------------------------------------------------------*/
  25. /* Private macro -------------------------------------------------------------*/
  26. /* Private variables ---------------------------------------------------------*/
  27. /* Private function prototypes -----------------------------------------------*/
  28. /* Private functions ---------------------------------------------------------*/
  29. void AppTaskStart(void *p_arg);
  30. OS_TCB AppTaskStartTCB;
  31. CPU_STK AppTaskStartStk[APP_TASK_START_STK_SIZE];
  32. int main(void)
  33. {
  34. /*!< At this stage the microcontroller clock setting is already configured,
  35. this is done through SystemInit() function which is called from startup
  36. file (startup_stm32f10x_xx.s) before to branch to application main.
  37. To reconfigure the default setting of
  38. SystemInit() function, refer to
  39. system_stm32f10x.c file*/
  40. OS_ERR err;
  41. OSInit(&err); // Init uC/OS-III.
  42. OSTaskCreate((OS_TCB *)&AppTaskStartTCB, // Create the start task
  43. (CPU_CHAR *)"App Task Start",
  44. (OS_TASK_PTR )AppTaskStart,
  45. (void *)0,
  46. (OS_PRIO )APP_TASK_START_PRIO,
  47. (CPU_STK *)&AppTaskStartStk[0],
  48. (CPU_STK_SIZE)APP_TASK_START_STK_SIZE / 10,
  49. (CPU_STK_SIZE)APP_TASK_START_STK_SIZE,
  50. (OS_MSG_QTY )0,
  51. (OS_TICK )0,
  52. (void *)0,
  53. (OS_OPT )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
  54. (OS_ERR *)&err);
  55. NVIC_SetVectorTable(FLASH_BASE, 0x20000);//0x10000
  56. __ASM volatile ("cpsie i");
  57. OSStart(&err);
  58. }