BearPi-HM Nano开发笔记

小熊派

简单介绍

BearPi-HM Nano开发板是一块专门为鸿蒙OS设计的HarmonyOS开发板,板载高度集成的2.4GHz WLAN SoC芯片Hi3861,并板载NFC电路及标准的E53接口可拓展

E53接口

介绍

E53接口标准为“物联网俱乐部”联合国内多家开发板厂家制定的物联网案例标准,E53接口的E取自扩展(Expansion)的英文首字母,板子的尺寸为5*3cm,故采用E53作为前缀来命名尺寸为5*3cm类型的案例扩展版,任何一款满足标准设计的开发板均可直接适配E53扩展板。

E53拓展板

E53扩展板是根据不同的应用场景来设计的,以最大的程度在扩展板上还原真实应用场景,不同案例的扩展版根据不同的应用场景来命名后缀。

接口定义

编译、烧录、工程的编写

下载和编译源码

  • 使用 hpm 软件

    1. 在打算存储项目工程代码的文件中打开终端(工程源码存放文件夹)

    2. hpm init -t default // 不知道是干嘛的
      hpm i @bearpi/bearpi_hm_nano // 这句话执行后就是下载源码   
      hpm dist // 编译源码
      
  • 使用 git 拉取

    1. 在打算存储项目工程代码的文件中打开终端(工程源码存放文件夹)

    2. git clone https://gitee.com/bearpi/bearpi-hm_nano.git
      python build.py [板子名字,如BearPi-HM_Nano] // 编译源码
      

烧录

HiBurn 是烧录软件

  1. 点击 Setting 设置baud为921600
  2. 选择COM
  3. select file:选中 OUT 文件夹中的 allinone.bin
  4. 打钩 Auto burn
  5. 点击 connect
  6. 按下开发板复位

工程编写

  1. 在下载源码的文件夹相对路径 applications\BearPi\BearPi-HM_Nano\sample\ 下创建工程文件夹名(如my_app)

  2. 在 my_app 下新建 xxx.c(我们认定 xxx.c 文件是程序入口函数存放区)、BUILD.gn

  3. 在 xxx.c 中写

    #include <stdio.h>
    #include "ohos_init.h" // 不可或缺
    
    void hello_kexie(void){
      printf("Hello KeXie!\r\n");
    }
    
    APP_FEATURE_INIT(hello_kexie); // 告诉编译器 hello_kexie 函数是程序入口函数
    
  4. 在 my_app 下的 BUILD.gn 中编写

    static_library("myapp"){ # "myapp" 指定输出的静态库文件名为 libmyapp.a
      sources = [
        "hello_world.c" # 指定 .a 文件所依赖的 .c 文件及路径,若路径包含"//"则表示绝对路径(此处为代码根路径),若不包含"//" 则表示相对路径
      ]
      include_dirs = [
        "//utils/native/lite/include" # 指定 source 所需依赖的 .h 文件路径
      ]
    }
    
  5. 在 sample 下的 BUILD.gn 中编写

  6. # Copyright (c) 2020 Nanjing Xiaoxiongpai Intelligent Technology Co., Ltd.
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #     http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    
    import("//build/lite/config/component/lite_component.gni")
    
    lite_component("app") {
        features = [
            #"A1_kernal_thread:thread_example",
            #"A2_kernel_timer:timer_example",
            #"A3_kernel_event:event_example",
            #"A4_kernel_mutex:mutex_example",
            #"A5_kernel_semaphore:semaphore_example",
            #"A6_kernel_message:message_example",
    
            #"B1_basic_led_blink:led_example",
            #"B2_basic_button:button_example",
            #"B3_basic_pwm_led:pwm_example",
            #"B4_basic_adc:adc_example",
            #"B5_basic_i2c_nfc:i2c_example",
            #"B6_basic_uart:uart_example",
            
            #"C1_e53_sf1_mq2:e53_sf1_example",
            #"C2_e53_ia1_temp_humi_pls:e53_ia1_example",
            #"C3_e53_sc1_pls:e53_sc1_example",
            #"C4_e53_sc2_axis:e53_sc2_example",
            #"C5_e53_is1_infrared:e53_is1_example",
    
            #"D1_iot_wifi_ap:wifi_ap",
            #"D2_iot_wifi_sta_connect:wifi_sta_connect",        
            #"D3_iot_udp_client:udp_client",
            #"D4_iot_tcp_server:tcp_server",
            #"D5_iot_mqtt:iot_mqtt",        
            #"D6_iot_cloud_oc:oc_mqtt",
            #"D7_iot_cloud_onenet:onenet_mqtt",
            #"D8_iot_cloud_oc_smoke:cloud_oc_smoke",
            #"D9_iot_cloud_oc_light:cloud_oc_light",
            #"D10_iot_cloud_oc_manhole_cover:cloud_oc_manhole_cover",
            #"D11_iot_cloud_oc_infrared:cloud_oc_infrared",
            #"D12_iot_cloud_oc_agriculture:cloud_oc_agriculture",
            #"D13_iot_cloud_oc_gps:cloud_oc_gps",
            "my_app:myapp" # 此时程序就只会编译这个工程
        ]
    }
    
  • 13
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值