AliOS Things APP DEV Guide - Shaofa/AliOS-Things-Certification-Manual GitHub Wiki
EN | 中文
This tutorial describes how to develope application from source based on AliOS Things, including environment setup, app creating, etc.
- Hardware Environment AliOS Things supports all kinds of hardware platforms, like develpment boards, serial port tools, debuggers, flashers, etc.
- Software Environment AliOS Things supports both CLI tools(Command Line Tools) and IDE for development, please turn to AliOS Things Development Environment Setup.
It is easy for development based on AliOS Things, CLI tools is cool for Linux/Mac users, while IDE is great for Windows users.
Steps to develop a typical application using CLI tools: project creating, Makefile writing, coding, building, flashing, debugging.
The application code based on AliOS Things is normally located at example/
directory, however you can either put it elsewhere on demand.
e.g.
example/
└── helloworld
├── helloworld.c
└── helloworld.mk
Makefile is used to specify application name, sources, components(dependencies), local and global flags, etc.
Here's a sample below, for helloworld.mk
:
NAME := helloworld ## specify name of this application
$(NAME)_SOURCES := helloworld.c ## source code files
$(NAME)_COMPONENTS += cli ## depended components,this sample depends on cli
$(NAME)_DEFINES += LOCAL_MACRO ## define local flags
GLOBAL_DEFINES += GLOBAL_MACRO ## define global flags
All sources reside in the application directory, you can organise it as you wish.
The application entry of AliOS Things is application_start
, e.g.
#include <aos/aos.h>
static void app_delayed_action(void *arg)
{
printf("%s:%d %s\r\n", __func__, __LINE__, aos_task_name());
aos_post_delayed_action(5000, app_delayed_action, NULL);
}
int application_start(int argc, char *argv[])
{
aos_post_delayed_action(1000, app_delayed_action, NULL);
aos_loop_run();
return 0;
}
Refer to Quickstart. Of course, you can use tools like gdb, valgrind, to debug the code above.
AliOS Things provides an IDE called AliOS Things Studio, it's easy and quick. AliOS Things Studio makes it possible by introducing the application templates, you can just import them and start from there. It supports building, firmware flashing, debugging and so on.
Refer to Create an application using AliOS Things Studio. Once created, you can start your application code development within AliOS Things Studio.
Refer to AliOS Things Studio.
This page describes how to develop the first Hello World application. Meanwhile, it introduces environment setup, basic steps to develop a AliOS Things application.
Please turn to AliOS Things GitHub project page to learn more details.