2 Star 3 Fork 4

AliOS Things/eduk1_demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
maintask.c 2.13 KB
一键复制 编辑 原始数据 按行查看 历史
skylarCai 提交于 2021-08-31 17:39 . release version:rel_3.3.0-20210826_1600
/*
* Copyright (C) 2015-2020 Alibaba Group Holding Limited
*/
#include "aos/init.h"
#include "board.h"
#include <aos/kernel.h>
#include <k_api.h>
#include <stdio.h>
#include <stdlib.h>
#include "build_version.h"
#ifndef AOS_BINS
extern int application_start(int argc, char *argv[]);
#endif
/*
If board have no component for example board_xx_init, it indicates that this app
does not support this board. Set the correspondence in file
platform\board\aaboard_demo\ucube.py.
*/
extern void board_tick_init(void);
extern void board_stduart_init(void);
extern void board_detect();
extern void board_dma_init(void);
extern void board_gpio_init(void);
extern void board_kinit_init(kinit_t *init_args);
/* For user config
kinit.argc = 0;
kinit.argv = NULL;
kinit.cli_enable = 1;
*/
static kinit_t kinit = {0, NULL, 1};
/**
* @brief Board Initialization Function
* @param None
* @retval None
*/
void board_init(void)
{
board_tick_init();
board_stduart_init();
board_dma_init();
board_gpio_init();
}
void aos_maintask(void *arg)
{
board_init();
board_kinit_init(&kinit);
aos_components_init(&kinit);
board_detect();
#if (ENABLE_FACTORY_TEST == 1)
uint8_t image_version[22];
sprintf(image_version, "VER: %s", BUILD_VERSION);
printf("\r\n Enter HaaSEDUk1 factorytest model, Version : %s \r\n", image_version);
int value = 0;
int re_value = 0;
int len = 32;
if (0 != aos_kv_get("factory_test", &value, &len)) {
if (0 == aos_kv_get("reboot_times", &re_value, &len)) {
if (re_value++ < 3) {
aos_kv_set("reboot_times", &re_value, len, 1);
printf("reboot_times is avild, add it %d!\r\n", re_value);
} else {
goto normal_mode;
}
} else {
re_value++;
printf("reboot_times is not avild, create it %d!\r\n", re_value);
aos_kv_set("reboot_times", &re_value, len, 1);
}
}
factorytest_mode:
printf("board_test entry here!\r\n");
board_test();
normal_mode:
#endif
#ifndef AOS_BINS
application_start(kinit.argc, kinit.argv); /* jump to app entry */
#endif
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/alios-things/eduk1_demo.git
git@gitee.com:alios-things/eduk1_demo.git
alios-things
eduk1_demo
eduk1_demo
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385