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" # 此时程序就只会编译这个工程
    ]
}
相关推荐
叶小鸡1 小时前
Java 篇-项目实战-苍穹外卖-笔记汇总
java·开发语言·笔记
bubiyoushang8882 小时前
STM32F103C8T6+DM9051以太网功能实现方案
stm32·单片机·嵌入式硬件
IT_阿水2 小时前
基于STM32河流水质检测
stm32·单片机·嵌入式硬件
黑白园3 小时前
STM32定时器中断
stm32·单片机·嵌入式硬件
sakiko_3 小时前
UIKit学习笔记4-使用UITableView制作滚动视图
笔记·学习·ios·swift·uikit
晓梦林4 小时前
MAZESEC-X1靶场学习笔记
笔记·学习
weixin_456808384 小时前
【沁恒蓝牙开发】ADC DMA定时采样、转化
单片机·嵌入式硬件
华普微HOPERF5 小时前
MCU+BLE射频+丰富外设,BLE SoC如何高效传输数据?
单片机·嵌入式硬件
振南的单片机世界5 小时前
时钟开关:不用的外设,把它的时钟关掉,省电!
stm32·单片机·嵌入式硬件
iCxhust6 小时前
将8088 BootLoader分拆烧写到8086 ROM中
stm32·单片机·嵌入式硬件·51单片机·微机原理