1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 5 #include <stdio.h> 6 #include <stdlib.h> 7 #include <aos/kernel.h> 8 #include "aos/init.h" 9 #include "board.h" 10 #include <k_api.h> 11 12 #ifndef AOS_BINS 13 extern int application_start(int argc, char *argv[]); 14 #endif 15 16 /* 17 * If board have no component for example board_xx_init, it indicates that this 18 * app does not support this board. 19 * Set the correspondence in file platform\board\aaboard_demo\ucube.py. 20 */ 21 extern void board_tick_init(void); 22 extern void board_stduart_init(void); 23 extern void board_dma_init(void); 24 extern void board_gpio_init(void); 25 extern void board_kinit_init(kinit_t *init_args); 26 27 /* 28 * For user config 29 * kinit.argc = 0; 30 * kinit.argv = NULL; 31 * kinit.cli_enable = 1; 32 */ 33 static kinit_t kinit = {0, NULL, 1}; 34 35 /* 36 * @brief Board Initialization Function 37 * @param None 38 * @retval None 39 */ board_init(void)40void board_init(void) 41 { 42 board_tick_init(); 43 board_stduart_init(); 44 board_dma_init(); 45 board_gpio_init(); 46 } 47 aos_maintask(void * arg)48void aos_maintask(void *arg) 49 { 50 board_init(); 51 board_kinit_init(&kinit); 52 aos_components_init(&kinit); 53 54 #ifndef AOS_BINS 55 application_start(kinit.argc, kinit.argv); /* jump to app entry */ 56 #endif 57 } 58 application_start(int argc,char * argv[])59int application_start(int argc, char *argv[]) 60 { 61 int ret; 62 63 aos_set_log_level(AOS_LL_DEBUG); 64 65 ret = BleCfg_run(); 66 if (ret) { 67 return ret; 68 } 69 70 aos_msleep(100); 71 72 (void)BleCfg_recovery_wifi(); 73 (void)BleCfg_recovery_devinfo(); 74 75 while (1) { 76 aos_msleep(1000); 77 }; 78 79 return 0; 80 } 81 82 83