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 app does not support this board.
18 Set the correspondence in file platform\board\aaboard_demo\ucube.py.
19 */
20 extern void board_tick_init(void);
21 extern void board_stduart_init(void);
22 extern void board_dma_init(void);
23 extern void board_gpio_init(void);
24 extern void board_kinit_init(kinit_t* init_args);
25 
26 /*  For user config
27     kinit.argc = 0;
28     kinit.argv = NULL;
29     kinit.cli_enable = 1;
30 */
31 static kinit_t kinit = {0, NULL, 1};
32 
33 /**
34   * @brief Board Initialization Function
35   * @param None
36   * @retval None
37   */
board_init(void)38 void board_init(void)
39 {
40     board_tick_init();
41     board_stduart_init();
42     board_dma_init();
43     board_gpio_init();
44 }
45 
aos_maintask(void * arg)46 void aos_maintask(void* arg)
47 {
48     board_init();
49     board_kinit_init(&kinit);
50     aos_components_init(&kinit);
51 
52 #ifndef AOS_BINS
53     application_start(kinit.argc, kinit.argv);  /* jump to app entry */
54 #endif
55 }
56 
57