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_network_init(void);
25 extern void board_kinit_init(kinit_t *init_args);
26 extern void board_flash_init(void);
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)40 void board_init(void)
41 {
42     board_tick_init();
43     board_stduart_init();
44     board_dma_init();
45     board_gpio_init();
46     board_flash_init();
47 
48     /*FOR STM32F429 delete hal_i2c_pre_init \I2C1_init\CAN_init here*/
49 }
50 
aos_maintask(void * arg)51 void aos_maintask(void *arg)
52 {
53     board_init();
54     board_kinit_init(&kinit);
55     aos_components_init(&kinit);
56 
57 #ifndef AOS_BINS
58     application_start(kinit.argc, kinit.argv);  /* jump to app entry */
59 #endif
60 }
61 
62