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. 在打算存储项目工程代码的文件中打开终端(工程源码存放文件夹)

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

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

    cmd 复制代码
    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 中写

    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 中编写

    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 中编写

gn 复制代码
# 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" # 此时程序就只会编译这个工程
    ]
}
相关推荐
kyle~14 分钟前
电控三周速成计划参考
单片机·嵌入式硬件
dg10111 小时前
go-zero学习笔记(三)
笔记·学习·golang
bjackal2 小时前
K8S学习笔记-------1.安装部署K8S集群环境
笔记·学习·kubernetes
yz-俞祥胜2 小时前
.Net Core笔记知识点(跨域、缓存)
笔记·.netcore
亭台2 小时前
【Excel笔记_5】 LET 函数中数据范围不连续的处理方法
笔记·excel
kfepiza2 小时前
Nginx反向代理 笔记250203
运维·服务器·笔记·nginx
YYYYYY020205 小时前
ue5笔记(2)
笔记·ue5
和小潘一起学AI6 小时前
机器学习--2.多元线性回归
笔记·算法·机器学习
Vincent_Zhang2336 小时前
Word List 2
笔记
北辰水墨7 小时前
深入理解linux中的文件(上)
linux·服务器·笔记·文件