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" # 此时程序就只会编译这个工程
    ]
}
相关推荐
三佛科技-1341638421210 小时前
蒸面器/蒸脸仪方案开发,蒸面器/蒸脸仪MCU控制方案分析
单片机·嵌入式硬件
Katzelala14 小时前
[K8S学习笔记] Service和Ingress的关系
笔记·学习·kubernetes
WD1372980155714 小时前
WD5030A 芯片,12V降5V,输出电流12A,电路设计
stm32·单片机·嵌入式硬件·汽车
文火冰糖的硅基工坊15 小时前
[硬件电路-194]:NPN三极管、MOS-N, IGBT比较
单片机·嵌入式硬件·系统架构·电路
递归不收敛15 小时前
PyCharm项目上传GitHub仓库(笔记)
笔记·pycharm·github
递归不收敛15 小时前
一、Java 基础入门:从 0 到 1 认识 Java(详细笔记)
java·开发语言·笔记
xian_wwq16 小时前
【学习笔记】Https证书如何升级到国密
笔记·学习·证书
一又四分之一.17 小时前
hexo文章
笔记
Suckerbin18 小时前
TBBT: FunWithFlags靶场渗透
笔记·安全·web安全·网络安全
大筒木老辈子18 小时前
Linux笔记---基于HTTP协议搭建一个简单的Web服务器
笔记