您当前的位置: 首页 > 

跋扈洋

暂无认证

  • 4浏览

    0关注

    221博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

鸿蒙之串口输出

跋扈洋 发布时间:2020-11-09 20:19:59 ,浏览量:4

串口输出
  • 修改源码
    • 目录结构
    • 业务代码。
      • 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文件中)

  1. BUILD.gn为编译脚本
  2. hello_world.c为业务逻辑代码所在文件
hello_world.c
#include 
#include "ohos_init.h"
#include "ohos_types.h"
 
void led(void)
{
    int i=0;
    for(i=0;i            
关注
打赏
1663745539
查看更多评论
0.0361s