串口输出
修改源码
目录结构
- 修改源码
- 目录结构
- 业务代码。
- hello_world.c
- BUILD.gn(app/BUILD.gn)
- BUILD.gn()
- 编译烧录
- 编译
- 烧录
- 观察现象
- 后续
先在./applications/sample/wifi-iot/app路径下新建一个目录(或一套目录结构),用于存放业务源码文件。 本例程:在app下新增业务chuankou,其中hello_world.c为业务代码,BUILD.gn为编译脚本,具体规划目录结构如下:
.
└── applications
└── sample
└── wifi-iot
└── app
│── chuankou
│ │── hello_world.c
│ └── BUILD.gn
└── BUILD.gn
新建./applications/sample/wifi-iot/app/chuankou下的hello_world.c文件,在hello_world.c中新建业务入口函数HelloWorld,并实现业务逻辑。并在代码最下方,使用HarmonyOS启动恢复模块接口SYS_RUN()启动业务。(SYS_RUN定义在ohos_init.h文件中)
- BUILD.gn为编译脚本
- hello_world.c为业务逻辑代码所在文件
#include
#include "ohos_init.h"
#include "ohos_types.h"
void led(void)
{
int i=0;
for(i=0;i
关注
打赏